diff --git a/.travis.yml b/.travis.yml index 1f578ec..e72a556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_script: - phpenv rehash - phpenv config-rm xdebug.ini - composer validate - - composer require --dev --no-update silverstripe/recipe-cms:1.0.x-dev + - composer require --dev --no-update silverstripe/recipe-cms:1.0.0 - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile script: diff --git a/src/Multisites.php b/src/Multisites.php index b2ff98f..05c13a7 100644 --- a/src/Multisites.php +++ b/src/Multisites.php @@ -41,6 +41,12 @@ class Multisites * @var Array - A list of features to be used on a given Site, identified by developer_identifiers */ private static $site_features; + + /** + * + * @var boolean + */ + private static $allow_site_session_fallback = true; /** * @@ -183,6 +189,13 @@ public function getDefaultSite() */ public function getCurrentSiteId() { + if (self::$allow_site_session_fallback) { + $controller = Controller::has_curr() ? Controller::curr() : null; + $req = $controller ? $controller->getRequest() : null; + if ($id = $req->getSession()->get('Multisites_ActiveSite')) { + return $id; + } + } // Re-parse the protocol and host to ensure it's in a consistent // format.