From 838ac9717719083d3718d804fe6c8c16355ef331 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Mon, 9 Jul 2012 13:24:00 +1200 Subject: [PATCH] BUGFIX: fixing an edge-case bug where a 404-page would get statically published and overwrite the homepage of the site (this would sometimes happen when a RedirectorPage was set to an external URL and still referenced an internal page ID) --- code/staticpublisher/FilesystemPublisher.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/staticpublisher/FilesystemPublisher.php b/code/staticpublisher/FilesystemPublisher.php index 68a17705..eb850cef 100644 --- a/code/staticpublisher/FilesystemPublisher.php +++ b/code/staticpublisher/FilesystemPublisher.php @@ -186,11 +186,12 @@ class FilesystemPublisher extends StaticPublisher { $response = Director::test(str_replace('+', ' ', $url)); Requirements::clear(); - - - + singleton('DataObject')->flushCache(); + //skip any responses with a 404 status code. We don't want to turn those into statically cached pages + if (!$response || $response->getStatusCode() == '404') continue; + // Generate file content // PHP file caching will generate a simple script from a template if($this->fileExtension == 'php') {