diff --git a/phpBB/adm/style/acp_storage.html b/phpBB/adm/style/acp_storage.html index 39125f25ae..7275b4ecfa 100644 --- a/phpBB/adm/style/acp_storage.html +++ b/phpBB/adm/style/acp_storage.html @@ -2,35 +2,44 @@ -

{L_TITLE}

+

{L_STORAGE_TITLE}

-

{L_TITLE_EXPLAIN}

+

{L_STORAGE_TITLE_EXPLAIN}

- -
- {storage.LEGEND} -
-

{storage.TITLE_EXPLAIN}
-
-
-
- - -
- {adapter.NAME} - {adapter.SETTINGS} + {% for storage in STORAGES %} +
+ {{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }} +
+

{L_STORAGE_SELECT_DESC}
+
+ +
+
- - -
- {L_SUBMIT} -   - - {S_FORM_TOKEN} -
+ {% for provider in PROVIDERS if provider.is_available %} +
+ {{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }} - {{ lang('STORAGE_ADAPTER_' ~ provider.get_name | upper ~ '_NAME') }} + provider.get_options +
+ {% endfor %} + + {% endfor %} + +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
diff --git a/phpBB/composer-ext.json b/phpBB/composer-ext.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/phpBB/composer-ext.lock b/phpBB/composer-ext.lock deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index e9c0360436..c7ce82632a 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -15,6 +15,7 @@ services: - [] calls: - [setLexer, ['@template.twig.lexer']] + - [addGlobal, ['config', '@config']] template.twig.lexer: class: phpbb\template\twig\lexer diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php index cbf2a56bba..29fc123f22 100644 --- a/phpBB/includes/acp/acp_storage.php +++ b/phpBB/includes/acp/acp_storage.php @@ -40,6 +40,12 @@ class acp_storage /** @var \phpbb\user */ protected $user; + /** @var \phpbb\di\service_collection */ + protected $provider_collection; + + /** @var \phpbb\di\service_collection */ + protected $storage_collection; + /** @var string */ public $page_title; @@ -58,9 +64,11 @@ class acp_storage $this->request = $phpbb_container->get('request'); $this->template = $phpbb_container->get('template'); $this->user = $phpbb_container->get('user'); + $this->provider_collection = $phpbb_container->get('storage.provider_collection'); + $this->storage_collection = $phpbb_container->get('storage.storage_collection'); // Add necesary language files - $this->user->add_lang(array('acp/storage')); + $this->lang->add_lang(array('acp/storage')); switch($mode) { @@ -75,35 +83,6 @@ class acp_storage $form_name = 'acp_storage'; add_form_key($form_name); - global $phpbb_container; - $storage_collection = $phpbb_container->get('storage.storage_collection'); - $adapter_provider_collection = $phpbb_container->get('storage.provider_collection'); - - $storages = array(); - - foreach($storage_collection->getIterator() as $storage) - { - $this->template->assign_block_vars('storage', array( - 'LEGEND' => $storage->get_name(), - 'TITLE' => $storage->get_name(), - 'TITLE_EXPLAIN' => $storage->get_description(), - 'OPTIONS' => $this->generate_adapter_options(), - )); - - foreach($adapter_provider_collection as $provider) - { - if(!$provider->is_available()) - { - continue; - } - - $this->template->assign_block_vars('storage.adapter', array( - 'NAME' => get_class($provider), - 'SETTINGS' => print_r($provider->get_options(), 1), - )); - } - } - // Template from adm/style $this->tpl_name = 'acp_storage'; @@ -111,22 +90,8 @@ class acp_storage $this->page_title = 'STORAGE_TITLE'; $this->template->assign_vars(array( + 'STORAGES' => $this->storage_collection, + 'PROVIDERS' => $this->provider_collection )); } - - protected function generate_adapter_options() - { - global $phpbb_container; - $adapter_provider_collection = $phpbb_container->get('storage.provider_collection'); - - $options = ''; - - foreach($adapter_provider_collection as $provider) - { - $class = get_class($provider); - $options .= ""; - } - - return $options; - } } diff --git a/phpBB/includes/acp/info/acp_storage.php b/phpBB/includes/acp/info/acp_storage.php new file mode 100644 index 0000000000..25807be91f --- /dev/null +++ b/phpBB/includes/acp/info/acp_storage.php @@ -0,0 +1,34 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class acp_storage_info +{ + function module() + { + return array( + 'filename' => 'acp_storage', + 'title' => 'ACP_STORAGE', + 'modes' => array( + 'settings' => array('title' => 'ACP_STORAGE_SETTINGS', 'auth' => 'acl_a_storage', 'cat' => array('ACP_SERVER_CONFIGURATION')), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 8cc87dd892..a371c27d8e 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -178,6 +178,9 @@ $lang = array_merge($lang, array( 'ACP_SERVER_SETTINGS' => 'Server settings', 'ACP_SIGNATURE_SETTINGS' => 'Signature settings', 'ACP_SMILIES' => 'Smilies', + + 'ACP_STORAGE_SETTINGS' => 'Storage settings', + 'ACP_STYLE_MANAGEMENT' => 'Style management', 'ACP_STYLES' => 'Styles', 'ACP_STYLES_CACHE' => 'Purge Cache', diff --git a/phpBB/language/en/acp/storage.php b/phpBB/language/en/acp/storage.php index 36c8641431..7025ce8a80 100644 --- a/phpBB/language/en/acp/storage.php +++ b/phpBB/language/en/acp/storage.php @@ -37,4 +37,15 @@ if (empty($lang) || !is_array($lang)) // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine $lang = array_merge($lang, array( + 'STORAGE_TITLE' => 'Storage Settings', + 'STORAGE_TITLE_EXPLAIN' => 'Here you can change the storage.', + 'STORAGE_SELECT' => 'Select storage', + 'STORAGE_SELECT_DESC' => 'Select an storage from the list.', + + 'STORAGE_ATTACHMENT_TITLE' => 'Attachments storage', + 'STORAGE_AVATAR_TITLE' => 'Avatars storage', + 'STORAGE_BACKUP_TITLE' => 'Backup storage', + + 'STORAGE_ADAPTER_LOCAL_NAME' => 'Local', + )); diff --git a/phpBB/phpbb/storage/provider/local.php b/phpBB/phpbb/storage/provider/local.php index 370178cf47..32167d7d9c 100644 --- a/phpBB/phpbb/storage/provider/local.php +++ b/phpBB/phpbb/storage/provider/local.php @@ -15,6 +15,16 @@ namespace phpbb\storage\provider; class local implements provider_interface { + public function get_name() + { + return 'local'; + } + + public function get_class() + { + return get_class($this); + } + /** * {@inheritdoc} */ @@ -28,7 +38,7 @@ class local implements provider_interface */ public function get_options() { - return ['path']; + return ['path' => array('lang' => 'PATH', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false)]; } /** diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index be5d813056..a380f93663 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -45,19 +45,14 @@ class storage $this->storage_name = $storage_name; } - public function get_id() - { - return $this->storage_name; - } - + /** + * Returns storage name + * + * @return string + */ public function get_name() { - return strtoupper('STORAGE_' . $this->storage_name . '_NAME'); - } - - public function get_description() - { - return strtoupper('STORAGE_' . $this->storage_name . '_DESCRIPTION'); + return $this->storage_name; } /**