Forums / Developer / cli script slow

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

cli script slow

Author Message

Oliver Frommel

Wednesday 05 September 2007 1:11:43 am

Björn X

Wednesday 05 September 2007 5:43:50 am

eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $object->attribute('current_version')))

Well the contentobject publishing just needs quite a long time usually about 1 sec. You can`t really make it faster.

The only tips i can give you is execute this on a linux maschine and clear the internal object cache after every 100 contentobjects

Else it looks like you are working with existing objects and you try to just change some values

in this case you can:

- skip creating a new version, just use fetch(), setAtrribute() and store()

you basicly keep the current version

Oliver Frommel

Wednesday 05 September 2007 6:04:54 am

That is good to know. I was unsure about the correct handling of versions, storing, publishing
and so on (and on languages, but that's another story :). There's not very much documentation out there, so you have to figure out a lot based on cli scripts floating around (which aren't necessarily correct, too)

Thanks for the hint.
Oliver

Kristof Coomans

Thursday 06 September 2007 1:55:27 am

Hi Oliver

Enabling delayed indexing can speed it up a bit as well.

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

Damien Pobel

Thursday 06 September 2007 8:13:19 am

Hi Oliver,

you can also replace this part :

foreach( $version->contentObjectAttributes() as $attr )
{
    $attr_datatype = $attr->attribute( 'data_type_string' );
    $attr_id = $attr->attribute('contentclass_attribute_identifier');
    if ($attr_id == 'date_publish') {
        $date = strftime("%d.%b %Y", $newtime);
        print "setting date of ".$article->attribute('name')." to ".$date."\n";
        $attr->fromString($newtime);
        $attr->store();
    }
}

by something like this :

$dataMap = $version->dataMap();
if ( array_key_exists( 'date_publish', $dataMap ) )
{
    $date = strftime("%d.%b %Y", $newtime);
    print "setting date of ".$article->attribute('name')." to ".$date."\n";
    $dataMap['date_publish']->fromString( $newtime );
    $dataMap['date_publish']->store();
}

It avoids looping on content attributes whereas you know its identifier...

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish