-
Notifications
You must be signed in to change notification settings - Fork 241
Refactor SwitchTenant task #8623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e9ba76d
82d1d47
060c1b0
d75aab5
3902518
a64fbed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php | ||
|
|
||
| namespace ProcessMaker\Multitenancy; | ||
|
|
||
| use Spatie\Multitenancy\Contracts\IsTenant; | ||
| use Spatie\Multitenancy\Tasks\PrefixCacheTask as SpatiePrefixCacheTask; | ||
|
|
||
| class PrefixCacheTask extends SpatiePrefixCacheTask | ||
| { | ||
| private $originalSettingsPrefix; | ||
|
|
||
| public function makeCurrent(IsTenant $tenant): void | ||
| { | ||
| $cachePrefix = 'tenant_' . $tenant->getKey() . ':'; | ||
| $this->setCachePrefix($cachePrefix); | ||
|
|
||
| $this->originalSettingsPrefix = config('cache.stores.cache_settings.prefix'); | ||
| $tenantSettingsPrefix = 'tenant_' . $tenant->getKey() . ':' . $this->originalSettingsPrefix; | ||
| config()->set('cache.stores.cache_settings.prefix', $tenantSettingsPrefix); | ||
| $this->storeName = 'cache_settings'; | ||
| $this->setCachePrefix($cachePrefix); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Wrong prefix passed to setCachePrefix for settings storeIn Additional Locations (1) |
||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Parent's
|
||
|
|
||
| public function forgetCurrent(): void | ||
| { | ||
| $this->setCachePrefix($this->originalPrefix); | ||
|
|
||
| config()->set('cache.stores.cache_settings.prefix', $this->originalSettingsPrefix); | ||
| $this->storeName = 'cache_settings'; | ||
| $this->setCachePrefix($this->originalPrefix); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Default cache store prefix never restored when forgetting tenantIn |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Debug logging to warning level left in diagnostic command
The command now writes
\Log::warning()entries for informational output that was previously only displayed via$this->info()and$this->table(). Line 52 replaces console info output with a warning-level log entry, and line 173 adds warning-level logging for every row in the table output. Using warning-level logging for routine informational output in a diagnostic command will create unnecessary noise in production logs every timetenants:verifyruns.Additional Locations (1)
ProcessMaker/Console/Commands/TenantsVerify.php#L172-L173