How can I do this ? (DB select)

Author Message

Selmah Maxim

Sunday 18 May 2003 2:51:05 am

Hi ..

I have create new class for users, user can add his site info, business info .. etc, and he must select the period (3,6,12 month) from enum selector, everthing work nice.

Now, i wanna write php file and run as cron job, this fill will run once in the day, and will search the expiry of the users data, by selecting the enum value and adding it to the last modified date, and if it found will set a value in this class called Sata to 0, as unpublished .

So, i had worte this lines to select all the data for this class number 7, but i don`t know the tables relation, i cann`t figure it out, coz i need to select the last verion, and when i select the last verion i got empty array.

___________ CODE ____________________
$query = "select Max(version) as Max_Ver from ezcontentobject_attribute";
$Max_Ver =& $db->arrayQuery( $query );

$query = "select * from ezcontentobject, ezcontentobject_attribute , ezenumobjectvalue
where
ezcontentobject.contentclass_id ='7'
and
ezcontentobject_attribute.version = '$Max_Ver[0][Max_Ver]
and
ezcontentobject_attribute.contentobject_id = ezcontentobject.id
and
ezenumobjectvalue.contentobject_attribute_id =ezcontentobject_attribute.id

";
$attributeArray =& $db->arrayQuery( $query );
echo "<pre>";
print_r( $attributeArray);

____________________________________

any1 can help me plz ?

Paul Forsyth

Sunday 18 May 2003 3:06:03 am

Have you looked at using workflows? You can specify when classes become unpublished.

Paul

Selmah Maxim

Sunday 18 May 2003 4:37:23 am

I know, but to make it as cron job is faster and easier than make new workflow, what u think ?!

Selmah Maxim

Sunday 18 May 2003 5:57:10 am

I gived up :(

Paul ..

can give more info please ?!

Paul Forsyth

Sunday 18 May 2003 7:01:00 am

oops, sorry, posted to the wrong forum :(

heres what i wrote:

Workflows uses a cronjob as the underlying mechanism to affect the database. So you can schedule your ez cronjob to run whenever.

have a search for workflow on the forums. lots of info like this:

http://ez.no/developer/ez_publish_3/forum/setup_design/workflow

hope it helps

Selmah Maxim

Sunday 18 May 2003 7:09:30 am

i had read it befor, i had read all what i found in the serach with this words 'workflow+approve' , but i didn`t get the point of unpublish, publish workflow !

now am trying to write check exp. workflow, coz i don`t think the publish or unpublish do the job.

Paul Forsyth

Sunday 18 May 2003 7:31:29 am

From what i understand of what you want to do workflow is the best way.

With it you can select the articles, choose to unpublish them at a given date, and the cronjob will run and perform the checks. When the date is reached the articles will be unpublished.

Have you attempted to use workflows yet?

Selmah Maxim

Sunday 18 May 2003 8:22:28 am

yes ... i had tried the publish and unpublish workflow, the publish have (Unpublish object, Publish object) , nice but what come after this ?

and Unpublish ?

were to set when to publish or unpublish ?

which workflow to choose ?

in my class there are enum, which have 3 value timestamp for 3,6,12 month, so if i add this value to the published timestamp i`ll get the exp. date, how make workflow check this ?

now am trying to write my own workflow, but is very complex for me the DB structure , i cann`t unserstanted it to make query from it, also i cann`t catch which class is used for fetching the data map in the template systems to use it in the custom workflow ...

really sad, also i found bug, for my is really big bug, that when you delete anything from the adminface will not be detele from all tables, so after while the site will come slow, and the search will be deadly slow, coz alot of unwanted trash in the db :(

i don`t what think about Ez, but for me it`s come clearly that they don`t get money from selling the code, or building sites, it`s coming from the support, and only the support, i was thinking to ask them for some custom workflow and for more addons for ez32, but it`s cost alot, much better to write my own script and developering it slowly ...
I had worte my script, but i stop it, coz i counted what time i need to finish it, and testing , so i thoght if i start from ez32 will be faster, but am up set now ....

but i`ll keep trying to figure it out, coz is tested as code, i`ll need to change alot to figure what i need from it .

I hope i`ll finish befor Ez4 :)

now any help please ?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:32:34
Script start
Timing: Jan 18 2025 11:32:34
Module start 'layout'
Timing: Jan 18 2025 11:32:34
Module start 'content'
Timing: Jan 18 2025 11:32:34
Module end 'content'
Timing: Jan 18 2025 11:32:34
Script end

Main resources:

Total runtime0.0151 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.9141152.6250
Module start 'layout' 0.00520.0029 740.539139.4453
Module start 'content' 0.00810.0046 779.984497.2109
Module end 'content' 0.01270.0023 877.195338.3047
Script end 0.0151  915.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003019.9370140.0002
Check MTime0.00159.9110140.0001
Mysql Total
Database connection0.00063.793010.0006
Mysqli_queries0.002516.529930.0008
Looping result0.00000.092910.0000
Template Total0.001711.510.0017
Template load0.00117.458510.0011
Template processing0.00063.996210.0006
Override
Cache load0.00085.352410.0008
General
dbfile0.00032.061980.0000
String conversion0.00000.064640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs