eZ Community » Forums » Developer » How to proper end ezpublish?
expandshrink

How to proper end ezpublish?

How to proper end ezpublish?

Thursday 07 July 2011 3:59:55 pm - 5 replies

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?

Thursday 07 July 2011 5:16:05 pm

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

Thursday 07 July 2011 6:26:20 pm

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?

Thursday 07 July 2011 7:44:35 pm

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...

Thursday 07 July 2011 7:52:22 pm

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!!

Friday 08 July 2011 5:46:03 pm

yep as stated

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

Modified on Monday 11 July 2011 5:34:20 pm by Hamdi Laadhari

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from