BUGFIX: A page type with requireDefaultRecords(), for instance ErrorPage, was created everytime on the main site when dev/build-ing (with subdomain in the url) and there's no that page type in the subsite's sitetree.

This commit is contained in:
Saophalkun Ponlu 2009-10-05 01:55:55 +00:00
parent 221599c776
commit 0b3b4b555c

View File

@ -86,7 +86,10 @@ class SiteTreeSubsites extends DataObjectDecorator {
protected $nextWriteDoesntCustomise = false;
function augmentBeforeWrite() {
if(!is_numeric($this->owner->ID) && !$this->owner->SubsiteID) $this->owner->SubsiteID = Subsite::currentSubsiteID();
// if the page hasn't been written to a database table yet and no subsite has been set, then give it a subsite
if((!is_numeric($this->owner->ID) || $this->owner->ID == 0) && !$this->owner->SubsiteID) {
$this->owner->SubsiteID = Subsite::currentSubsiteID();
}
// If the content has been changed, then the page should be marked as 'custom content'
if(!$this->nextWriteDoesntCustomise && $this->owner->ID && $this->owner->MasterPageID && !$this->owner->CustomContent) {