mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 15:27:42 +02:00
[ticket/15287] Launch exception if storage is not available
PHPBB3-15287
This commit is contained in:
@@ -727,6 +727,7 @@ $lang = array_merge($lang, array(
|
|||||||
'SUBJECT' => 'Subject',
|
'SUBJECT' => 'Subject',
|
||||||
'SUBMIT' => 'Submit',
|
'SUBMIT' => 'Submit',
|
||||||
|
|
||||||
|
'STORAGE_ADAPTER_NOT_AVAILABLE' => 'Selected storage is not available.',
|
||||||
'STORAGE_FILE_EXISTS' => 'File already exists.',
|
'STORAGE_FILE_EXISTS' => 'File already exists.',
|
||||||
'STORAGE_FILE_NO_EXIST' => 'File does not exist.',
|
'STORAGE_FILE_NO_EXIST' => 'File does not exist.',
|
||||||
'STORAGE_CANNOT_WRITE_FILE' => 'Can not write to file.',
|
'STORAGE_CANNOT_WRITE_FILE' => 'Can not write to file.',
|
||||||
|
@@ -15,6 +15,7 @@ namespace phpbb\storage;
|
|||||||
|
|
||||||
use phpbb\config\config;
|
use phpbb\config\config;
|
||||||
use phpbb\di\service_collection;
|
use phpbb\di\service_collection;
|
||||||
|
use phpbb\storage\exception\exception;
|
||||||
|
|
||||||
class adapter_factory
|
class adapter_factory
|
||||||
{
|
{
|
||||||
@@ -59,6 +60,11 @@ class adapter_factory
|
|||||||
$provider_class = $this->config['storage\\' . $storage_name . '\\adapter'];
|
$provider_class = $this->config['storage\\' . $storage_name . '\\adapter'];
|
||||||
$provider = $this->providers->get_by_class($provider_class);
|
$provider = $this->providers->get_by_class($provider_class);
|
||||||
|
|
||||||
|
if (!$provider->is_available())
|
||||||
|
{
|
||||||
|
throw new exception('STORAGE_ADAPTER_NOT_AVAILABLE');
|
||||||
|
}
|
||||||
|
|
||||||
$adapter = $this->adapters->get_by_class($provider->get_adapter_class());
|
$adapter = $this->adapters->get_by_class($provider->get_adapter_class());
|
||||||
$adapter->configure($this->build_options($storage_name, $provider->get_options()));
|
$adapter->configure($this->build_options($storage_name, $provider->get_options()));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user