1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Merge pull request #4895 from rubencm/ticket/15289

[ticket/15289] Allow to configure storage from acp

* github.com:phpbb/phpbb: (38 commits)
  [ticket/15289] Add phpdoc
  [ticket/15289] Remove common language from acp module
  [ticket/15289] Check form
  [ticket/15289] Use empty instead of count
  [ticket/15289] Language fixes
  [ticket/15289] Add missing files
  [ticket/15289] Use twig syntax in variables
  [ticket/15289] Use lang_defined()
  [ticket/15289] Dont use short names
  [ticket/15289] Dont use short names
  [ticket/15289] Use Twig includes
  [ticket/15289] Update acp module
  [ticket/15289] Fix comment typo
  [ticket/15289] Fix show field description
  [ticket/15289] Update event
  [ticket/15289] Remove switch since there is only one mode
  [ticket/15289] Improve error messages
  [ticket/15289] Fix code style
  [ticket/15289] Update acp storage
  [ticket/15289] Update acp storage template
  ...
This commit is contained in:
Tristan Darricau
2017-09-09 17:33:51 +02:00
13 changed files with 550 additions and 8 deletions

View File

@@ -83,9 +83,9 @@ class adapter_factory
{
$options = [];
foreach ($definitions as $def)
foreach (array_keys($definitions) as $definition)
{
$options[$def] = $this->config['storage\\' . $storage_name . '\\config\\' . $def];
$options[$definition] = $this->config['storage\\' . $storage_name . '\\config\\' . $definition];
}
return $options;

View File

@@ -15,6 +15,14 @@ namespace phpbb\storage\provider;
class local implements provider_interface
{
/**
* {@inheritdoc}
*/
public function get_name()
{
return 'local';
}
/**
* {@inheritdoc}
*/
@@ -28,7 +36,7 @@ class local implements provider_interface
*/
public function get_options()
{
return ['path'];
return ['path' => array('type' => 'text')];
}
/**

View File

@@ -15,6 +15,13 @@ namespace phpbb\storage\provider;
interface provider_interface
{
/**
* Gets adapter name.
*
* @return string
*/
public function get_name();
/**
* Gets adapter class.
*

View File

@@ -45,6 +45,16 @@ class storage
$this->storage_name = $storage_name;
}
/**
* Returns storage name
*
* @return string
*/
public function get_name()
{
return $this->storage_name;
}
/**
* Returns an adapter instance
*

View File

@@ -86,6 +86,7 @@ class extension extends \Twig_Extension
return array(
new \Twig_SimpleFunction('lang', array($this, 'lang')),
new \Twig_SimpleFunction('lang_defined', array($this, 'lang_defined')),
new \Twig_SimpleFunction('get_class', array($this, 'get_class')),
);
}
@@ -185,12 +186,24 @@ class extension extends \Twig_Extension
}
/**
* Check if a language variable exists
*
* @return bool
*/
* Check if a language variable exists
*
* @return bool
*/
public function lang_defined($key)
{
return call_user_func_array([$this->language, 'is_set'], [$key]);
}
/*
* Returns the name of the class of an object
*
* @param object $object The object
*
* @return string
*/
public function get_class($object)
{
return get_class($object);
}
}