From 223b49a3959ddd08a464b27bbe7f893eead74fa0 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 19 Aug 2026 15:22:33 +0200 Subject: [PATCH] Correct FSBootstrapper and DeleteTenantStorage docblocks getBoundTenantStoragePath() and DeleteTenantStorage both claimed the tenant storage directory is where disks, cache and sessions are scoped to. That's only true when root_override points there and scope_cache/scope_sessions are enabled -- a root_override using %original_storage_path% puts the disk root outside it entirely. --- src/Bootstrappers/FilesystemTenancyBootstrapper.php | 4 ++-- src/Jobs/DeleteTenantStorage.php | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index a00c93c3..f2688e51 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -331,8 +331,8 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper /** * Get the storage path of the passed tenant (independent of the current context). * - * This is the directory the bootstrapper scopes disks, cache and sessions to, - * regardless of suffix_storage_path (that config option only affects the storage_path() helper). + * The returned path doesn't depend on suffix_storage_path -- that config option + * only controls whether storage_path() uses it. */ public static function getBoundTenantStoragePath(Tenant $tenant): string { diff --git a/src/Jobs/DeleteTenantStorage.php b/src/Jobs/DeleteTenantStorage.php index 825eaef2..0e8290e6 100644 --- a/src/Jobs/DeleteTenantStorage.php +++ b/src/Jobs/DeleteTenantStorage.php @@ -16,13 +16,16 @@ use Stancl\Tenancy\Contracts\Tenant; /** * Delete the tenant's storage directory. * - * Requires FilesystemTenancyBootstrapper to be enabled, since the deleted directory - * is the one the bootstrapper scopes disks, cache and sessions to. + * Requires FilesystemTenancyBootstrapper to be enabled, since the tenant storage path + * is resolved from it. * - * The job does not depend on the tenancy.filesystem.suffix_storage_path config, + * Files outside that directory (e.g. disks with an %original_storage_path%-based + * root_override) are not deleted. + * + * Note that this job is not affected by the tenancy.filesystem.suffix_storage_path config * since it doesn't use the storage_path() helper. * - * @see Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper + * @see FilesystemTenancyBootstrapper */ class DeleteTenantStorage implements ShouldQueue {