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 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...
You must be logged in to post messages in this topic!