1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-07 08:34:04 +00:00
tenancy/assets
lukinovec 984911946a
Change tenant storage listeners into jobs (#1446)
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>
2026-04-22 16:45:54 +02:00
..
impersonation-migrations Add remember column to to the impersonation token (#1101) 2023-04-13 02:05:26 +02:00
migrations Postgres RLS + permission controlled database managers (#33) 2024-04-24 22:32:49 +02:00
resource-syncing-migrations Use polymorphic table for mapping resources to tenants (#997) 2023-02-02 06:39:35 +01:00
config.php config: ignore port in default central_domains value 2025-11-11 02:06:13 +01:00
routes.php Refactor early identification (#47) 2024-04-22 11:30:58 +02:00
TenancyServiceProvider.stub.php Change tenant storage listeners into jobs (#1446) 2026-04-22 16:45:54 +02:00
tenant_routes.stub.php add line end to sample route response 2024-07-09 00:15:37 +02:00