1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-07 00:04:04 +00:00

Merge branch 'master' into override-toroute

This commit is contained in:
lukinovec 2026-04-15 11:46:36 +02:00 committed by GitHub
commit 61bf6dc561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 4 deletions

View file

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Bootstrappers; namespace Stancl\Tenancy\Bootstrappers;
use Exception;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Session\FileSessionHandler; use Illuminate\Session\FileSessionHandler;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -75,8 +76,13 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
: $this->originalStoragePath . '/framework/cache'; : $this->originalStoragePath . '/framework/cache';
if (! is_dir($path)) { if (! is_dir($path)) {
// Create tenant framework/cache directory if it does not exist // Create tenant framework/cache directory if it does not exist.
mkdir($path, 0750, true); // We ignore errors due to TOCTOU race conditions, instead we check for success below.
@mkdir($path, 0750, true);
if (! is_dir($path)) {
throw new Exception("Unable to create tenant storage directory [{$path}].");
}
} }
if ($suffix === false) { if ($suffix === false) {
@ -222,8 +228,13 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
: $this->originalStoragePath . '/framework/sessions'; : $this->originalStoragePath . '/framework/sessions';
if (! is_dir($path)) { if (! is_dir($path)) {
// Create tenant framework/sessions directory if it does not exist // Create tenant framework/sessions directory if it does not exist.
mkdir($path, 0750, true); // We ignore errors due to TOCTOU race conditions, instead we check for success below.
@mkdir($path, 0750, true);
if (! is_dir($path)) {
throw new Exception("Unable to create tenant session directory [{$path}].");
}
} }
$this->app['config']['session.files'] = $path; $this->app['config']['session.files'] = $path;

View file

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
/** @implements Scope<Model> */
class PendingScope implements Scope class PendingScope implements Scope
{ {
/** /**

View file

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
/** @implements Scope<Model> */
class ParentModelScope implements Scope class ParentModelScope implements Scope
{ {
/** /**

View file

@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope; use Illuminate\Database\Eloquent\Scope;
use Stancl\Tenancy\Tenancy; use Stancl\Tenancy\Tenancy;
/** @implements Scope<Model> */
class TenantScope implements Scope class TenantScope implements Scope
{ {
/** /**