Changing siteaccess during script execution

Author Message

Jérôme Vieilledent

Tuesday 27 April 2010 5:17:55 am

Hi all

I'd like to know if it was possible to switch from one siteaccess to another in a script (or cronjob) ?

Thanks :)

Philippe VINCENT-ROYOL

Tuesday 27 April 2010 5:25:46 am

Try to use eZScript::setUseScriptAccess

http://pubsvn.ez.no/doxygen/4.2/html/classeZScript.html#a8e1752784523828149496dd029079c4b

Phil

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe

Matthieu Sévère

Tuesday 27 April 2010 5:29:59 am

Yes but this has to be executed before $script->initialize(); thus you will not be able use it during the execution of a cronjob for exemple or a script launched with ezexec.php

--
eZ certified developer: http://ez.no/certification/verify/346216

Jérôme Vieilledent

Tuesday 27 April 2010 5:31:55 am

Indeed, what I need to do is several tasks for every siteaccesses present in my conf. So unfortunately I won't be able to use this trick :(

Philippe VINCENT-ROYOL

Tuesday 27 April 2010 5:40:41 am

hum during script execution, is it not possible to do something like that :

require_once( "access.php" );

$script->SiteAccess = "mySiteAccess";

$access = array( 'name' => 'mySiteAcess', type' => EZ_ACCESS_TYPE_STATIC );

$access = changeAccess( $access );

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe

Jérôme Vieilledent

Wednesday 19 May 2010 1:56:56 am

Hi Philippe

Thanks for your reply. Indeed, it should work as this is the same code used in eZScript::initialize().

Thanks for your help !

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

Main resources:

Total runtime0.8020 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.0052 589.1641152.6406
Module start 'layout' 0.00520.0027 741.804739.4766
Module start 'content' 0.00790.7927 781.2813627.5859
Module end 'content' 0.80060.0013 1,408.867216.1250
Script end 0.8019  1,424.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4074160.0002
Check MTime0.00130.1578160.0001
Mysql Total
Database connection0.00070.092110.0007
Mysqli_queries0.728790.8682680.0107
Looping result0.00070.0880660.0000
Template Total0.773096.420.3865
Template load0.00220.274320.0011
Template processing0.770896.109220.3854
Template load and register function0.00010.010610.0001
states
state_id_array0.00130.155910.0013
state_identifier_array0.00180.219320.0009
Override
Cache load0.00170.2159300.0001
Sytem overhead
Fetch class attribute can translate value0.00050.062730.0002
Fetch class attribute name0.00110.139890.0001
XML
Image XML parsing0.00160.195730.0005
class_abstraction
Instantiating content class attribute0.00000.0037120.0000
General
dbfile0.00130.1654300.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
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs