From 3dcaa48850bf823b238391fbf9c3f085092010bc Mon Sep 17 00:00:00 2001
From: CHItA <mate.bartus@gmail.com>
Date: Sat, 13 Jun 2015 15:35:19 +0200
Subject: [ticket/13740] Move installer files to phpbb/install directory

PHPBB3-13740
---
 .../install/module/install_database/module.php     |  28 ++
 .../install_database/task/add_config_settings.php  | 341 +++++++++++++++++++++
 .../install_database/task/add_default_data.php     | 161 ++++++++++
 .../module/install_database/task/create_schema.php | 214 +++++++++++++
 4 files changed, 744 insertions(+)
 create mode 100644 phpBB/phpbb/install/module/install_database/module.php
 create mode 100644 phpBB/phpbb/install/module/install_database/task/add_config_settings.php
 create mode 100644 phpBB/phpbb/install/module/install_database/task/add_default_data.php
 create mode 100644 phpBB/phpbb/install/module/install_database/task/create_schema.php

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/module.php b/phpBB/phpbb/install/module/install_database/module.php
new file mode 100644
index 0000000000..0d8b33087f
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/module.php
@@ -0,0 +1,28 @@
+<?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_database;
+
+/**
+ * Installer module for database installation
+ */
+class module extends \phpbb\install\module_base
+{
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_navigation_stage_path()
+	{
+		return array('install', 0, 'install');
+	}
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
new file mode 100644
index 0000000000..25da36e01d
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -0,0 +1,341 @@
+<?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_database\task;
+
+/**
+ * Create database schema
+ */
+class add_config_settings extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\filesystem\filesystem_interface
+	 */
+	protected $filesystem;
+
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $install_config;
+
+	/**
+	 * @var \phpbb\install\helper\iohandler\iohandler_interface
+	 */
+	protected $iohandler;
+
+	/**
+	 * @var \phpbb\language\language
+	 */
+	protected $language;
+
+	/**
+	 * @var \phpbb\passwords\manager
+	 */
+	protected $password_manager;
+
+	/**
+	 * @var string
+	 */
+	protected $phpbb_root_path;
+
+	/**
+	 * @var string
+	 */
+	protected $config_table;
+
+	/**
+	 * @var string
+	 */
+	protected $user_table;
+
+	/**
+	 * @var string
+	 */
+	protected $topics_table;
+
+	/**
+	 * @var string
+	 */
+	protected $forums_table;
+
+	/**
+	 * @var string
+	 */
+	protected $posts_table;
+
+	/**
+	 * @var string
+	 */
+	protected $moderator_cache_table;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\filesystem\filesystem_interface				$filesystem			Filesystem service
+	 * @param \phpbb\install\helper\config							$install_config		Installer's config helper
+	 * @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								$language			Language service
+	 * @param string												$phpbb_root_path	Path to phpBB's root
+	 */
+	public function __construct(\phpbb\filesystem\filesystem_interface $filesystem,
+								\phpbb\install\helper\config $install_config,
+								\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
+								\phpbb\install\helper\container_factory $container,
+								\phpbb\language\language $language,
+								$phpbb_root_path)
+	{
+		$this->db				= $container->get('dbal.conn');
+		$this->filesystem		= $filesystem;
+		$this->install_config	= $install_config;
+		$this->iohandler		= $iohandler;
+		$this->language			= $language;
+		$this->password_manager	= $container->get('passwords.manager');
+		$this->phpbb_root_path	= $phpbb_root_path;
+
+		// Table names
+		$this->config_table				= $container->get_parameter('tables.config');
+		$this->forums_table				= $container->get_parameter('tables.forums');
+		$this->topics_table				= $container->get_parameter('tables.topics');
+		$this->user_table				= $container->get_parameter('tables.users');
+		$this->moderator_cache_table	= $container->get_parameter('tables.moderator_cache');
+		$this->posts_table				= $container->get_parameter('tables.posts');
+
+		parent::__construct(true);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		$this->db->sql_return_on_error(true);
+
+		$server_name	= $this->install_config->get('server_name');
+		$cookie_domain	= $this->install_config->get('cookie_domain');
+		$current_time 	= time();
+		$user_ip		= phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR'));
+		$user_ip		= ($user_ip === false) ? '' : $user_ip;
+		$referer		= $this->iohandler->get_server_variable('REFERER');
+
+		// Set default config and post data, this applies to all DB's
+		$sql_ary = array(
+			'INSERT INTO ' . $this->config_table . " (config_name, config_value)
+				VALUES ('board_startdate', '$current_time')",
+
+			'INSERT INTO ' . $this->config_table . " (config_name, config_value)
+				VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "'
+				WHERE config_name = 'img_imagick'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "'
+				WHERE config_name = 'server_name'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "'
+				WHERE config_name = 'server_port'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'
+				WHERE config_name = 'board_email'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'
+				WHERE config_name = 'board_contact'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($cookie_domain) . "'
+				WHERE config_name = 'cookie_domain'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "'
+				WHERE config_name = 'default_dateformat'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "'
+				WHERE config_name = 'email_enable'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "'
+				WHERE config_name = 'smtp_delivery'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "'
+				WHERE config_name = 'smtp_host'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "'
+				WHERE config_name = 'smtp_auth_method'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "'
+				WHERE config_name = 'smtp_username'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "'
+				WHERE config_name = 'smtp_password'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "'
+				WHERE config_name = 'cookie_secure'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "'
+				WHERE config_name = 'force_server_vars'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "'
+				WHERE config_name = 'script_path'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "'
+				WHERE config_name = 'server_protocol'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
+				WHERE config_name = 'newest_username'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . md5(mt_rand()) . "'
+				WHERE config_name = 'avatar_salt'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . md5(mt_rand()) . "'
+				WHERE config_name = 'plupload_salt'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "'
+				WHERE config_name = 'sitename'",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "'
+				WHERE config_name = 'site_desc'",
+
+			'UPDATE ' . $this->user_table . "
+				SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',
+					user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "',
+					user_ip = '" . $this->db->sql_escape($user_ip) . "',
+					user_lang = '" . $this->db->sql_escape($this->install_config->get('language')) . "',
+					user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "',
+					user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "',
+					user_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ",
+					username_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "'
+				WHERE username = 'Admin'",
+
+			'UPDATE ' . $this->moderator_cache_table . "
+				SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
+				WHERE username = 'Admin'",
+
+			'UPDATE ' . $this->forums_table . "
+				SET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
+				WHERE forum_last_poster_name = 'Admin'",
+
+			'UPDATE ' . $this->topics_table . "
+				SET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',
+				topic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
+				WHERE topic_first_poster_name = 'Admin'
+					OR topic_last_poster_name = 'Admin'",
+
+			'UPDATE ' . $this->user_table . "
+				SET user_regdate = $current_time",
+
+			'UPDATE ' . $this->posts_table . "
+				SET post_time = $current_time, poster_ip = '" . $this->db->sql_escape($user_ip) . "'",
+
+			'UPDATE ' . $this->topics_table . "
+				SET topic_time = $current_time, topic_last_post_time = $current_time",
+
+			'UPDATE ' . $this->forums_table . "
+				SET forum_last_post_time = $current_time",
+
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "'
+				WHERE config_name = 'dbms_version'",
+		);
+
+		if (@extension_loaded('gd'))
+		{
+			$sql_ary[] = 'UPDATE ' . $this->config_table . "
+				SET config_value = 'core.captcha.plugins.gd'
+				WHERE config_name = 'captcha_plugin'";
+
+			$sql_ary[] = 'UPDATE ' . $this->config_table . "
+				SET config_value = '1'
+				WHERE config_name = 'captcha_gd'";
+		}
+
+		$ref = substr($referer, strpos($referer, '://') + 3);
+		if (!(stripos($ref, $server_name) === 0))
+		{
+			$sql_ary[] = 'UPDATE ' . $this->config_table . "
+				SET config_value = '0'
+				WHERE config_name = 'referer_validation'";
+		}
+
+		// We set a (semi-)unique cookie name to bypass login issues related to the cookie name.
+		$cookie_name = 'phpbb3_';
+		$rand_str = md5(mt_rand());
+		$rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35));
+		$rand_str = substr($rand_str, 0, 5);
+		$cookie_name .= strtolower($rand_str);
+
+		$sql_ary[] = 'UPDATE ' . $this->config_table . "
+			SET config_value = '" . $this->db->sql_escape($cookie_name) . "'
+			WHERE config_name = 'cookie_name'";
+
+		// Disable avatars if upload directory is not writable
+		if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/'))
+		{
+			$sql_ary[] = 'UPDATE ' . $this->config_table . "
+				SET config_value = '0'
+				WHERE config_name = 'allow_avatar'";
+
+			$sql_ary[] = 'UPDATE ' . $this->config_table . "
+				SET config_value = '0'
+				WHERE config_name = 'allow_avatar_upload'";
+		}
+
+		foreach ($sql_ary as $sql)
+		{
+			if (!$this->db->sql_query($sql))
+			{
+				$error = $this->db->sql_error($this->db->get_sql_error_sql());
+				$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
+			}
+		}
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_ADD_CONFIG_SETTINGS';
+	}
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
new file mode 100644
index 0000000000..5dbfbb4478
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -0,0 +1,161 @@
+<?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_database\task;
+
+/**
+ * Create database schema
+ */
+class add_default_data extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\install\helper\database
+	 */
+	protected $database_helper;
+
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $config;
+
+	/**
+	 * @var \phpbb\install\helper\iohandler\iohandler_interface
+	 */
+	protected $iohandler;
+
+	/**
+	 * @var \phpbb\language\language
+	 */
+	protected $language;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\install\helper\database						$db_helper	Installer's database helper
+	 * @param \phpbb\install\helper\config							$config		Installer config
+	 * @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								$language	Language service
+	 */
+	public function __construct(\phpbb\install\helper\database $db_helper,
+								\phpbb\install\helper\config $config,
+								\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
+								\phpbb\install\helper\container_factory $container,
+								\phpbb\language\language $language)
+	{
+		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
+		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
+
+		$this->db				= $container->get('dbal.conn'); //new $dbms();
+		$this->database_helper	= $db_helper;
+		$this->config			= $config;
+		$this->iohandler		= $iohandler;
+		$this->language			= $language;
+
+		parent::__construct(true);
+
+		// Connect to DB
+		//$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		$this->db->sql_return_on_error(true);
+
+		$table_prefix = $this->config->get('table_prefix');
+		$dbms = $this->config->get('dbms');
+		$dbms_info = $this->database_helper->get_available_dbms($dbms);
+
+		// Get schema data from file
+		$sql_query = @file_get_contents('schemas/schema_data.sql');
+
+		// Clean up SQL
+		$sql_query = $this->replace_dbms_specific_sql($sql_query);
+		$sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $table_prefix . '\1 ', $sql_query);
+		$sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $sql_query);
+		$sql_query = $this->database_helper->remove_comments($sql_query);
+		$sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']);
+
+		foreach ($sql_query as $sql)
+		{
+			if (!$this->db->sql_query($sql))
+			{
+				$error = $this->db->sql_error($this->db->get_sql_error_sql());
+				$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
+			}
+		}
+	}
+
+	/**
+	 * Process DB specific SQL
+	 *
+	 * @return string
+	 */
+	protected function replace_dbms_specific_sql($query)
+	{
+		if ($this->db instanceof \phpbb\db\driver\mssql_base || $this->db instanceof \phpbb\db\driver\mssql)
+		{
+			$query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $query);
+		}
+		else if ($this->db instanceof \phpbb\db\driver\postgres)
+		{
+			$query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $query);
+		}
+		else if ($this->db instanceof \phpbb\db\driver\mysql_base)
+		{
+			$query = str_replace('\\', '\\\\', $query);
+		}
+
+		return $query;
+	}
+
+	/**
+	 * Callback function for language replacing
+	 *
+	 * @param array	$matches
+	 * @return string
+	 */
+	public function lang_replace_callback($matches)
+	{
+		if (!empty($matches[1]))
+		{
+			return $this->db->sql_escape($this->language->lang($matches[1]));
+		}
+
+		return '';
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_ADD_DEFAULT_DATA';
+	}
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
new file mode 100644
index 0000000000..7cc521eee8
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -0,0 +1,214 @@
+<?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_database\task;
+
+/**
+ * Create database schema
+ */
+class create_schema extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $config;
+
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\db\tools\tools_interface
+	 */
+	protected $db_tools;
+
+	/**
+	 * @var \phpbb\install\helper\database
+	 */
+	protected $database_helper;
+
+	/**
+	 * @var \phpbb\filesystem\filesystem_interface
+	 */
+	protected $filesystem;
+
+	/**
+	 * @var \phpbb\install\helper\iohandler\iohandler_interface
+	 */
+	protected $iohandler;
+
+	/**
+	 * @var string
+	 */
+	protected $phpbb_root_path;
+
+	/**
+	 * @var string
+	 */
+	protected $php_ext;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\install\helper\config							$config				Installer's config provider
+	 * @param \phpbb\install\helper\database						$db_helper			Installer's database helper
+	 * @param \phpbb\filesystem\filesystem_interface				$filesystem			Filesystem service
+	 * @param \phpbb\install\helper\iohandler\iohandler_interface	$iohandler			Installer's input-output handler
+	 * @param string												$phpbb_root_path	Path phpBB's root
+	 * @param string												$php_ext			Extension of PHP files
+	 */
+	public function __construct(\phpbb\install\helper\config $config,
+								\phpbb\install\helper\database $db_helper,
+								\phpbb\filesystem\filesystem_interface $filesystem,
+								\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
+								$phpbb_root_path,
+								$php_ext)
+	{
+		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
+		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
+		$factory = new \phpbb\db\tools\factory();
+
+		$this->db				= new $dbms();
+		$this->config			= $config;
+		$this->db_tools			= $factory->get($this->db);
+		$this->database_helper	= $db_helper;
+		$this->filesystem		= $filesystem;
+		$this->iohandler		= $iohandler;
+		$this->phpbb_root_path	= $phpbb_root_path;
+		$this->php_ext			= $php_ext;
+
+		parent::__construct(true);
+
+		// Connect to DB
+		$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		$this->db->sql_return_on_error(true);
+
+		$dbms = $this->config->get('dbms');
+		$dbms_info = $this->database_helper->get_available_dbms($dbms);
+		$schema_name = $dbms_info[$dbms]['SCHEMA'];
+		$delimiter = $dbms_info[$dbms]['DELIM'];
+		$table_prefix = $this->config->get('table_prefix');
+
+		if ($dbms === 'mysql')
+		{
+			if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
+			{
+				$schema_name .= '_41';
+			}
+			else
+			{
+				$schema_name .= '_40';
+			}
+		}
+
+		$db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
+
+		// Load database vendor specific code if there is any
+		if ($this->filesystem->exists($db_schema_path))
+		{
+			$sql_query = @file_get_contents($db_schema_path);
+			$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
+			$sql_query = $this->database_helper->remove_comments($sql_query);
+			$sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter);
+
+			foreach ($sql_query as $sql)
+			{
+				if (!$this->db->sql_query($sql))
+				{
+					$error = $this->db->sql_error($this->db->get_sql_error_sql());
+					$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
+				}
+			}
+
+			unset($sql_query);
+		}
+
+		$change_prefix = false;
+
+		// Generate database schema
+		if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json'))
+		{
+			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json');
+			$db_table_schema = json_decode($db_table_schema, true);
+			$change_prefix = true;
+		}
+		else
+		{
+			global $table_prefix;
+
+			$table_prefix = $this->config->get('table_prefix');
+
+			if (!defined('CONFIG_TABLE'))
+			{
+				// We need to include the constants file for the table constants
+				// when we generate the schema from the migration files.
+				include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext);
+			}
+
+			$finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext);
+			$migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes();
+			$factory = new \phpbb\db\tools\factory();
+			$db_tools = $factory->get($this->db, true);
+			$schema_generator = new \phpbb\db\migration\schema_generator(
+				$migrator_classes,
+				new \phpbb\config\config(array()),
+				$this->db,
+				$db_tools,
+				$this->phpbb_root_path,
+				$this->php_ext,
+				$table_prefix
+			);
+			$db_table_schema = $schema_generator->get_schema();
+		}
+
+		if (!defined('CONFIG_TABLE'))
+		{
+			// CONFIG_TABLE is required by sql_create_index() to check the
+			// length of index names. However table_prefix is not defined
+			// here yet, so we need to create the constant ourselves.
+			define('CONFIG_TABLE', $table_prefix . 'config');
+		}
+
+		foreach ($db_table_schema as $table_name => $table_data)
+		{
+			$this->db_tools->sql_create_table(
+				( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ),
+				$table_data
+			);
+		}
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_CREATE_DATABASE_SCHEMA';
+	}
+}
-- 
cgit v1.2.1


From 0f5f62f8db4fe5816329abaca7ad6ff10c8cf749 Mon Sep 17 00:00:00 2001
From: CHItA <mate.bartus@gmail.com>
Date: Thu, 18 Jun 2015 02:12:49 +0200
Subject: [ticket/13740] Load schema_data.sql from the correct location

[ci skip]

PHPBB3-13740
---
 .../module/install_database/task/add_default_data.php   | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index 5dbfbb4478..44b614f4de 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -43,6 +43,11 @@ class add_default_data extends \phpbb\install\task_base
 	 */
 	protected $language;
 
+	/**
+	 * @var string
+	 */
+	protected $phpbb_root_path;
+
 	/**
 	 * Constructor
 	 *
@@ -51,26 +56,26 @@ class add_default_data extends \phpbb\install\task_base
 	 * @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								$language	Language service
+	 * @param string												$root_path	Root path of phpBB
 	 */
 	public function __construct(\phpbb\install\helper\database $db_helper,
 								\phpbb\install\helper\config $config,
 								\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
 								\phpbb\install\helper\container_factory $container,
-								\phpbb\language\language $language)
+								\phpbb\language\language $language,
+								$root_path)
 	{
 		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
 		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
 
-		$this->db				= $container->get('dbal.conn'); //new $dbms();
+		$this->db				= $container->get('dbal.conn');
 		$this->database_helper	= $db_helper;
 		$this->config			= $config;
 		$this->iohandler		= $iohandler;
 		$this->language			= $language;
+		$this->phpbb_root_path	= $root_path;
 
 		parent::__construct(true);
-
-		// Connect to DB
-		//$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
 	}
 
 	/**
@@ -85,7 +90,7 @@ class add_default_data extends \phpbb\install\task_base
 		$dbms_info = $this->database_helper->get_available_dbms($dbms);
 
 		// Get schema data from file
-		$sql_query = @file_get_contents('schemas/schema_data.sql');
+		$sql_query = @file_get_contents($this->phpbb_root_path . 'phpbb/install/schemas/schema_data.sql');
 
 		// Clean up SQL
 		$sql_query = $this->replace_dbms_specific_sql($sql_query);
-- 
cgit v1.2.1


From 08d9d567ca9fb52b18be5d8f709ba7b1699fd34f Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Fri, 19 Jun 2015 01:26:15 +0200
Subject: [ticket/13740] Fix database installation

PHPBB3-13740
---
 .../phpbb/install/module/install_database/task/add_default_data.php | 5 +----
 phpBB/phpbb/install/module/install_database/task/create_schema.php  | 6 +++---
 2 files changed, 4 insertions(+), 7 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index 44b614f4de..1e1eb10403 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -65,10 +65,7 @@ class add_default_data extends \phpbb\install\task_base
 								\phpbb\language\language $language,
 								$root_path)
 	{
-		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
-		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
-
-		$this->db				= $container->get('dbal.conn');
+		$this->db				= $container->get('dbal.conn.driver');
 		$this->database_helper	= $db_helper;
 		$this->config			= $config;
 		$this->iohandler		= $iohandler;
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index 7cc521eee8..556bfd5e81 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -119,7 +119,7 @@ class create_schema extends \phpbb\install\task_base
 			}
 		}
 
-		$db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
+		$db_schema_path = $this->phpbb_root_path . 'phpbb/install/schemas/' . $schema_name . '_schema.sql';
 
 		// Load database vendor specific code if there is any
 		if ($this->filesystem->exists($db_schema_path))
@@ -144,9 +144,9 @@ class create_schema extends \phpbb\install\task_base
 		$change_prefix = false;
 
 		// Generate database schema
-		if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json'))
+		if ($this->filesystem->exists($this->phpbb_root_path . 'phpbb/install/schemas/schema.json'))
 		{
-			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json');
+			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'phpbb/install/schemas/schema.json');
 			$db_table_schema = json_decode($db_table_schema, true);
 			$change_prefix = true;
 		}
-- 
cgit v1.2.1


From 6eb284b23af0568922e787e5875dc1ee8783e71f Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Wed, 29 Jul 2015 20:24:52 +0200
Subject: [ticket/14056] Keep install schema resources in the install folder

PHPBB3-14056
---
 phpBB/phpbb/install/module/install_database/task/add_default_data.php | 2 +-
 phpBB/phpbb/install/module/install_database/task/create_schema.php    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index 1e1eb10403..3d73a74618 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -87,7 +87,7 @@ class add_default_data extends \phpbb\install\task_base
 		$dbms_info = $this->database_helper->get_available_dbms($dbms);
 
 		// Get schema data from file
-		$sql_query = @file_get_contents($this->phpbb_root_path . 'phpbb/install/schemas/schema_data.sql');
+		$sql_query = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema_data.sql');
 
 		// Clean up SQL
 		$sql_query = $this->replace_dbms_specific_sql($sql_query);
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index 556bfd5e81..cbec5edb6d 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -144,9 +144,9 @@ class create_schema extends \phpbb\install\task_base
 		$change_prefix = false;
 
 		// Generate database schema
-		if ($this->filesystem->exists($this->phpbb_root_path . 'phpbb/install/schemas/schema.json'))
+		if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json'))
 		{
-			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'phpbb/install/schemas/schema.json');
+			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json');
 			$db_table_schema = json_decode($db_table_schema, true);
 			$change_prefix = true;
 		}
-- 
cgit v1.2.1


From 4ae83e426663d129d7068b312097ad968242f41f Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Wed, 29 Jul 2015 22:08:37 +0200
Subject: [ticket/14056] Fix remaining schema path

PHPBB3-14056
---
 phpBB/phpbb/install/module/install_database/task/create_schema.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index cbec5edb6d..7cc521eee8 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -119,7 +119,7 @@ class create_schema extends \phpbb\install\task_base
 			}
 		}
 
-		$db_schema_path = $this->phpbb_root_path . 'phpbb/install/schemas/' . $schema_name . '_schema.sql';
+		$db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
 
 		// Load database vendor specific code if there is any
 		if ($this->filesystem->exists($db_schema_path))
-- 
cgit v1.2.1


From 597297b169e2ae14684ad1f40c8e083be22b241d Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Sun, 18 Oct 2015 22:47:04 +0200
Subject: [ticket/14044] Deduplicate the installers

PHPBB3-14044
---
 .../install/module/install_database/task/create_schema.php  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index 7cc521eee8..cabb78787f 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -80,6 +80,16 @@ class create_schema extends \phpbb\install\task_base
 		$factory = new \phpbb\db\tools\factory();
 
 		$this->db				= new $dbms();
+		$this->db->sql_connect(
+			$config->get('dbhost'),
+			$config->get('dbuser'),
+			$config->get('dbpasswd'),
+			$config->get('dbname'),
+			$config->get('dbport'),
+			false,
+			false
+		);
+
 		$this->config			= $config;
 		$this->db_tools			= $factory->get($this->db);
 		$this->database_helper	= $db_helper;
@@ -89,9 +99,6 @@ class create_schema extends \phpbb\install\task_base
 		$this->php_ext			= $php_ext;
 
 		parent::__construct(true);
-
-		// Connect to DB
-		$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
 	}
 
 	/**
-- 
cgit v1.2.1


From 719f42c54a45ab669a983964c1e8a6f75a4d4b02 Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Fri, 30 Oct 2015 15:46:39 +0100
Subject: [ticket/14044] Fix language selection data loss

PHPBB3-14044
---
 .../phpbb/install/module/install_database/task/add_config_settings.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 25da36e01d..6fb03ff73d 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -233,7 +233,7 @@ class add_config_settings extends \phpbb\install\task_base
 				SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',
 					user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "',
 					user_ip = '" . $this->db->sql_escape($user_ip) . "',
-					user_lang = '" . $this->db->sql_escape($this->install_config->get('language')) . "',
+					user_lang = '" . $this->db->sql_escape($this->install_config->get('user_language', 'en')) . "',
 					user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "',
 					user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "',
 					user_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ",
-- 
cgit v1.2.1


From 8f4889da58e0aa4779ec6bf7c0e747c26a13aee3 Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Tue, 2 Feb 2016 17:16:15 +0100
Subject: [ticket/14445] Force refresh before schema generation

PHPBB3-14445
---
 .../install/module/install_database/task/create_schema.php  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index cabb78787f..a5635d5dbe 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -13,6 +13,8 @@
 
 namespace phpbb\install\module\install_database\task;
 
+use phpbb\install\exception\resource_limit_reached_exception;
+
 /**
  * Create database schema
  */
@@ -106,6 +108,17 @@ class create_schema extends \phpbb\install\task_base
 	 */
 	public function run()
 	{
+		// As this task may take a large amount of time to complete refreshing the page might be necessary for some
+		// server configurations with limited resources
+		if (!$this->config->get('pre_schema_forced_refresh'))
+		{
+			if ($this->config->get_time_remaining() < 5)
+			{
+				$this->config->set('pre_schema_forced_refresh', true);
+				throw new resource_limit_reached_exception();
+			}
+		}
+
 		$this->db->sql_return_on_error(true);
 
 		$dbms = $this->config->get('dbms');
-- 
cgit v1.2.1


From 68091561abef2c2f0674e3a461401f10f2ef5a25 Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Fri, 12 Feb 2016 14:20:04 +0100
Subject: [ticket/14462] Refactor tasks to be more modular

PHPBB3-14462
---
 .../install_database/task/add_config_settings.php  |  20 +++
 .../install_database/task/add_default_data.php     |  21 +++
 .../module/install_database/task/add_tables.php    | 151 +++++++++++++++++++
 .../install_database/task/create_schema_file.php   | 164 +++++++++++++++++++++
 .../install_database/task/set_up_database.php      | 164 +++++++++++++++++++++
 5 files changed, 520 insertions(+)
 create mode 100644 phpBB/phpbb/install/module/install_database/task/add_tables.php
 create mode 100644 phpBB/phpbb/install/module/install_database/task/create_schema_file.php
 create mode 100644 phpBB/phpbb/install/module/install_database/task/set_up_database.php

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 6fb03ff73d..5fd99638c2 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -13,6 +13,8 @@
 
 namespace phpbb\install\module\install_database\task;
 
+use phpbb\install\exception\resource_limit_reached_exception;
+
 /**
  * Create database schema
  */
@@ -313,6 +315,10 @@ class add_config_settings extends \phpbb\install\task_base
 				WHERE config_name = 'allow_avatar_upload'";
 		}
 
+		$i = $this->install_config->get('add_config_settings_index', 0);
+		$total = sizeof($sql_ary);
+		$sql_ary = array_slice($sql_ary, $i);
+
 		foreach ($sql_ary as $sql)
 		{
 			if (!$this->db->sql_query($sql))
@@ -320,6 +326,20 @@ class add_config_settings extends \phpbb\install\task_base
 				$error = $this->db->sql_error($this->db->get_sql_error_sql());
 				$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
 			}
+
+			$i++;
+
+			// Run until there are available resources
+			if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)
+			{
+				break;
+			}
+		}
+
+		if ($i < $total)
+		{
+			$this->install_config->set('add_config_settings_index', $i);
+			throw new resource_limit_reached_exception();
 		}
 	}
 
diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index 3d73a74618..dd1829e6ed 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -13,6 +13,8 @@
 
 namespace phpbb\install\module\install_database\task;
 
+use phpbb\install\exception\resource_limit_reached_exception;
+
 /**
  * Create database schema
  */
@@ -96,6 +98,10 @@ class add_default_data extends \phpbb\install\task_base
 		$sql_query = $this->database_helper->remove_comments($sql_query);
 		$sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']);
 
+		$i = $this->config->get('add_default_data_index', 0);
+		$total = sizeof($sql_query);
+		$sql_query = array_slice($sql_query, $i);
+
 		foreach ($sql_query as $sql)
 		{
 			if (!$this->db->sql_query($sql))
@@ -103,6 +109,21 @@ class add_default_data extends \phpbb\install\task_base
 				$error = $this->db->sql_error($this->db->get_sql_error_sql());
 				$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
 			}
