1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 18:44:04 +00:00
Commit graph

12 commits

Author SHA1 Message Date
5bb76e1421
refactor
1. Remove the CreateTenantStorage job altogether since as the docblock
   says the class should be redundant now that
   FilesystemTenancyBootstrapper creates this path automatically when
   storage_path suffixing is enabled
2. Remove docblock on the DeleteTenantStorage job - a class's docblock
   should describe what it does, not how it handles edge cases. Here
   the former isn't even necessary and the latter is well explained by
   comments in the implementation.
3. Remove the CreateTenantStorage test following the class's removal,
   the test would pass on its own even without the job with just
   tenancy initialization as mentioned above.
4. Slightly improve the structure of the DeleteTenantStorage job and
   deprecated listener
5. Improve deprecation notices so they include full steps for upgrading
   to the new approach.
2026-04-20 18:25:04 +02:00
lukinovec
5e0153c507
Obtain suffix base from config instead of hardcoding
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-13 16:47:08 +02:00
lukinovec
33c28405ad Guard against accidental central storage deletion
Also fix and improve related test.
2026-04-13 16:36:52 +02:00
lukinovec
a28593af17 Correct storage deletion test 2026-04-13 16:24:12 +02:00
lukinovec
5b2cce347a Add test for CreateTenantStorage 2026-03-27 11:58:00 +01:00
lukinovec
bf42a12894 Change tenant storage listeners into jobs
Also move the commented jobs to the JobPipelines and update FilesystemTenancyBootstrapperTest accordingly.
2026-03-26 15:34:04 +01:00
Victor R
3c0e21b726
[4.x] Filesystem bootstrapper: scoped disk support (#1402)
Fixes #1401

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Samuel Stancl <samuel@archte.ch>
2025-12-16 23:17:11 +01:00
cab8ecebec
Create tenant storage directories in FilesystemTenancyBootstrapper (#1410)
This is because the CreateTenantStorage listener only runs when
a tenant is created, but in multi-server setups the directory may
need to be created each time a tenant is *used*, not just created.

Also changed the listeners to use TenantEvent instead of specific
events, to make it possible to use them with other events, such as
TenancyBootstrapped.

Also update permission bits in a few mkdir() calls to better scope
data to the current OS user.

Also fix a typo in CacheTenancyBootstrapper (exception message).
2025-11-04 21:16:39 +01:00
33e4a8e4e2 Remove and recategorize todos 2025-08-31 16:57:52 +02:00
8960a83047
[4.x] Laravel 12 support (#1321)
* Add Laravel 12 support, drop Laravel 11 support

* Fix RLS tree generation (specify schema name in generateTrees())

* ci fixes, use stable virtualcolumn version

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
2025-02-25 16:26:18 +01:00
lukinovec
6e67ddf7a5
Resolve test to-dos (#45)
* Only retrieve domains if the relationship and the domains table exist (DomianTenantResolver)

* Resolve todo, add other todos

* Use constructor promotion in DeleteDomains

* Fix imports + domain deletion test

* Confirm that turning on resolver caching doesn't break the tests

* Fix Tenant model imports

* Fix code style (php-cs-fixer)

* remove runtime schema check

* temp: enable resolver cache

* make 'autoincrement ids are supported' pass

* disable resolver cache

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-04-18 00:22:03 +02:00
Samuel Štancl
eecf6f21c8
Cache prefixing logic rewrite, session scoping improvements, tests refactor (#43)
* Run cache tests on all supported drivers

* update ci healthcheck for memcached

* remove memcached healthcheck

* fix typos in test comments, expand internal.md [ci skip]

* add empty line [ci skip]

* switch to using $store->setPrefix()

* add dynamodb

* refactor try-finally to try-catch

* remove unnecessary clearResolvedInstances() call

* add dual Cache:: and cache() assertions

* add apc

* Flush APCu cache in test setup

* Revert "add dual Cache:: and cache() assertions"

This reverts commit a0bab162fbe2dd0d25e7056ceca4fb7ce54efc77.

* phpstan fix

* Add logic for scoping 'file' disks to FilesystemTenancyBootstrapper

* minor changes, add todos

* refactor how the session.connection is used in the DB session bootstrapper

* add session forgery prevention logic to the db session bootstrapper

* only use the fs bootstrapper for file disk in 'cache data is separated' dataset

* minor session scoping test changes

* Add session scoping logic to FilesystemTenancyBootstrapper, correctly update disk roots even with storage_path_tenancy disabled

* Fix code style (php-cs-fixer)

* update docblock

* make not-null check more explicit

* separate bootstrapper tests, fix swapped test names for two tests

* refactor cache bootstrapper tests

* resolve global cache todo

* expand tests: session separation tests, more filesystem separation assertions; change prefix_base-type config keys to templates/formats

* add apc session scoping test, various session separation bugfixes

* phpstan + minor logic fixes

* prefix_format -> prefix

* fix database session separation test

* revert composer.json changes, update laravel dependencies to expected next release

* only run session scoping logic in cache bootstrapper for redis, memcached, dynamodb, apc; update gitattributes

* tenancy.central_domains -> tenancy.identification.central_domains

* db session separation test: add datasets

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-04-09 20:40:27 +02:00