From 6bd584ea8ce5da0c02559f08697c98dda6d48dc7 Mon Sep 17 00:00:00 2001 From: Vinnie Date: Mon, 21 Sep 2020 15:34:58 +1200 Subject: [PATCH 1/4] Allow for session lookup for active site --- src/Multisites.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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. From 89ef931e8439c93a4fa62f38ef34560048b683c7 Mon Sep 17 00:00:00 2001 From: Vinnie Date: Mon, 21 Sep 2020 15:51:53 +1200 Subject: [PATCH 2/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1f578ec..b31fb7c 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:4.x-dev - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile script: From 6684f04c410f5ed01915fe10e8defee89223dc40 Mon Sep 17 00:00:00 2001 From: Vinnie Date: Mon, 21 Sep 2020 15:54:28 +1200 Subject: [PATCH 3/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b31fb7c..98f3e94 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:4.x-dev + - composer require --dev --no-update silverstripe/recipe-cms:1.0.0-dev - composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile script: From 5dfa5cf3d7771173e32c619bdf6819c3a0626a79 Mon Sep 17 00:00:00 2001 From: Vinnie Date: Mon, 21 Sep 2020 15:57:13 +1200 Subject: [PATCH 4/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98f3e94..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.0-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: