From ce3581c51d705c457e576f9caae75fd237655802 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 1 Mar 2010 22:28:50 +0000 Subject: [PATCH] BUGFIX: If the site config for a subsite is missing, create it. (from r90262) (from r96327) --- code/SiteTreeSubsites.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index 0166353..c9d649f 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -227,7 +227,15 @@ class SiteTreeSubsites extends SiteTreeDecorator { } function alternateSiteConfig() { - return DataObject::get_one('SiteConfig', 'SubsiteID = ' . $this->owner->SubsiteID); + $sc = DataObject::get_one('SiteConfig', 'SubsiteID = ' . $this->owner->SubsiteID); + if(!$sc) { + $sc = new SiteConfig(); + $sc->SubsiteID = $this->owner->SubsiteID; + $sc->Title = 'Your Site Name'; + $sc->Tagline = 'your tagline here'; + $sc->write(); + } + return $sc; } /**