mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 23:34:03 +00:00
[3.x] Compatibility with Laravel 9 (#802)
* Test on Laravel 9 * Don't extend final Kernel class * Make FilesystemTenancyBootstrapper compatible with Flysystem v3 Co-authored-by: George <jiri.zizka@funfirst.cz> * Update tenant maintenance mode te be in line with Laravel * Exclude PHP 7.4 <> L9 combination from testing * add root_override-related assertions * getPrefix -> getPathPrefix * handle / inconsistency in s3 prefix * Refactor Storage facade changes Co-authored-by: George <jiri.zizka@funfirst.cz> Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
b4a4eab949
commit
79e3d53b06
8 changed files with 74 additions and 55 deletions
|
|
@ -54,20 +54,20 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
}
|
||||
|
||||
// Storage facade
|
||||
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
|
||||
/** @var FilesystemAdapter $filesystemDisk */
|
||||
$filesystemDisk = Storage::disk($disk);
|
||||
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();
|
||||
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
|
||||
|
||||
if ($root = str_replace(
|
||||
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
|
||||
$originalRoot = $this->app['config']["filesystems.disks.{$disk}.root"];
|
||||
$this->originalPaths['disks'][$disk] = $originalRoot;
|
||||
|
||||
$finalPrefix = 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}");
|
||||
$this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? '',
|
||||
);
|
||||
|
||||
if (! $finalPrefix) {
|
||||
$finalPrefix = $originalRoot . '/'. $suffix;
|
||||
}
|
||||
|
||||
$this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix;
|
||||
|
|
@ -84,14 +84,9 @@ 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;
|
||||
$this->app['config']["filesystems.disks.{$disk}.root"] = $this->originalPaths['disks'][$disk];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue