Forums / Suggestions / Siteaccess information in cronjobs

Siteaccess information in cronjobs

Author Message

Piotrek Karaś

Saturday 07 June 2008 9:39:36 am

Hello,

In my cronjob PHP script I'm trying to reach current siteaccess setting, unfortunately, to success. The only thing I've reached is a bool(false) value, no matter if the cronjob is run explicitly for specific siteaccess, or for a default one without siteaccess declaration.

Is there any reliable method of retrieving that information?

Also, when I use cronjob to generate URL's, the siteaccess information (as well as the dir/index.php) is missing from them...:

...
$href = $node->urlAlias();
eZURI::transformURI( $href );
...

What do I do wrong? If it would be impossible to retrieve the siteaccess info, isn't that a huge problem?

Thanks,

Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bruce Morrison

Saturday 07 June 2008 3:50:48 pm

Hi Piotrek

How are you running your cronjobs? What eZ version? How are you accessing the siteaccess setting?

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Piotrek Karaś

Saturday 07 June 2008 10:00:19 pm

Hi Bruce,

Thanks for your intrest!

I've tried all combinations know to me, just like, for what initially was an extension job:

php runcronjobs.php partname
php runcronjobs.php partname -s defaultsiteaccess
php runcronjobs.php partname -s adminsiteaccess
php runcronjobs.php partname -siteaccess defaultsiteaccess
php runcronjobs.php partname -siteaccess adminsiteaccess

Then I moved it around, including the main cronjobs directory, both putting it as a part OR global cronjob list. The job is always found, but:

1) never seems to respond to siteaccess declaration
2) never was siteaccess-aware (not to mention being able to retrieve that information):

$href = 'user/login';
eZURI::transformURI( $href, false, 'full' );
$cli->output( $href );

keeps returning:

/user/login

3) the weird thing: when I have this as an extension cronjob that is siteaccess dedicated, any of the above call will find it, no matter how I call. Here's the ini structure within extension:

/extension/myextension/settings/site.ini.append.php
/extension/myextension/settings/siteaccess/defaultsiteaccess/cronjob.ini.append.php

This seems also weird, I would expect that adminsiteaccess cronjob call should never find it, but it keeps finding it... Now, after some tests, this seems to work as I have expected, only with reversed syntax:

php runcronjobs.php -s defaultsiteaccess partname
php runcronjobs.php -s adminsiteaccess partname

The first one finds the extension cronjob, the second one not. It's just not the syntax I found here:
http://ez.no/doc/ez_publish/technical_manual/4_0/features/cronjobs/running_cronjobs
This particular problem looks to be related to this part of runcronjobs.php:

for ( $i = 1; $i < count( $argv ); ++$i )
{
    $arg = $argv[$i];
    if ( $readOptions and strlen( $arg ) > 0 and $arg[0] == '-' )
    {
        //...
    }
    else
    {
        // It seems like $readOptions will never reach siteaccess declaration if cronjob part is declared as the first argument...:
        if ( $cronPart === false )
        {
            $readOptions = false;
            $cronPart = $arg;
        }
    }
}

This is eZ Publish 4.0.0 and it seems to behave the same with or without this patch:
http://issues.ez.no/IssueView.php?Id=11842&activeItem=91&rv[]=732&rm=1&column=8&sortOrder=4
I run all my tests directly with PHP CLI - I assumed I do not have to run real CRON to confirm...

To summarize, even when I made my runcronjobs.php find only the cronjob parts it should, still I'm nowhere near getting the siteaccess information or at least making eZURI::transformURI() method notice it ;(
I have no much experience with 3.x cronjobs, so I'm not sure what to expect...

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Piotrek Karaś

Thursday 12 June 2008 8:52:48 pm

So, does anyone know if I'm making some silly mistake, or if there is something really wrong with the runcronjobs.php tool in eZP 4.0.0? It would be great to have that fixed before 4.0.1 becomes stable...

I remember asking this question about running cronjobs months ago... I didn't quite understand why I had to call the jobs for different siteaccesses. So, if there's actually no siteaccess information available or no distinction between siteaccess, what would be the point?

Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Monday 11 August 2008 11:40:29 pm

Have you reported this Piotrek?
I think it has been like this for a while so might be a doc bug.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Tuesday 12 August 2008 12:24:42 am

Yup, it's here:
http://issues.ez.no/IssueView.php?Id=13190&activeItem=2

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

eZ debug

Timing: Jan 18 2025 00:49:06
Script start
Timing: Jan 18 2025 00:49:06
Module start 'content'
Timing: Jan 18 2025 00:49:07
Module end 'content'
Timing: Jan 18 2025 00:49:07
Script end

Main resources:

Total runtime0.8684 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0090 587.7344180.8281
Module start 'content' 0.00910.7181 768.5625653.9063
Module end 'content' 0.72720.1412 1,422.4688346.8594
Script end 0.8684  1,769.3281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00510.5860210.0002
Check MTime0.00200.2358210.0001
Mysql Total
Database connection0.00090.102210.0009
Mysqli_queries0.768088.43262050.0037
Looping result0.00260.29952030.0000
Template Total0.830895.720.4154
Template load0.00280.327120.0014
Template processing0.827995.332320.4140
Template load and register function0.00020.020810.0002
states
state_id_array0.00190.218210.0019
state_identifier_array0.00250.283520.0012
Override
Cache load0.00240.2773590.0000
Sytem overhead
Fetch class attribute can translate value0.00110.126540.0003
Fetch class attribute name0.00120.139690.0001
XML
Image XML parsing0.00170.196640.0004
class_abstraction
Instantiating content class attribute0.00000.0029120.0000
General
dbfile0.00250.2856410.0001
String conversion0.00000.000930.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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
18content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 48
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs