mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX Fixes wrong logic for session existence checks in ErrorPageSubsite and SubsitesVirtualPage (no current controller is available when called through "phpunit" executable)
This commit is contained in:
parent
a178d7c4c3
commit
59c3dd1ea2
@ -13,10 +13,11 @@ class ErrorPageSubsite extends DataObjectDecorator {
|
||||
$static_filepath = Object::get_static($this->owner->ClassName, 'static_filepath');
|
||||
$subdomainPart = "";
|
||||
|
||||
// when there's a controller get it subsite from session
|
||||
if (Controller::has_curr()) $subsite = Subsite::currentSubsite(false);
|
||||
// Try to get current subsite from session
|
||||
$subsite = Subsite::currentSubsite(false);
|
||||
|
||||
// since this function is called from Page class before the controller is created, we have to get subsite from domain instead
|
||||
else {
|
||||
if(!$subsite) {
|
||||
$subsiteID = Subsite::getSubsiteIDForDomain();
|
||||
if($subsiteID != 0) $subsite = DataObject::get_by_id("Subsite", $subsiteID);
|
||||
else $subsite = null;
|
||||
|
@ -37,7 +37,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
||||
|
||||
$pageSelectionField->setFilterFunction(create_function('$item', 'return !($item instanceof VirtualPage);'));
|
||||
|
||||
if(Controller::curr()->getRequest()) {
|
||||
if(Controller::has_curr() && Controller::curr()->getRequest()) {
|
||||
$subsiteID = Controller::curr()->getRequest()->getVar('CopyContentFromID_SubsiteID');
|
||||
$pageSelectionField->setSubsiteID($subsiteID);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user