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.