mirror of
https://github.com/archtechx/tenancy.git
synced 2026-09-20 15:14:03 +00:00
improve comments
This commit is contained in:
parent
bb12443fa6
commit
41f7e2e034
3 changed files with 23 additions and 36 deletions
|
|
@ -17,15 +17,11 @@ use Throwable;
|
|||
|
||||
/**
|
||||
* Serves files from app/public inside the tenant's storage directory, or from the root
|
||||
* of the $publicDisk when one is configured.
|
||||
* of the $publicDisk when the property is set.
|
||||
*
|
||||
* Requires FilesystemTenancyBootstrapper to be enabled since it points the public disk's
|
||||
* root at the tenant's storage directory. Without it, the disk keeps writing to the central
|
||||
* storage/app/public, so the tenant's directory is never populated and requests 404
|
||||
* (the path itself is tenant-specific either way, via getBoundTenantStoragePath()).
|
||||
*
|
||||
* With a $publicDisk configured, the assets come from that disk's root instead. The
|
||||
* bootstrapper is needed to make that root tenant-specific (see $publicDisk).
|
||||
* Requires FilesystemTenancyBootstrapper to be enabled, so that writes to the default
|
||||
* public disk end up in the app/public within the *tenant's* storage, or so that the
|
||||
* public disk set in the static property is similarly scoped.
|
||||
*
|
||||
* @see FilesystemTenancyBootstrapper
|
||||
*/
|
||||
|
|
@ -55,8 +51,8 @@ class TenantAssetController implements HasMiddleware
|
|||
*
|
||||
* It should also be listed in tenancy.filesystem.disks -- for scoped disks, it's the parent
|
||||
* disk that has to be listed there (since a scoped disk inherits the parent's root).
|
||||
* FilesystemTenancyBootstrapper only scopes the roots of disks listed there, so otherwise
|
||||
* every tenant is served the same (central) directory.
|
||||
* FilesystemTenancyBootstrapper only scopes the roots of disks listed there, so
|
||||
* without that every tenant would be served the same (central) directory.
|
||||
*/
|
||||
public static string|null $publicDisk = null;
|
||||
|
||||
|
|
@ -142,7 +138,7 @@ class TenantAssetController implements HasMiddleware
|
|||
|
||||
// User is attempting to access a file outside the $allowedRoot folder.
|
||||
// The trailing separator is needed so that sibling directories that
|
||||
// start with the same name (e.g. app/public-private) don't pass.
|
||||
// start with the same name (e.g. app/public-private) aren't accepted.
|
||||
$this->abortIf(! str($attemptedPath)->startsWith(rtrim($allowedRoot, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR), 'Accessing a file outside the storage root');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,11 @@ use Stancl\Tenancy\Contracts\Tenant;
|
|||
/**
|
||||
* Delete the tenant's storage directory.
|
||||
*
|
||||
* The directory is the one FilesystemTenancyBootstrapper scopes the tenant's disks, cache
|
||||
* and sessions to. The path is derived the same way the bootstrapper derives it, so the
|
||||
* bootstrapper doesn't *have* to be enabled (though if it isn't, nothing was written there and
|
||||
* there's nothing to delete).
|
||||
*
|
||||
* 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.
|
||||
* The directory is used by the FilesystemTenancyBootstrapper for:
|
||||
* - scoped storage_path() when suffix_storage_path is enabled
|
||||
* - scoped cache when enabled
|
||||
* - scoped sessions when enabled
|
||||
* - scoped disks when enabled
|
||||
*
|
||||
* @see FilesystemTenancyBootstrapper
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue