BUGFIX Re-enabling theme in ErrorPage->doPublish() (it's usually disabled in the publication context through LeftAndMain->init())

MINOR Reverted r88633, it breaks <base> tag in static HTML for ErrorPage->doPublish() (from r106777)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112537 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 03:04:10 +00:00
parent a1f9efc414
commit 35a3d79e87

View File

@ -122,12 +122,16 @@ class ErrorPage extends Page {
function doPublish() {
parent::doPublish();
// Run the page
// Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
$oldTheme = SSViewer::current_theme();
SSViewer::set_theme(SSViewer::current_custom_theme());
$response = Director::test(Director::makeRelative($this->Link()));
SSViewer::set_theme($oldTheme);
$errorContent = $response->getBody();
// Make the base tag dynamic.
$errorContent = preg_replace('/<base[^>]+href="' . str_replace('/','\\/', Director::absoluteBaseURL()) . '"[^>]*>/i', '<base href="$BaseURL" />', $errorContent);
// $errorContent = preg_replace('/<base[^>]+href="' . str_replace('/','\\/', Director::absoluteBaseURL()) . '"[^>]*>/i', '<base href="$BaseURL" />', $errorContent);
// Check we have an assets base directory, creating if it we don't
if(!file_exists(ASSETS_PATH)) {