How to proper end ezpublish?

Author Message

Georg Franz

Thursday 07 July 2011 6:59:55 am

Hi,

I've a content class with a text field. If this text field is filled, I need a 301 redirection to the given value.

So I wrote a template operator which should redirect to this page.

Within the template operator I am doing this:

$url = $namedParameters['url'];
                if ( strlen( $url ) > 0 )
                {
                    eZHTTPTool::redirect( $url, array(), 301 );
                    eZDB::checkTransactionCounter();
                    eZExecution::cleanExit();
                }

But I am running into troubles at a cluster environment because the cache generation is not terminated properly.

So, my question: Is there another - better way - to end the execution? Have I missed something? Or is it a bug?

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Hamdi Laadhari

Thursday 07 July 2011 8:16:05 am

try setting your url into a persistent_variable and use you template operator into your pagelayout with it

Certified eZ Publish Entreprise 4.5
http://www.laadhari.fr

Georg Franz

Thursday 07 July 2011 9:26:20 am

Hi Hamadi,

the problem isn't that the redirection is not working but the cache generation is not proper terminated.

So in the cluster db (ezdfsfile), there is an entry of a cache file which doesn't exist. Apache is trying to get this file, but don't, sleeps one second and tries again. The apache process isn't terminated.

So, my question is: how to terminate ezpublish (after the redirection) in a proper way?

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Gaetano Giunta

Thursday 07 July 2011 10:44:35 am

Georg, the problem happens because after sending the redirect header your http code exits, without giving eZP's cluster code a chance to finalize its cache file creation / cleanup.

If you do as Hamdi said, the node template will end correctly its execution, having a small file generated in the cache with only the definition of the persistent var in it. Then the pagelayout will do the header() call and terminate cleanly eZP execution. In short: it will work.

2nd thing: you're not running the latest version of eZ, are you? This misbehaviour of the caching layer has been fixed in enterprise patchsets and also in the latest community versions...

Principal Consultant International Business
Member of the Community Project Board

Georg Franz

Thursday 07 July 2011 10:52:22 am

Hi Gaetano,

thanx for your answer! Yes, it's an old 4.2 installation, but we are upgrading to 4.5 enterprise in the next weeks.

I will try to call the redirect in the pagelayout, thanks for the tip @ Hamdi + Gaetano!!

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Hamdi Laadhari

Friday 08 July 2011 8:46:03 am

yep as stated

pagelayout (never cached) is rendered after your content view cache (the module_result.content thing ).

Certified eZ Publish Entreprise 4.5
http://www.laadhari.fr

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

Main resources:

Total runtime0.7546 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.0313152.6250
Module start 'layout' 0.00520.0031 741.656339.4531
Module start 'content' 0.00840.7447 781.1094612.0313
Module end 'content' 0.75310.0015 1,393.140616.1641
Script end 0.7546  1,409.3047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4489160.0002
Check MTime0.00140.1813160.0001
Mysql Total
Database connection0.00060.079210.0006
Mysqli_queries0.683890.6208680.0101
Looping result0.00070.0932660.0000
Template Total0.727696.420.3638
Template load0.00230.299420.0011
Template processing0.725496.125820.3627
Template load and register function0.00010.017610.0001
states
state_id_array0.00030.037610.0003
state_identifier_array0.00090.118620.0004
Override
Cache load0.00200.2616380.0001
Sytem overhead
Fetch class attribute can translate value0.00060.078830.0002
Fetch class attribute name0.00130.178580.0002
XML
Image XML parsing0.00090.124830.0003
class_abstraction
Instantiating content class attribute0.00000.0029100.0000
General
dbfile0.00090.1156220.0000
String conversion0.00000.001440.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
4content/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
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 6

Time used to render debug report: 0.0001 secs