From 552a6e784daa49e743727134552f2ed8b8c5e726 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Sep 2011 12:18:56 +0200 Subject: [PATCH] BUGFIX Consistently resetting Subsite::$disable_subsite_filter to its original state --- code/SiteTreeSubsites.php | 5 +++-- code/SubsitesVirtualPage.php | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index bd4451d..039aee9 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -335,10 +335,11 @@ class SiteTreeSubsites extends SiteTreeDecorator { $subsiteID = Subsite::getSubsiteIDForDomain($domain); if($subsiteID == 0) continue; // We have no idea what the domain for the main site is, so cant track links to it - + + $origDisableSubsiteFilter = Subsite::$disable_subsite_filter; Subsite::disable_subsite_filter(true); $candidatePage = DataObject::get_one("SiteTree", "\"URLSegment\" = '" . urldecode( $rest). "' AND \"SubsiteID\" = " . $subsiteID, false); - Subsite::disable_subsite_filter(false); + Subsite::disable_subsite_filter($origDisableSubsiteFilter); if($candidatePage) { $linkedPages[] = $candidatePage->ID; diff --git a/code/SubsitesVirtualPage.php b/code/SubsitesVirtualPage.php index 639af36..6b15dca 100644 --- a/code/SubsitesVirtualPage.php +++ b/code/SubsitesVirtualPage.php @@ -123,13 +123,14 @@ class SubsitesVirtualPage extends VirtualPage { } } + $origDisableSubsiteFilter = Subsite::$disable_subsite_filter; Subsite::$disable_subsite_filter = true; $existingPage = DataObject::get_one( 'SiteTree', "\"URLSegment\" = '$this->URLSegment' $IDFilter $parentFilter", false // disable cache, it doesn't include subsite status in the key ); - Subsite::$disable_subsite_filter = false; + Subsite::$disable_subsite_filter = $origDisableSubsiteFilter; $existingPageInSubsite = DataObject::get_one( 'SiteTree', "\"URLSegment\" = '$this->URLSegment' $IDFilter $parentFilter", @@ -154,11 +155,12 @@ class SubsitesVirtualPage_Controller extends VirtualPage_Controller { } function init(){ + $origDisableSubsiteFilter = Subsite::$disable_subsite_filter; Subsite::$disable_subsite_filter = true; parent::init(); - Subsite::$disable_subsite_filter = false; + Subsite::$disable_subsite_filter = $origDisableSubsiteFilter; } } ?>