Forums / Developer / subtree in cronjob

subtree in cronjob

Author Message

Pierre-Jean Bazire

Wednesday 10 January 2007 3:15:10 am

hi,
I try to create a cronjob entension.

My extension run in web mode. 'result => OK'.

After modify my code source, the function subtree doesn't match.

$folderProducteur is a valid value.

// get a variable from the file.
$ini = eZINI::instance( "7hls.ini", getcwd().'/settings/siteaccess/extranet' );
$folderProducteur = $ini->variable( "NodeID", "id_folder_producteur" );

$Childrens = eZContentObjectTreeNode::subTree(false,$folderProducteur);

here, my $Childrens value is null, my extension doesn't create my object.

Why is run in web mode but not in cronjob ?

thanks for your help.

Kristof Coomans

Wednesday 10 January 2007 3:41:09 am

Hi Pierre-Jean

This is probably because the anonymous user does not have permission to read the objects you are trying to fetch.

Take a look at http://ezpedia.org/wiki/en/ez/logging_in_a_specific_user for some PHP code to log in a specific user.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Pierre-Jean Bazire

Wednesday 10 January 2007 5:08:44 am

I try this.
But I logged my user with :

$currentUser =& eZUser::loginUser($login,$pwd) ;

I try too your code, but no match too.
The current user is a valid user.

I don't see the solution :(

information : my version of ezpublish is 3.7.

Kristof Coomans

Wednesday 10 January 2007 5:44:24 am

Can you show us the whole script? It will be easier to debug then.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Pierre-Jean Bazire

Wednesday 10 January 2007 7:41:38 am

it's the beginning of my code source.

$user = eZUser::fetchByName('Admin'); //*** ez administror
$userID = $user->attribute( 'contentobject_id' );
eZUser::setCurrentlyLoggedInUser( $user, $userID );

// get a variable from the file.
$ini = eZINI::instance( "mysite.ini", getcwd().'/settings/siteaccess/extranet' );
$folderProducteur = $ini->variable( "NodeID", "id_folder_producteur" );

//** on lit les enfants du noeud producteur et on les stocke dans divers tableau***
/*$parent =& eZContentObjectTreeNode::fetch($folderProducteur) ;print_r($parent)  ;
$Childrens =& $parent->subTree();*/ //old method (method in web mode)

$Childrens = eZContentObjectTreeNode::subTree(false,$folderProducteur);

foreach ($Childrens as $stat_item)
{
//**** my process
}

with this code, Subtree return null.

Kristof Coomans

Wednesday 10 January 2007 10:34:11 am

And you are running it with the runcronjobs.php script?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Pierre-Jean Bazire

Monday 15 January 2007 7:34:08 am

yes, I run this code with cronjob.php

eZ debug

Timing: Jan 18 2025 19:39:11
Script start
Timing: Jan 18 2025 19:39:11
Module start 'content'
Timing: Jan 18 2025 19:39:12
Module end 'content'
Timing: Jan 18 2025 19:39:12
Script end

Main resources:

Total runtime0.7906 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.6094180.8438
Module start 'content' 0.00640.6614 768.4531587.3984
Module end 'content' 0.66780.1227 1,355.8516341.0703
Script end 0.7905  1,696.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.5406210.0002
Check MTime0.00150.1910210.0001
Mysql Total
Database connection0.00080.103210.0008
Mysqli_queries0.712790.14912060.0035
Looping result0.00190.23982040.0000
Template Total0.765696.820.3828
Template load0.00220.276620.0011
Template processing0.763496.558320.3817
Template load and register function0.00020.021910.0002
states
state_id_array0.00090.114010.0009
state_identifier_array0.00100.125220.0005
Override
Cache load0.00190.2391370.0001
Sytem overhead
Fetch class attribute can translate value0.00190.235530.0006
Fetch class attribute name0.00100.126580.0001
XML
Image XML parsing0.00110.133330.0004
class_abstraction
Instantiating content class attribute0.00000.0029100.0000
General
dbfile0.00240.2993270.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs