diff options
| author | CHItA <mate.bartus@gmail.com> | 2015-06-13 15:35:19 +0200 |
|---|---|---|
| committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-08 01:28:03 +0200 |
| commit | 3dcaa48850bf823b238391fbf9c3f085092010bc (patch) | |
| tree | 52101d29d4774e88d2cf6c3a249e435c06b8d6ba /phpBB/install/module/install_data/task/add_languages.php | |
| parent | db4cfa7df62d5911bc5a0edcdc59236c39aede08 (diff) | |
| download | forums-3dcaa48850bf823b238391fbf9c3f085092010bc.tar forums-3dcaa48850bf823b238391fbf9c3f085092010bc.tar.gz forums-3dcaa48850bf823b238391fbf9c3f085092010bc.tar.bz2 forums-3dcaa48850bf823b238391fbf9c3f085092010bc.tar.xz forums-3dcaa48850bf823b238391fbf9c3f085092010bc.zip | |
[ticket/13740] Move installer files to phpbb/install directory
PHPBB3-13740
Diffstat (limited to 'phpBB/install/module/install_data/task/add_languages.php')
| -rw-r--r-- | phpBB/install/module/install_data/task/add_languages.php | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php deleted file mode 100644 index 7ffdf4f276..0000000000 --- a/phpBB/install/module/install_data/task/add_languages.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php -/** - * - * This file is part of the phpBB Forum Software package. - * - * @copyright (c) phpBB Limited <https://www.phpbb.com> - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\install\module\install_data\task; - -class add_languages extends \phpbb\install\task_base -{ - /** - * @var \phpbb\db\driver\driver_interface - */ - protected $db; - - /** - * @var \phpbb\install\helper\iohandler\iohandler_interface - */ - protected $iohandler; - - /** - * @var \phpbb\language\language_file_helper - */ - protected $language_helper; - - /** - * Constructor - * - * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler - * @param \phpbb\install\helper\container_factory $container Installer's DI container - * @param \phpbb\language\language_file_helper $language_helper Language file helper service - */ - public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, - \phpbb\install\helper\container_factory $container, - \phpbb\language\language_file_helper $language_helper) - { - $this->db = $container->get('dbal.conn'); - $this->iohandler = $iohandler; - $this->language_helper = $language_helper; - - parent::__construct(true); - } - - /** - * {@inheritdoc} - */ - public function run() - { - $this->db->sql_return_on_error(true); - - $languages = $this->language_helper->get_available_languages(); - $installed_languages = array(); - - foreach ($languages as $lang_info) - { - $lang_pack = array( - 'lang_iso' => $lang_info['iso'], - 'lang_dir' => $lang_info['iso'], - 'lang_english_name' => htmlspecialchars($lang_info['name']), - 'lang_local_name' => htmlspecialchars($lang_info['local_name'], ENT_COMPAT, 'UTF-8'), - 'lang_author' => htmlspecialchars($lang_info['author'], ENT_COMPAT, 'UTF-8'), - ); - - $this->db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $this->db->sql_build_array('INSERT', $lang_pack)); - - $installed_languages[] = (int) $this->db->sql_nextid(); - if ($this->db->get_sql_error_triggered()) - { - $error = $this->db->sql_error($this->db->get_sql_error_sql()); - $this->iohandler->add_error_message($error['message']); - } - } - - $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE; - $result = $this->db->sql_query($sql); - - $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE); - while ($row = $this->db->sql_fetchrow($result)) - { - foreach ($installed_languages as $lang_id) - { - $insert_buffer->insert(array( - 'field_id' => $row['field_id'], - 'lang_id' => $lang_id, - - // Remove phpbb_ from field name - 'lang_name' => strtoupper(substr($row['field_name'], 6)), - 'lang_explain' => '', - 'lang_default_value' => '', - )); - } - } - - $this->db->sql_freeresult($result); - - $insert_buffer->flush(); - } - - /** - * {@inheritdoc} - */ - static public function get_step_count() - { - return 1; - } - - /** - * {@inheritdoc} - */ - public function get_task_lang_name() - { - return 'TASK_ADD_LANGUAGES'; - } -} |
