1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-28 10:09:15 +02:00

[ticket/15287] Launch exception if storage is not available

PHPBB3-15287
This commit is contained in:
Rubén Calvo 2017-07-24 09:37:10 +02:00
parent ba8cda4d05
commit e41d4b0d0c
2 changed files with 7 additions and 0 deletions

View File

@ -727,6 +727,7 @@ $lang = array_merge($lang, array(
'SUBJECT' => 'Subject',
'SUBMIT' => 'Submit',
'STORAGE_ADAPTER_NOT_AVAILABLE' => 'Selected storage is not available.',
'STORAGE_FILE_EXISTS' => 'File already exists.',
'STORAGE_FILE_NO_EXIST' => 'File does not exist.',
'STORAGE_CANNOT_WRITE_FILE' => 'Can not write to file.',

View File

@ -15,6 +15,7 @@ namespace phpbb\storage;
use phpbb\config\config;
use phpbb\di\service_collection;
use phpbb\storage\exception\exception;
class adapter_factory
{
@ -59,6 +60,11 @@ class adapter_factory
$provider_class = $this->config['storage\\' . $storage_name . '\\adapter'];
$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->configure($this->build_options($storage_name, $provider->get_options()));