1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 17:14:03 +00:00

Filesystem adapter updated

This commit is contained in:
George 2022-02-12 13:58:15 +01:00
parent cf7d6eebb6
commit 8445e3ebb8
2 changed files with 11 additions and 14 deletions

View file

@ -25,6 +25,7 @@ services:
stdin_open: true
tty: true
mysql:
platform: linux/x86_64
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: password
@ -36,6 +37,7 @@ services:
timeout: 10s
retries: 10
mysql2:
platform: linux/x86_64
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: password
@ -47,6 +49,7 @@ services:
timeout: 10s
retries: 10
postgres:
platform: linux/x86_64
image: postgres:11
environment:
POSTGRES_PASSWORD: password

View file

@ -54,23 +54,20 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
}
// Storage facade
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
/** @var FilesystemAdapter $filesystemDisk */
$filesystemDisk = Storage::disk($disk);
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
$this->originalPaths['disks'][$disk] = $root;
if ($root = str_replace(
if (!$root = str_replace(
'%storage_path%',
storage_path(),
$this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? ''
)) {
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root);
} else {
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root . "/{$suffix}");
$root .= '/' . $suffix;
}
$this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix;
$this->app['config']["filesystems.disks.{$disk}.root"] = $root;
}
}
@ -84,13 +81,10 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
$this->app['url']->setAssetRoot($this->app['config']['app.asset_url']);
// Storage facade
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
/** @var FilesystemAdapter $filesystemDisk */
$filesystemDisk = Storage::disk($disk);
$root = $this->originalPaths['disks'][$disk];
$filesystemDisk->getAdapter()->setPathPrefix($root);
$this->app['config']["filesystems.disks.{$disk}.root"] = $root;
}
}