Author Topic

Marko Žmak

Thursday 06 January 2011 12:48:38 pm

Comment64857

OK, after further investigation I came to this conclusions...

The solution Bertrand suggested should be extended to disable other caching mechanisms, so it should be like this:

eZINI::instance()->setVariable( 'ContentSettings', 'ViewCaching', 'disabled' );
eZINI::instance()->setVariable( 'ContentSettings', 'StaticCache', 'disabled' );
eZINI::instance()->setVariable( 'ContentSettings', 'PreViewCache', 'disabled' );

The solution gilles suggested can be enhanced a little bit by finding the array value to unset via its name. When set this way works even better that disabling the cache via ini settings.

So I made a better function:

function disableModuleOperation( $moduleName, $operationName, $operationPartName )
{
        if( !isset( $GLOBALS['eZGlobalModuleOperationList'][$moduleName] ) )
        {
                $moduleOperationInfo = new eZModuleOperationInfo( $moduleName, false );
                $moduleOperationInfo->loadDefinition();

                $GLOBALS['eZGlobalModuleOperationList'][$moduleName] = $moduleOperationInfo;
        }

        if (!isset($GLOBALS['eZGlobalModuleOperationList'][$moduleName]->OperationList[$operationName]))
                return;

        $index = -1;

        foreach ($GLOBALS['eZGlobalModuleOperationList'][$moduleName]->OperationList[$operationName]['body'] as $key => $operationPart)
        {
                if ($operationPart['name'] == $operationPartName)
                {
                        $index = $key;
                        break;
                }
        }

        if ($index >= 0)
                unset( $GLOBALS['eZGlobalModuleOperationList'][$moduleName]->OperationList[$operationName]['body'][$index] );
}

which would then be used like this:

disableModuleOperation('content', 'publish', 'clear-object-view-cache');

This is a more safer way to unset a part of the module operation because it relies on the name of the part which is less likely to change than the index.

I also found that there are several other parts that can be excluded when importing objects in a script:

  • pre_publish - if you don't want pre publish triggers to be executed
  • post_publish - if you don't want post publish triggers to be executedh
  • generate-object-view-cache - no preview cache generation
  • create-notification - if you don't want to generate notifications for the imported objects
  • register-search-object - to disable the search indexing (the reindexing can be done after the import)

Furthermore, I found that disabling "register-search-object" gives you the biggest speedup, especially if you're using ezfind. In my case the import went 100 times faster (without exaggeration). And you can always do the complete reindexing after the import.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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 02:07:47
Script start
Timing: Jan 18 2025 02:07:47
Module start 'layout'
Timing: Jan 18 2025 02:07:47
Module start 'content'
Timing: Jan 18 2025 02:07:47
Module end 'content'
Timing: Jan 18 2025 02:07:47
Script end

Main resources:

Total runtime0.0681 sec
Peak memory usage4,096.0000 KB
Database Queries30

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 589.3281152.6563
Module start 'layout' 0.00570.0038 741.984439.5156
Module start 'content' 0.00950.0572 781.5000435.9922
Module end 'content' 0.06670.0014 1,217.49228.7656
Script end 0.0681  1,226.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00365.3010160.0002
Check MTime0.00142.1101160.0001
Mysql Total
Database connection0.00131.877410.0013
Mysqli_queries0.030344.4866300.0010
Looping result0.00020.3636280.0000
Template Total0.035051.420.0175
Template load0.00243.586420.0012
Template processing0.032647.820920.0163
Template load and register function0.00010.167310.0001
states
state_id_array0.00152.244510.0015
state_identifier_array0.00081.228520.0004
Override
Cache load0.00192.8339260.0001
Sytem overhead
Fetch class attribute can translate value0.00111.614910.0011
Fetch class attribute name0.00111.591420.0005
XML
Image XML parsing0.00071.032110.0007
class_abstraction
Instantiating content class attribute0.00000.007720.0000
General
dbfile0.00091.2617180.0000
String conversion0.00000.011540.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_reply.tplextension/sevenx/design/simple/override/templates/full/forum_reply.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
5content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs