mirror of
https://github.com/archtechx/tenancy.git
synced 2026-06-21 08:24:04 +00:00
Add validateFilename()
Use validateFilename instead of validateParameter in SQLiteDatabaseManager. Directories are no longer considered valid SQLite database names.
This commit is contained in:
parent
2bd3a868ec
commit
76c324d758
3 changed files with 37 additions and 18 deletions
|
|
@ -60,11 +60,6 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
*/
|
||||
public static Closure|null $closeInMemoryConnectionUsing = null;
|
||||
|
||||
protected static function parameterAllowlist(): string
|
||||
{
|
||||
return 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.';
|
||||
}
|
||||
|
||||
public function createDatabase(TenantWithDatabase $tenant): bool
|
||||
{
|
||||
/** @var TenantWithDatabase&Model $tenant */
|
||||
|
|
@ -92,8 +87,6 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
return true;
|
||||
}
|
||||
|
||||
$this->validateParameter($name);
|
||||
|
||||
return file_put_contents($this->getPath($name), '') !== false;
|
||||
}
|
||||
|
||||
|
|
@ -109,8 +102,6 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
return true;
|
||||
}
|
||||
|
||||
$this->validateParameter($name);
|
||||
|
||||
$path = $this->getPath($name);
|
||||
|
||||
try {
|
||||
|
|
@ -132,8 +123,6 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
return true;
|
||||
}
|
||||
|
||||
$this->validateParameter($name);
|
||||
|
||||
return file_exists($this->getPath($name));
|
||||
}
|
||||
|
||||
|
|
@ -159,6 +148,8 @@ class SQLiteDatabaseManager implements TenantDatabaseManager
|
|||
return rtrim(static::$path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
|
||||
}
|
||||
|
||||
$this->validateFilename($name);
|
||||
|
||||
return database_path($name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue