mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 00:34:03 +00:00
Filesystem logic refactor, improved defaults for cache tenancy (#42)
* refactor FilesystemTenancyBootstrapper * clean up tests and improve coverage * minor maintenance mode changes * Improve tenants:migrate --skip-failing logic * make tenants:migrate output consistently formatted * minor RootUrlBootstrapper + misc changes * cache bootstrapper-related improvements * Fix code style (php-cs-fixer) * misc refactor * Fix code style (php-cs-fixer) * add %original_storage_path% to fs bootstrapper, improve default config for cache * rename method * inject concrete implementations where needed instead of abstracts * Fix code style (php-cs-fixer) * refactor DealsWithTenantSymlinks * remove obsolete phpstan ignore --------- Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
parent
4b6fa22aa7
commit
a41ad69023
23 changed files with 234 additions and 160 deletions
|
|
@ -17,10 +17,10 @@ use Stancl\Tenancy\Contracts\Tenant;
|
|||
*/
|
||||
class CacheTenancyBootstrapper implements TenancyBootstrapper
|
||||
{
|
||||
protected string|null $originalPrefix = null;
|
||||
public static array $tenantCacheStores = []; // E.g. ['redis']
|
||||
public static Closure|null $prefixGenerator = null;
|
||||
|
||||
protected string|null $originalPrefix = null;
|
||||
|
||||
public function __construct(
|
||||
protected ConfigRepository $config,
|
||||
protected CacheManager $cacheManager,
|
||||
|
|
@ -33,7 +33,7 @@ class CacheTenancyBootstrapper implements TenancyBootstrapper
|
|||
|
||||
$prefix = $this->generatePrefix($tenant);
|
||||
|
||||
foreach (static::$tenantCacheStores as $store) {
|
||||
foreach ($this->config->get('tenancy.cache.stores') as $store) {
|
||||
$this->setCachePrefix($store, $prefix);
|
||||
|
||||
// Now that the store uses the passed prefix
|
||||
|
|
@ -44,7 +44,7 @@ class CacheTenancyBootstrapper implements TenancyBootstrapper
|
|||
|
||||
public function revert(): void
|
||||
{
|
||||
foreach (static::$tenantCacheStores as $store) {
|
||||
foreach ($this->config->get('tenancy.cache.stores') as $store) {
|
||||
$this->setCachePrefix($store, $this->originalPrefix);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue