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:
Ingo Schommer 2010-09-22 01:43:57 +00:00
parent a178d7c4c3
commit 59c3dd1ea2
2 changed files with 5 additions and 4 deletions

View File

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

View File

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