Improved the encapsulation of ErrorPage publication

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40229 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-08-16 06:35:02 +00:00
parent 0c977bf6f7
commit 35a87e84b3

View File

@ -73,6 +73,8 @@ class ErrorPage extends Page {
Session::clear("loggedInAs");
$alc_enc = isset($_COOKIE['alc_enc']) ? $_COOKIE['alc_enc'] : null;
Cookie::set('alc_enc', null);
$oldStage = Versioned::current_stage();
// Run the page
Requirements::clear();
@ -83,12 +85,13 @@ class ErrorPage extends Page {
fwrite($fh, $errorContent);
fclose($fh);
}
// Restore the version we're currently connected to.
Versioned::reading_stage($oldStage);
// Log back in
Session::set("loggedInAs", $loggedInMember->ID);
if(isset($alc_enc)) {
Cookie::set('alc_enc', $alc_enc);
}
if($loggedInMember) Session::set("loggedInAs", $loggedInMember->ID);
if(isset($alc_enc)) Cookie::set('alc_enc', $alc_enc);
return $this->extension_instances['Versioned']->publish($fromStage, $toStage, $createNewVersion);
}