+
+			$i++;
+
+			// Run until there are available resources
+			if ($this->config->get_time_remaining() <= 0 || $this->config->get_memory_remaining() <= 0)
+			{
+				break;
+			}
+		}
+
+		$this->config->set('add_default_data_index', $i);
+
+		if ($i < $total)
+		{
+			throw new resource_limit_reached_exception();
 		}
 	}
 
diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php
new file mode 100644
index 0000000000..a0b19950be
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php
@@ -0,0 +1,151 @@
+<?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_database\task;
+
+use phpbb\install\exception\resource_limit_reached_exception;
+
+/**
+ * Create tables
+ */
+class add_tables extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $config;
+
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\db\tools\tools_interface
+	 */
+	protected $db_tools;
+
+	/**
+	 * @var \phpbb\filesystem\filesystem_interface
+	 */
+	protected $filesystem;
+
+	/**
+	 * @var string
+	 */
+	protected $schema_file_path;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\install\helper\config				$config
+	 * @param \phpbb\install\helper\database			$db_helper
+	 * @param \phpbb\filesystem\filesystem_interface	$filesystem
+	 * @param string									$phpbb_root_path
+	 */
+	public function __construct(\phpbb\install\helper\config $config,
+								\phpbb\install\helper\database $db_helper,
+								\phpbb\filesystem\filesystem_interface $filesystem,
+								$phpbb_root_path)
+	{
+		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
+		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
+		$factory = new \phpbb\db\tools\factory();
+
+		$this->db				= new $dbms();
+		$this->db->sql_connect(
+			$config->get('dbhost'),
+			$config->get('dbuser'),
+			$config->get('dbpasswd'),
+			$config->get('dbname'),
+			$config->get('dbport'),
+			false,
+			false
+		);
+
+		$this->config			= $config;
+		$this->db_tools			= $factory->get($this->db);
+		$this->filesystem		= $filesystem;
+		$this->schema_file_path	= $phpbb_root_path . 'store/schema.json';
+
+		parent::__construct(true);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		$this->db->sql_return_on_error(true);
+
+		$table_prefix = $this->config->get('table_prefix');
+		$change_prefix = $this->config->get('change_table_prefix', true);
+
+		if (!defined('CONFIG_TABLE'))
+		{
+			// CONFIG_TABLE is required by sql_create_index() to check the
+			// length of index names. However table_prefix is not defined
+			// here yet, so we need to create the constant ourselves.
+			define('CONFIG_TABLE', $table_prefix . 'config');
+		}
+
+		$db_table_schema = @file_get_contents($this->schema_file_path);
+		$db_table_schema = json_decode($db_table_schema, true);
+		$total = sizeof($db_table_schema);
+		$i = $this->config->get('add_table_index', 0);
+		$db_table_schema = array_slice($db_table_schema, $i);
+
+		foreach ($db_table_schema as $table_name => $table_data)
+		{
+			$i++;
+
+			$this->db_tools->sql_create_table(
+				( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ),
+				$table_data
+			);
+
+			// Run until there are available resources
+			if ($this->config->get_time_remaining() <= 0 || $this->config->get_memory_remaining() <= 0)
+			{
+				break;
+			}
+		}
+
+		$this->config->set('add_table_index', $i);
+
+		if ($i < $total)
+		{
+			throw new resource_limit_reached_exception();
+		}
+		else
+		{
+			@unlink($this->schema_file_path);
+		}
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_CREATE_TABLES';
+	}
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema_file.php b/phpBB/phpbb/install/module/install_database/task/create_schema_file.php
new file mode 100644
index 0000000000..b6d6ece17f
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema_file.php
@@ -0,0 +1,164 @@
+<?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_database\task;
+
+use phpbb\install\exception\resource_limit_reached_exception;
+
+/**
+ * Create database schema
+ */
+class create_schema_file extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $config;
+
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\filesystem\filesystem_interface
+	 */
+	protected $filesystem;
+
+	/**
+	 * @var string
+	 */
+	protected $phpbb_root_path;
+
+	/**
+	 * @var string
+	 */
+	protected $php_ext;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\install\helper\config							$config				Installer's config provider
+	 * @param \phpbb\install\helper\database						$db_helper			Installer's database helper
+	 * @param \phpbb\filesystem\filesystem_interface				$filesystem			Filesystem service
+	 * @param string												$phpbb_root_path	Path phpBB's root
+	 * @param string												$php_ext			Extension of PHP files
+	 */
+	public function __construct(\phpbb\install\helper\config $config,
+								\phpbb\install\helper\database $db_helper,
+								\phpbb\filesystem\filesystem_interface $filesystem,
+								$phpbb_root_path,
+								$php_ext)
+	{
+		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
+		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
+
+		$this->db				= new $dbms();
+		$this->db->sql_connect(
+			$config->get('dbhost'),
+			$config->get('dbuser'),
+			$config->get('dbpasswd'),
+			$config->get('dbname'),
+			$config->get('dbport'),
+			false,
+			false
+		);
+
+		$this->config			= $config;
+		$this->filesystem		= $filesystem;
+		$this->phpbb_root_path	= $phpbb_root_path;
+		$this->php_ext			= $php_ext;
+
+		parent::__construct(true);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		// Generate database schema
+		if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json'))
+		{
+			$db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json');
+			$this->config->set('change_table_prefix', true);
+		}
+		else
+		{
+			global $table_prefix;
+
+			// As this task may take a large amount of time to complete refreshing the page might be necessary for some
+			// server configurations with limited resources
+			if (!$this->config->get('pre_schema_forced_refresh', false))
+			{
+				if ($this->config->get_time_remaining() < 5)
+				{
+					$this->config->set('pre_schema_forced_refresh', true);
+					throw new resource_limit_reached_exception();
+				}
+			}
+
+			$table_prefix = $this->config->get('table_prefix');
+
+			if (!defined('CONFIG_TABLE'))
+			{
+				// We need to include the constants file for the table constants
+				// when we generate the schema from the migration files.
+				include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext);
+			}
+
+			$finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext);
+			$migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes();
+			$factory = new \phpbb\db\tools\factory();
+			$db_tools = $factory->get($this->db, true);
+			$schema_generator = new \phpbb\db\migration\schema_generator(
+				$migrator_classes,
+				new \phpbb\config\config(array()),
+				$this->db,
+				$db_tools,
+				$this->phpbb_root_path,
+				$this->php_ext,
+				$table_prefix
+			);
+			$db_table_schema = $schema_generator->get_schema();
+			$db_table_schema = json_encode($db_table_schema, JSON_PRETTY_PRINT);
+
+			$this->config->set('change_table_prefix', false);
+		}
+
+		$fp = @fopen($this->phpbb_root_path . 'store/schema.json', 'wb');
+		if (!$fp)
+		{
+			throw new \Exception('INST_SCHEMA_FILE_NOT_WRITABLE');
+		}
+
+		fwrite($fp, $db_table_schema);
+		fclose($fp);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_CREATE_DATABASE_SCHEMA_FILE';
+	}
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/set_up_database.php b/phpBB/phpbb/install/module/install_database/task/set_up_database.php
new file mode 100644
index 0000000000..49c8ea23ad
--- /dev/null
+++ b/phpBB/phpbb/install/module/install_database/task/set_up_database.php
@@ -0,0 +1,164 @@
+<?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_database\task;
+
+/**
+ * Set up database for table generation
+ */
+class set_up_database extends \phpbb\install\task_base
+{
+	/**
+	 * @var \phpbb\install\helper\config
+	 */
+	protected $config;
+
+	/**
+	 * @var \phpbb\db\driver\driver_interface
+	 */
+	protected $db;
+
+	/**
+	 * @var \phpbb\install\helper\database
+	 */
+	protected $database_helper;
+
+	/**
+	 * @var \phpbb\filesystem\filesystem_interface
+	 */
+	protected $filesystem;
+
+	/**
+	 * @var \phpbb\install\helper\iohandler\iohandler_interface
+	 */
+	protected $iohandler;
+
+	/**
+	 * @var string
+	 */
+	protected $schema_file_path;
+
+	/**
+	 * @var string
+	 */
+	protected $phpbb_root_path;
+
+	/**
+	 * Constructor
+	 *
+	 * @param \phpbb\install\helper\config							$config
+	 * @param \phpbb\install\helper\database						$db_helper
+	 * @param \phpbb\filesystem\filesystem_interface				$filesystem
+	 * @param \phpbb\install\helper\iohandler\iohandler_interface	$iohandler
+	 * @param string												$phpbb_root_path
+	 */
+	public function __construct(\phpbb\install\helper\config $config,
+								\phpbb\install\helper\database $db_helper,
+								\phpbb\filesystem\filesystem_interface $filesystem,
+								\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
+								$phpbb_root_path)
+	{
+		$dbms = $db_helper->get_available_dbms($config->get('dbms'));
+		$dbms = $dbms[$config->get('dbms')]['DRIVER'];
+
+		$this->db				= new $dbms();
+		$this->db->sql_connect(
+			$config->get('dbhost'),
+			$config->get('dbuser'),
+			$config->get('dbpasswd'),
+			$config->get('dbname'),
+			$config->get('dbport'),
+			false,
+			false
+		);
+
+		$this->config			= $config;
+		$this->database_helper	= $db_helper;
+		$this->filesystem		= $filesystem;
+		$this->iohandler		= $iohandler;
+		$this->phpbb_root_path	= $phpbb_root_path;
+
+		parent::__construct(false);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function check_requirements()
+	{
+		$dbms = $this->config->get('dbms');
+		$dbms_info = $this->database_helper->get_available_dbms($dbms);
+		$schema_name = $dbms_info[$dbms]['SCHEMA'];
+
+		if ($dbms === 'mysql')
+		{
+			if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
+			{
+				$schema_name .= '_41';
+			}
+			else
+			{
+				$schema_name .= '_40';
+			}
+		}
+
+		$this->schema_file_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
+
+		return $this->filesystem->exists($this->schema_file_path);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function run()
+	{
+		$this->db->sql_return_on_error(true);
+
+		$dbms = $this->config->get('dbms');
+		$dbms_info = $this->database_helper->get_available_dbms($dbms);
+		$delimiter = $dbms_info[$dbms]['DELIM'];
+		$table_prefix = $this->config->get('table_prefix');
+
+		$sql_query = @file_get_contents($this->schema_file_path);
+		$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
+		$sql_query = $this->database_helper->remove_comments($sql_query);
+		$sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter);
+
+		foreach ($sql_query as $sql)
+		{
+			if (!$this->db->sql_query($sql))
+			{
+				$error = $this->db->sql_error($this->db->get_sql_error_sql());
+				$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
+			}
+		}
+
+		unset($sql_query);
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	static public function get_step_count()
+	{
+		return 1;
+	}
+
+	/**
+	 * {@inheritdoc}
+	 */
+	public function get_task_lang_name()
+	{
+		return 'TASK_SETUP_DATABASE';
+	}
+}
-- 
cgit v1.2.1


From 2efceffaebd96fd6d092c4be8c854a7bcf032592 Mon Sep 17 00:00:00 2001
From: Mate Bartus <mate.bartus@gmail.com>
Date: Fri, 12 Feb 2016 23:30:32 +0100
Subject: [ticket/14462] Fix comments

PHPBB3-14462
---
 .../phpbb/install/module/install_database/task/add_config_settings.php  | 2 +-
 phpBB/phpbb/install/module/install_database/task/add_default_data.php   | 2 +-
 phpBB/phpbb/install/module/install_database/task/add_tables.php         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 5fd99638c2..20b7679ec1 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -329,7 +329,7 @@ class add_config_settings extends \phpbb\install\task_base
 
 			$i++;
 
-			// Run until there are available resources
+			// Stop execution if resource limit is reached
 			if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)
 			{
 				break;
diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index dd1829e6ed..f5157637ee 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -112,7 +112,7 @@ class add_default_data extends \phpbb\install\task_base
 
 			$i++;
 
-			// Run until there are available resources
+			// Stop execution if resource limit is reached
 			if ($this->config->get_time_remaining() <= 0 || $this->config->get_memory_remaining() <= 0)
 			{
 				break;
diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php
index a0b19950be..f344f91582 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_tables.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php
@@ -114,7 +114,7 @@ class add_tables extends \phpbb\install\task_base
 				$table_data
 			);
 
-			// Run until there are available resources
+			// Stop execution if resource limit is reached
 			if ($this->config->get_time_remaining() <= 0 || $this->config->get_memory_remaining() <= 0)
 			{
 				break;
-- 
cgit v1.2.1


From 99196a42f201b716243fbc72554e4e0e31830472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= <mate.bartus@gmail.com>
Date: Sun, 27 Mar 2016 19:25:00 +0200
Subject: [ticket/14564] Fix cookie domain calculation

PHPBB3-14564
---
 .../install/module/install_database/task/add_config_settings.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 20b7679ec1..7a2df01de6 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -129,12 +129,19 @@ class add_config_settings extends \phpbb\install\task_base
 		$this->db->sql_return_on_error(true);
 
 		$server_name	= $this->install_config->get('server_name');
-		$cookie_domain	= $this->install_config->get('cookie_domain');
 		$current_time 	= time();
 		$user_ip		= phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR'));
 		$user_ip		= ($user_ip === false) ? '' : $user_ip;
 		$referer		= $this->iohandler->get_server_variable('REFERER');
 
+		// Calculate cookie domain
+		$cookie_domain = $server_name;
+
+		if (strpos($cookie_domain, 'www.') === 0)
+		{
+			$cookie_domain = substr($cookie_domain, 3);
+		}
+
 		// Set default config and post data, this applies to all DB's
 		$sql_ary = array(
 			'INSERT INTO ' . $this->config_table . " (config_name, config_value)
-- 
cgit v1.2.1


From 9c34594bc374eeeca5d79afe2d3fdffae0cd1553 Mon Sep 17 00:00:00 2001
From: Derek Held <Derek Held>
Date: Sat, 14 May 2016 09:19:26 -0700
Subject: [ticket/14595] Added smtp_port where places where smtp_host exists.
 PHPBB3-14595

---
 .../install/module/install_database/task/add_config_settings.php      | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 7a2df01de6..8002e3ed97 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -190,6 +190,10 @@ class add_config_settings extends \phpbb\install\task_base
 				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "'
 				WHERE config_name = 'smtp_host'",
 
+			'UPDATE ' . $this->config_table . "
+				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_port')) . "'
+				WHERE config_name = 'smtp_port'",
+
 			'UPDATE ' . $this->config_table . "
 				SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "'
 				WHERE config_name = 'smtp_auth_method'",
-- 
cgit v1.2.1


From c64b8102b7c5dc5bd0be9d8085d01a66e90dde73 Mon Sep 17 00:00:00 2001
From: Jakub Senko <jakubsenko@gmail.com>
Date: Tue, 29 Mar 2016 21:21:35 +0200
Subject: [ticket/10809] Remove MSSQL support

PHPBB3-10809
---
 phpBB/phpbb/install/module/install_database/task/add_default_data.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index f5157637ee..e32101a3f7 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -134,7 +134,7 @@ class add_default_data extends \phpbb\install\task_base
 	 */
 	protected function replace_dbms_specific_sql($query)
 	{
-		if ($this->db instanceof \phpbb\db\driver\mssql_base || $this->db instanceof \phpbb\db\driver\mssql)
+		if ($this->db instanceof \phpbb\db\driver\mssql_base)
 		{
 			$query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $query);
 		}
-- 
cgit v1.2.1


From f8fbe3793680af1dae2db2829cfc84068831c52f Mon Sep 17 00:00:00 2001
From: rxu <rxu@mail.ru>
Date: Wed, 28 Jun 2017 00:58:03 +0700
Subject: [ticket/14972] replace all occurrences of sizeof() with the count()

PHPBB3-14972
---
 .../phpbb/install/module/install_database/task/add_config_settings.php  | 2 +-
 phpBB/phpbb/install/module/install_database/task/add_default_data.php   | 2 +-
 phpBB/phpbb/install/module/install_database/task/add_tables.php         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 8002e3ed97..54114e3f9c 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -327,7 +327,7 @@ class add_config_settings extends \phpbb\install\task_base
 		}
 
 		$i = $this->install_config->get('add_config_settings_index', 0);
-		$total = sizeof($sql_ary);
+		$total = count($sql_ary);
 		$sql_ary = array_slice($sql_ary, $i);
 
 		foreach ($sql_ary as $sql)
diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
index e32101a3f7..c05e5321fb 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php
@@ -99,7 +99,7 @@ class add_default_data extends \phpbb\install\task_base
 		$sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']);
 
 		$i = $this->config->get('add_default_data_index', 0);
-		$total = sizeof($sql_query);
+		$total = count($sql_query);
 		$sql_query = array_slice($sql_query, $i);
 
 		foreach ($sql_query as $sql)
diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php
index f344f91582..dc814f36ef 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_tables.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php
@@ -101,7 +101,7 @@ class add_tables extends \phpbb\install\task_base
 
 		$db_table_schema = @file_get_contents($this->schema_file_path);
 		$db_table_schema = json_decode($db_table_schema, true);
-		$total = sizeof($db_table_schema);
+		$total = count($db_table_schema);
 		$i = $this->config->get('add_table_index', 0);
 		$db_table_schema = array_slice($db_table_schema, $i);
 
-- 
cgit v1.2.1


From d753351edc04a45c61411ee09607fb932d314617 Mon Sep 17 00:00:00 2001
From: Derky <derky@phpbb.com>
Date: Tue, 23 Oct 2018 23:51:55 +0200
Subject: [ticket/security/227] Replace ImageMagick support with thumbnail
 event

SECURITY-227
---
 .../install/module/install_database/task/add_config_settings.php      | 4 ----
 1 file changed, 4 deletions(-)

(limited to 'phpBB/phpbb/install/module/install_database')

diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
index 54114e3f9c..ba439609ff 100644
--- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
+++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php
@@ -150,10 +150,6 @@ class add_config_settings extends \phpbb\install\task_base
 			'INSERT INTO ' . $this->config_table . " (config_name, config_value)
 				VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')",
 
-			'UPDATE ' . $this->config_table . "
-				SET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "'
-				WHERE config_name = 'img_imagick'",
-
 			'UPDATE ' . $this->config_table . "
 				SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "'
 				WHERE config_name = 'server_name'",
-- 
cgit v1.2.1