mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:34:04 +00:00
Merge pull request #1412 from archtechx/push-xwrxrozxnsks
[4.x] Config: scope_sessions = true only with supported drivers, always throw
This commit is contained in:
commit
8bdacf566b
2 changed files with 2 additions and 9 deletions
|
|
@ -313,7 +313,7 @@ return [
|
|||
*
|
||||
* Note: This will implicitly add your configured session store to the list of prefixed stores above.
|
||||
*/
|
||||
'scope_sessions' => true,
|
||||
'scope_sessions' => in_array(env('SESSION_DRIVER'), ['redis', 'memcached', 'dynamodb', 'apc'], true),
|
||||
|
||||
'tag_base' => 'tenant', // This tag_base, followed by the tenant_id, will form a tag that will be applied on each cache call.
|
||||
],
|
||||
|
|
|
|||
|
|
@ -102,14 +102,7 @@ class CacheTenancyBootstrapper implements TenancyBootstrapper
|
|||
if ($this->config->get('tenancy.cache.scope_sessions', true)) {
|
||||
// These are the only cache driven session backends (see Laravel's config/session.php)
|
||||
if (! in_array($this->config->get('session.driver'), ['redis', 'memcached', 'dynamodb', 'apc'], true)) {
|
||||
if (app()->environment('production')) {
|
||||
// We only throw this exception in prod to make configuration a little easier. Developers
|
||||
// may have scope_sessions set to true while using different session drivers e.g. in tests.
|
||||
// Previously we just silently ignored this, however since session scoping is of high importance
|
||||
// in production, we make sure to notify the developer, by throwing an exception, that session
|
||||
// scoping isn't happening as expected/configured due to an incompatible session driver.
|
||||
throw new Exception('Session driver [' . $this->config->get('session.driver') . '] cannot be scoped by tenancy.cache.scope_sessions');
|
||||
}
|
||||
throw new Exception('Session driver [' . $this->config->get('session.driver') . '] cannot be scoped by tenancy.cache.scope_sessions');
|
||||
} else {
|
||||
// Scoping sessions using this bootstrapper implicitly adds the session store to $names
|
||||
$names[] = $this->getSessionCacheStoreName();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue