Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Static publishing fix24 #157

Merged
merged 1 commit into from

2 participants

@candidasa

...blished 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)

@candidasa candidasa 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)
838ac97
@chillu
Owner

Important enough to get into 2.4 as a bugfix, since it can trigger an overwrite of a statically cached homepage with a 404 page.

Julian: Strictly speaking, it should check for anything >= 400 though, right? 404 is definitely the most common one, but not the only one. See SS_HTTPResponse->isError()

@chillu chillu merged commit 3fff44a into silverstripe:2.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 9, 2012
  1. @candidasa

    BUGFIX: fixing an edge-case bug where a 404-page would get statically…

    candidasa authored
    … 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)
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 code/staticpublisher/FilesystemPublisher.php
View
7 code/staticpublisher/FilesystemPublisher.php
@@ -186,11 +186,12 @@ function publishPages($urls) {
$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') {
Something went wrong with that request. Please try again.