mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 23:44:03 +00:00
The `CreateTenantStorage` and `DeleteTenantStorage` listeners were used alongside JobPipelines. When the `TenantCreated` JobPipeline had `shouldBeQueued(true)` and the `Listeners\CreateTenantStorage` was uncommented, the listener would throw an exception (`Stancl\Tenancy\Database\Exceptions\TenantDatabaseDoesNotExistException Database tenantX.sqlite does not exist.`) because at the time of executing the listener, the tenant DB wasn't created yet. The same issue could likely also occur in the `DeleteTenantStorage` listener as it uses `tenancy()->run()` to resolve the tenant's storage path which wouldn't work if the tenant's database (or other resources) was already deleted, making initialization impossible. This PR changes `DeleteTenantStorage` into a job and puts it (commented) into the job pipeline, so that it can be queued with the rest of the jobs. It also removes `CreateTenantStorage` because it should be redundant with the FilesystemTenancyBootstrapper creating the same paths automatically when storage path is suffixed. The old classes are kept but deprecated for backwards compatibility. We've also added some edge case hardening to `DeleteTenantStorage` to make sure it never deletes the central storage path directory, which previously could in theory occur due to a misconfiguration if a user enabled this job/listener but disabled storage path suffixing. Co-authored-by: Samuel Štancl <samuel@archte.ch> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| BootstrapperTest.php | ||
| BroadcastChannelPrefixBootstrapperTest.php | ||
| BroadcastingConfigBootstrapperTest.php | ||
| CacheTagsBootstrapperTest.php | ||
| CacheTenancyBootstrapperTest.php | ||
| DatabaseSessionBootstrapperTest.php | ||
| DatabaseTenancyBootstrapper.php | ||
| FilesystemTenancyBootstrapperTest.php | ||
| FortifyRouteBootstrapperTest.php | ||
| MailConfigBootstrapper.php | ||
| RootUrlBootstrapperTest.php | ||
| UrlGeneratorBootstrapperTest.php | ||