Forums / Developer / cli script slow

cli script slow

Author Message

Oliver Frommel

Wednesday 05 September 2007 1:11:43 am

Björn Dieding@xrow.de

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

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

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

eZ debug

Timing: Jan 18 2025 11:44:32
Script start
Timing: Jan 18 2025 11:44:32
Module start 'content'
Warning: PHP: E_WARNING Jan 18 2025 11:44:33
DOMDocument::loadXML(): Opening and ending tag mismatch: literal line 2 and paragraph in Entity, line: 96 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Warning: PHP: E_WARNING Jan 18 2025 11:44:33
DOMDocument::loadXML(): Opening and ending tag mismatch: paragraph line 2 and section in Entity, line: 96 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Timing: Jan 18 2025 11:44:33
Module end 'content'
Timing: Jan 18 2025 11:44:33
Script end

Main resources:

Total runtime1.2551 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.3594180.8516
Module start 'content' 0.00541.0306 770.2109660.1484
Module end 'content' 1.03600.2189 1,430.3594337.2891
Script end 1.2550  1,767.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.3282210.0002
Check MTime0.00150.1207210.0001
Mysql Total
Database connection0.00080.063410.0008
Mysqli_queries1.176893.76622040.0058
Looping result0.00270.21422020.0000
Template Total1.228097.820.6140
Template load0.00180.143320.0009
Template processing1.226297.699820.6131
Template load and register function0.00030.020910.0003
states
state_id_array0.00080.060010.0008
state_identifier_array0.00110.083920.0005
Override
Cache load0.00160.1247290.0001
Sytem overhead
Fetch class attribute can translate value0.00140.109650.0003
Fetch class attribute name0.00120.098880.0002
XML
Image XML parsing0.00180.143450.0004
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00190.1537390.0000
String conversion0.00000.000530.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs