mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX Consistently resetting Subsite::$disable_subsite_filter to its original state
This commit is contained in:
parent
1d1811b308
commit
552a6e784d
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user