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

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 04:12:33
Script start
Timing: Jan 18 2025 04:12:33
Module start 'layout'
Timing: Jan 18 2025 04:12:33
Module start 'content'
Timing: Jan 18 2025 04:12:34
Module end 'content'
Timing: Jan 18 2025 04:12:34
Script end

Main resources:

Total runtime1.3086 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 594.2422152.6250
Module start 'layout' 0.00660.0044 746.867239.4453
Module start 'content' 0.01101.2957 786.3125650.7422
Module end 'content' 1.30670.0019 1,437.054720.1563
Script end 1.3086  1,457.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3069160.0003
Check MTime0.00170.1281160.0001
Mysql Total
Database connection0.00150.117910.0015
Mysqli_queries1.233394.2411680.0181
Looping result0.00070.0564660.0000
Template Total1.263096.520.6315
Template load0.00270.208020.0014
Template processing1.260296.300620.6301
Template load and register function0.00010.007010.0001
states
state_id_array0.00230.172510.0023
state_identifier_array0.00210.161620.0011
Override
Cache load0.00240.1832590.0000
Sytem overhead
Fetch class attribute can translate value0.00060.048230.0002
Fetch class attribute name0.00120.091390.0001
XML
Image XML parsing0.00170.131730.0006
class_abstraction
Instantiating content class attribute0.00000.0019120.0000
General
dbfile0.00110.0873300.0000
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 48
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs