BUGFIX Consistently resetting Subsite::$disable_subsite_filter to its original state

This commit is contained in:
Ingo Schommer 2011-09-12 12:18:56 +02:00
parent 1d1811b308
commit 552a6e784d
2 changed files with 7 additions and 4 deletions

View File

@ -336,9 +336,10 @@ 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;

View File

@ -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;
}
}
?>