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.