mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 20:38:52 +00:00
[ticket/17361] Use new adapter options format in acp_storage
PHPBB-17361
This commit is contained in:
parent
1f7ae9e2b0
commit
d6953a0422
4 changed files with 14 additions and 15 deletions
|
@ -378,7 +378,6 @@ class acp_storage
|
||||||
foreach ($this->storage_collection as $storage)
|
foreach ($this->storage_collection as $storage)
|
||||||
{
|
{
|
||||||
$storage_name = $storage->get_name();
|
$storage_name = $storage->get_name();
|
||||||
$options = $this->storage_helper->get_provider_options($this->storage_helper->get_current_provider($storage_name));
|
|
||||||
|
|
||||||
$modified = false;
|
$modified = false;
|
||||||
|
|
||||||
|
@ -389,6 +388,8 @@ class acp_storage
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$options = $this->storage_helper->get_provider_options($this->storage_helper->get_current_provider($storage_name));
|
||||||
|
|
||||||
// Check if options have been modified
|
// Check if options have been modified
|
||||||
foreach (array_keys($options) as $definition)
|
foreach (array_keys($options) as $definition)
|
||||||
{
|
{
|
||||||
|
@ -535,30 +536,29 @@ class acp_storage
|
||||||
$this->validate_path($storage_name, $messages);
|
$this->validate_path($storage_name, $messages);
|
||||||
|
|
||||||
// Check options
|
// Check options
|
||||||
$new_options = $this->storage_helper->get_provider_options($this->request->variable([$storage_name, 'provider'], ''));
|
$new_provider = $this->provider_collection->get_by_class($this->request->variable([$storage_name, 'provider'], ''));
|
||||||
|
|
||||||
foreach ($new_options as $definition_key => $definition_value)
|
foreach ($new_provider->get_options() as $definition_key => $definition_value)
|
||||||
{
|
{
|
||||||
$provider = $this->provider_collection->get_by_class($this->request->variable([$storage_name, 'provider'], ''));
|
|
||||||
$definition_title = $this->lang->lang('STORAGE_ADAPTER_' . strtoupper($provider->get_name()) . '_OPTION_' . strtoupper($definition_key));
|
|
||||||
|
|
||||||
|
$definition_title = $definition_value['title'];
|
||||||
$value = $this->request->variable([$storage_name, $definition_key], '');
|
$value = $this->request->variable([$storage_name, $definition_key], '');
|
||||||
|
|
||||||
switch ($definition_value['tag'])
|
switch ($definition_value['form_macro']['tag'])
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
if ($definition_value['type'] == 'email' && filter_var($value, FILTER_VALIDATE_EMAIL))
|
if ($definition_value['form_macro']['type'] === 'email' && filter_var($value, FILTER_VALIDATE_EMAIL))
|
||||||
{
|
{
|
||||||
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT', $definition_title, $storage_title);
|
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT', $definition_title, $storage_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxlength = $definition_value['max'] ?? 255;
|
$maxlength = $definition_value['form_macro']['max'] ?? 255;
|
||||||
if (strlen($value) > $maxlength)
|
if (strlen($value) > $maxlength)
|
||||||
{
|
{
|
||||||
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_TEXT_TOO_LONG', $definition_title, $storage_title);
|
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_TEXT_TOO_LONG', $definition_title, $storage_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($provider->get_name() == 'local' && $definition_key == 'path')
|
if ($new_provider->get_name() === 'local' && $definition_key === 'path')
|
||||||
{
|
{
|
||||||
$path = $value;
|
$path = $value;
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ class acp_storage
|
||||||
|
|
||||||
case 'radio':
|
case 'radio':
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($definition_value['buttons'] as $button)
|
foreach ($definition_value['form_macro']['buttons'] as $button)
|
||||||
{
|
{
|
||||||
if ($button['value'] == $value)
|
if ($button['value'] == $value)
|
||||||
{
|
{
|
||||||
|
@ -592,7 +592,7 @@ class acp_storage
|
||||||
|
|
||||||
case 'select':
|
case 'select':
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($definition_value['options'] as $option)
|
foreach ($definition_value['form_macro']['options'] as $option)
|
||||||
{
|
{
|
||||||
if ($option['value'] == $value)
|
if ($option['value'] == $value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,6 @@ class storage_backup_data extends migration
|
||||||
{
|
{
|
||||||
while (($file = readdir($dh)) !== false)
|
while (($file = readdir($dh)) !== false)
|
||||||
{
|
{
|
||||||
echo "FILE $file\n";
|
|
||||||
if (preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches))
|
if (preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches))
|
||||||
{
|
{
|
||||||
if (in_array($matches[2], $methods))
|
if (in_array($matches[2], $methods))
|
||||||
|
|
|
@ -230,10 +230,10 @@ class language
|
||||||
* Params are the language key and the parameters to be substituted.
|
* Params are the language key and the parameters to be substituted.
|
||||||
* This function/functionality is inspired by SHS` and Ashe.
|
* This function/functionality is inspired by SHS` and Ashe.
|
||||||
*
|
*
|
||||||
* Example call: <samp>$user->lang('NUM_POSTS_IN_QUEUE', 1);</samp>
|
* Example call: <samp>$language->lang('NUM_POSTS_IN_QUEUE', 1);</samp>
|
||||||
*
|
*
|
||||||
* If the first parameter is an array, the elements are used as keys and subkeys to get the language entry:
|
* If the first parameter is an array, the elements are used as keys and subkeys to get the language entry:
|
||||||
* Example: <samp>$user->lang(array('datetime', 'AGO'), 1)</samp> uses $user->lang['datetime']['AGO'] as language entry.
|
* Example: <samp>$language->lang(array('datetime', 'AGO'), 1)</samp> uses $language->lang['datetime']['AGO'] as language entry.
|
||||||
*
|
*
|
||||||
* @return string Return localized string or the language key if the translation is not available
|
* @return string Return localized string or the language key if the translation is not available
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,7 +89,7 @@ class adapter_factory
|
||||||
}
|
}
|
||||||
|
|
||||||
$adapter = $this->adapters->get_by_class($provider->get_adapter_class());
|
$adapter = $this->adapters->get_by_class($provider->get_adapter_class());
|
||||||
$options['storage'] = $storage_name; // Inject storage name into options so it can be used by extensiosn
|
$options['storage'] = $storage_name; // Inject storage name into options so it can be used by extensions
|
||||||
$adapter->configure($options);
|
$adapter->configure($options);
|
||||||
|
|
||||||
return $adapter;
|
return $adapter;
|
||||||
|
|
Loading…
Add table
Reference in a new issue