From 35a87e84b33eb1d5629c3b246a98ed0b74a99b0d Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 16 Aug 2007 06:35:02 +0000 Subject: [PATCH] Improved the encapsulation of ErrorPage publication git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40229 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/ErrorPage.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/model/ErrorPage.php b/core/model/ErrorPage.php index 3e117edca..ea2b34c71 100755 --- a/core/model/ErrorPage.php +++ b/core/model/ErrorPage.php @@ -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); }