diff options
Diffstat (limited to 'phpBB/install')
| -rw-r--r-- | phpBB/install/convertors/convert_phpbb20.php | 4 | ||||
| -rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 47 | ||||
| -rw-r--r-- | phpBB/install/data/confusables.php | 8 | ||||
| -rw-r--r-- | phpBB/install/data/new_normalizer.php | 197 | ||||
| -rw-r--r-- | phpBB/install/database_update.php | 41 | ||||
| -rw-r--r-- | phpBB/install/index.php | 66 | ||||
| -rw-r--r-- | phpBB/install/install_convert.php | 101 | ||||
| -rw-r--r-- | phpBB/install/install_install.php | 185 | ||||
| -rw-r--r-- | phpBB/install/install_update.php | 76 | ||||
| -rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 | 
10 files changed, 313 insertions, 414 deletions
| diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 990b3136fd..553d873b25 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -233,11 +233,11 @@ if (!$get_info)  		$user_id = (int) $src_db->sql_fetchfield('max_user_id');  		$src_db->sql_freeresult($result); -		set_config('increment_user_id', ($user_id + 1), true); +		$config->set('increment_user_id', ($user_id + 1), false);  	}  	else  	{ -		set_config('increment_user_id', 0, true); +		$config->set('increment_user_id', 0, false);  	}  	// Overwrite maximum avatar width/height diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 817c007274..48cff426b8 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -514,12 +514,12 @@ function phpbb_user_id($user_id)  		// If there is a user id 1, we need to increment user ids. :/  		if ($id === 1)  		{ -			set_config('increment_user_id', ($max_id + 1), true); +			$config->set('increment_user_id', ($max_id + 1), false);  			$config['increment_user_id'] = $max_id + 1;  		}  		else  		{ -			set_config('increment_user_id', 0, true); +			$config->set('increment_user_id', 0, false);  			$config['increment_user_id'] = 0;  		}  	} @@ -1682,29 +1682,29 @@ function phpbb_import_attach_config()  	}  	$src_db->sql_freeresult($result); -	set_config('allow_attachments', 1); +	$config->set('allow_attachments', 1);  	// old attachment mod? Must be very old if this entry do not exist...  	if (!empty($attach_config['display_order']))  	{ -		set_config('display_order', $attach_config['display_order']); -	} -	set_config('max_filesize', $attach_config['max_filesize']); -	set_config('max_filesize_pm', $attach_config['max_filesize_pm']); -	set_config('attachment_quota', $attach_config['attachment_quota']); -	set_config('max_attachments', $attach_config['max_attachments']); -	set_config('max_attachments_pm', $attach_config['max_attachments_pm']); -	set_config('allow_pm_attach', $attach_config['allow_pm_attach']); - -	set_config('img_display_inlined', $attach_config['img_display_inlined']); -	set_config('img_max_width', $attach_config['img_max_width']); -	set_config('img_max_height', $attach_config['img_max_height']); -	set_config('img_link_width', $attach_config['img_link_width']); -	set_config('img_link_height', $attach_config['img_link_height']); -	set_config('img_create_thumbnail', $attach_config['img_create_thumbnail']); -	set_config('img_max_thumb_width', 400); -	set_config('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']); -	set_config('img_imagick', $attach_config['img_imagick']); +		$config->set('display_order', $attach_config['display_order']); +	} +	$config->set('max_filesize', $attach_config['max_filesize']); +	$config->set('max_filesize_pm', $attach_config['max_filesize_pm']); +	$config->set('attachment_quota', $attach_config['attachment_quota']); +	$config->set('max_attachments', $attach_config['max_attachments']); +	$config->set('max_attachments_pm', $attach_config['max_attachments_pm']); +	$config->set('allow_pm_attach', $attach_config['allow_pm_attach']); + +	$config->set('img_display_inlined', $attach_config['img_display_inlined']); +	$config->set('img_max_width', $attach_config['img_max_width']); +	$config->set('img_max_height', $attach_config['img_max_height']); +	$config->set('img_link_width', $attach_config['img_link_width']); +	$config->set('img_link_height', $attach_config['img_link_height']); +	$config->set('img_create_thumbnail', $attach_config['img_create_thumbnail']); +	$config->set('img_max_thumb_width', 400); +	$config->set('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']); +	$config->set('img_imagick', $attach_config['img_imagick']);  }  /** @@ -1926,7 +1926,9 @@ function phpbb_check_username_collisions()  function phpbb_convert_timezone($timezone)  {  	global $config, $db, $phpbb_root_path, $phpEx, $table_prefix; -	$timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, new \phpbb\db\tools($db), $phpbb_root_path, $phpEx, $table_prefix); + +	$factory = new \phpbb\db\tools\factory(); +	$timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, $factory->get($db), $phpbb_root_path, $phpEx, $table_prefix);  	return $timezone_migration->convert_phpbb30_timezone($timezone, 0);  } @@ -1974,6 +1976,7 @@ function phpbb_convert_password_hash($hash)  {  	global $phpbb_container; +	/* @var $manager \phpbb\passwords\manager */  	$manager = $phpbb_container->get('passwords.manager');  	$hash = $manager->hash($hash, '$H$'); diff --git a/phpBB/install/data/confusables.php b/phpBB/install/data/confusables.php index e3e8c41e62..992207c1ef 100644 --- a/phpBB/install/data/confusables.php +++ b/phpBB/install/data/confusables.php @@ -633,14 +633,8 @@ function utf8_new_case_fold_nfkc($text, $option = 'full')  	// do the case fold  	$text = utf8_new_case_fold($text, $option); -	if (!class_exists('utf_normalizer')) -	{ -		global $phpbb_root_path, $phpEx; -		include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx); -	} -  	// convert to NFKC -	utf_new_normalizer::nfkc($text); +	$text = Normalizer::normalize($text, Normalizer::NFKC);  	// FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt  	$text = strtr($text, $fc_nfkc_closure); diff --git a/phpBB/install/data/new_normalizer.php b/phpBB/install/data/new_normalizer.php deleted file mode 100644 index 52652a4f6d..0000000000 --- a/phpBB/install/data/new_normalizer.php +++ /dev/null @@ -1,197 +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. -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -/** -* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings -* to be in NFC (Normalization Form Composition). -* -* @param	mixed	$strings	a string or an array of strings to normalize -* @return	mixed				the normalized content, preserving array keys if array given. -*/ -function utf8_new_normalize_nfc($strings) -{ -	if (empty($strings)) -	{ -		return $strings; -	} - -	if (!is_array($strings)) -	{ -		utf_new_normalizer::nfc($strings); -	} -	else if (is_array($strings)) -	{ -		foreach ($strings as $key => $string) -		{ -			if (is_array($string)) -			{ -				foreach ($string as $_key => $_string) -				{ -					utf_new_normalizer::nfc($strings[$key][$_key]); -				} -			} -			else -			{ -				utf_new_normalizer::nfc($strings[$key]); -			} -		} -	} - -	return $strings; -} - -class utf_new_normalizer -{ -	/** -	* Validate, cleanup and normalize a string -	* -	* The ultimate convenience function! Clean up invalid UTF-8 sequences, -	* and convert to Normal Form C, canonical composition. -	* -	* @param	string	&$str	The dirty string -	* @return	string			The same string, all shiny and cleaned-up -	*/ -	function cleanup(&$str) -	{ -		// The string below is the list of all autorized characters, sorted by frequency in latin text -		$pos = strspn($str, "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x0D"); -		$len = strlen($str); - -		if ($pos == $len) -		{ -			// ASCII strings with no special chars return immediately -			return; -		} - -		// Note: we do not check for $GLOBALS['utf_canonical_decomp']. It is assumed they are always loaded together -		if (!isset($GLOBALS['utf_nfc_qc'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); -		} - -		if (!isset($GLOBALS['utf_canonical_decomp'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); -		} - -		// Replace any byte in the range 0x00..0x1F, except for \r, \n and \t -		// We replace those characters with a 0xFF byte, which is illegal in UTF-8 and will in turn be replaced with a UTF replacement char -		$str = strtr( -			$str, -			"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", -			"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" -		); - -		$str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); -	} - -	/** -	* Validate and normalize a UTF string to NFC -	* -	* @param	string	&$str	Unchecked UTF string -	* @return	string			The string, validated and in normal form -	*/ -	function nfc(&$str) -	{ -		$pos = strspn($str, UTF8_ASCII_RANGE); -		$len = strlen($str); - -		if ($pos == $len) -		{ -			// ASCII strings return immediately -			return; -		} - -		if (!isset($GLOBALS['utf_nfc_qc'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_nfc_qc.' . $phpEx); -		} - -		if (!isset($GLOBALS['utf_canonical_decomp'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_canonical_decomp.' . $phpEx); -		} - -		$str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfc_qc'], $GLOBALS['utf_canonical_decomp']); -	} - -	/** -	* Validate and normalize a UTF string to NFKC -	* -	* @param	string	&$str	Unchecked UTF string -	* @return	string			The string, validated and in normal form -	*/ -	function nfkc(&$str) -	{ -		$pos = strspn($str, UTF8_ASCII_RANGE); -		$len = strlen($str); - -		if ($pos == $len) -		{ -			// ASCII strings return immediately -			return; -		} - -		if (!isset($GLOBALS['utf_nfkc_qc'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx); -		} - -		if (!isset($GLOBALS['utf_compatibility_decomp'])) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx); -		} - -		$str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']); -	} - -	/** -	* Recompose a UTF string -	* -	* @param	string	$str			Unchecked UTF string -	* @param	integer	$pos			Position of the first UTF char (in bytes) -	* @param	integer	$len			Length of the string (in bytes) -	* @param	array	&$qc			Quick-check array, passed by reference but never modified -	* @param	array	&$decomp_map	Decomposition mapping, passed by reference but never modified -	* @return	string					The string, validated and recomposed -	* -	* @access	private -	*/ -	function recompose($str, $pos, $len, &$qc, &$decomp_map) -	{ -		global $utf_canonical_comp; - -		// Load the canonical composition table -		if (!isset($utf_canonical_comp)) -		{ -			global $phpbb_root_path, $phpEx; -			include($phpbb_root_path . 'includes/utf/data/utf_canonical_comp.' . $phpEx); -		} - -		return utf_normalizer::recompose($str, $pos, $len, $qc, $decomp_map); -	} -} diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 80fd40a944..853848d637 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -74,37 +74,46 @@ require($phpbb_root_path . 'includes/functions.' . $phpEx);  require($phpbb_root_path . 'includes/functions_content.' . $phpEx);  require($phpbb_root_path . 'includes/constants.' . $phpEx); -include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);  require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);  // Set PHP error handler to ours  set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');  // Set up container (must be done here because extensions table may not exist) -$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); -$phpbb_container_builder->set_use_extensions(false); -$phpbb_container_builder->set_use_kernel_pass(false); -$phpbb_container_builder->set_dump_container(false); -$phpbb_container = $phpbb_container_builder->get_container(); +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_container = $phpbb_container_builder +	->with_config($phpbb_config_php_file) +	->without_extensions() +	->without_cache() +	->get_container() +;  // set up caching +/* @var $cache \phpbb\cache\service */  $cache = $phpbb_container->get('cache');  // Instantiate some basic classes +/* @var $phpbb_dispatcher \phpbb\event\dispatcher */  $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + +/* @var $request \phpbb\request\request_interface */  $request	= $phpbb_container->get('request'); + +/* @var $user \phpbb\user */  $user		= $phpbb_container->get('user'); + +/* @var $auth \phpbb\auth\auth */  $auth		= $phpbb_container->get('auth'); + +/* @var $db \phpbb\db\driver\driver_interface */  $db			= $phpbb_container->get('dbal.conn'); -$phpbb_log	= $phpbb_container->get('log'); -// make sure request_var uses this request instance -request_var('', 0, false, false, $request); // "dependency injection" for a function +/* @var $phpbb_log \phpbb\log\log_interface */ +$phpbb_log	= $phpbb_container->get('log');  // Grab global variables, re-cache if necessary +/* @var $config \phpbb\config\config */  $config = $phpbb_container->get('config'); -set_config(null, null, null, $config); -set_config_count(null, null, null, $config);  if (!isset($config['version_update_from']))  { @@ -121,6 +130,7 @@ if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))  	require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);  	$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); +	/* @var $phpbb_hook_finder \phpbb\hook\finder */  	$phpbb_hook_finder = $phpbb_container->get('hook_finder');  	foreach ($phpbb_hook_finder->find() as $hook)  	{ @@ -173,11 +183,16 @@ define('IN_DB_UPDATE', true);  // End startup code +/* @var $migrator \phpbb\db\migrator */  $migrator = $phpbb_container->get('migrator'); -$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log')); + +/** @var \phpbb\filesystem\filesystem_interface $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_container->get('filesystem'); +$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log', $phpbb_filesystem));  $migrator->create_migrations_table(); +/* @var $phpbb_extension_manager \phpbb\extension\manager */  $phpbb_extension_manager = $phpbb_container->get('ext.manager');  $migrations = $phpbb_extension_manager @@ -231,7 +246,7 @@ while (!$migrator->finished())  if ($orig_version != $config['version'])  { -	add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']); +	$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_DATABASE', false, array($orig_version, $config['version']));  }  echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />'; diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 5c16421499..3559a10971 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -16,14 +16,15 @@  */  define('IN_PHPBB', true);  define('IN_INSTALL', true); +define('PHPBB_ENVIRONMENT', 'production');  /**#@-*/  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';  $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (version_compare(PHP_VERSION, '5.3.3') < 0) +if (version_compare(PHP_VERSION, '5.3.9') < 0)  { -	die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.3 or higher before trying to install phpBB 3.1'); +	die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.9 or higher before trying to install phpBB 3.1');  }  function phpbb_require_updated($path, $optional = false) @@ -102,7 +103,6 @@ phpbb_require_updated('includes/functions.' . $phpEx);  phpbb_require_updated('includes/functions_content.' . $phpEx, true);  phpbb_include_updated('includes/functions_admin.' . $phpEx); -phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx);  phpbb_include_updated('includes/utf/utf_tools.' . $phpEx);  phpbb_require_updated('includes/functions_install.' . $phpEx); @@ -116,18 +116,18 @@ $phpbb_class_loader_ext->register();  // Set up container  $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); -$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); -$phpbb_container_builder->set_use_extensions(false); -$phpbb_container_builder->set_dump_container(false); -$phpbb_container_builder->set_use_custom_pass(false); -$phpbb_container_builder->set_inject_config(false); -$phpbb_container_builder->set_compile_container(false); +$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_container_builder +	->without_extensions() +	->without_cache() +	->without_compiled_container() +;  $other_config_path = $phpbb_root_path . 'install/update/new/config/';  $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; -$phpbb_container_builder->set_config_path($config_path); +$phpbb_container_builder->with_config_path($config_path); -$phpbb_container_builder->set_custom_parameters(array( +$phpbb_container_builder->with_custom_parameters(array(  	'core.root_path'			=> $phpbb_root_path,  	'core.adm_relative_path'	=> $phpbb_adm_relative_path,  	'core.php_ext'				=> $phpEx, @@ -137,16 +137,18 @@ $phpbb_container_builder->set_custom_parameters(array(  $phpbb_container = $phpbb_container_builder->get_container();  $phpbb_container->register('dbal.conn.driver')->setSynthetic(true); +$phpbb_container->register('template.twig.environment')->setSynthetic(true); +$phpbb_container->register('language.loader')->setSynthetic(true);  $phpbb_container->compile();  $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));  $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); +/* @var $phpbb_dispatcher \phpbb\event\dispatcher */  $phpbb_dispatcher = $phpbb_container->get('dispatcher'); -$request	= $phpbb_container->get('request'); -// make sure request_var uses this request instance -request_var('', 0, false, false, $request); // "dependency injection" for a function +/* @var $request \phpbb\request\request_interface */ +$request	= $phpbb_container->get('request');  // Try and load an appropriate language if required  $language = basename($request->variable('language', '')); @@ -240,7 +242,8 @@ $sub = $request->variable('sub', '');  // Set PHP error handler to ours  set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); -$user = new \phpbb\user('\phpbb\datetime'); +$lang_service = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); +$user = new \phpbb\user($lang_service, '\phpbb\datetime');  $auth = new \phpbb\auth\auth();  // Add own hook handler, if present. :o @@ -249,6 +252,7 @@ if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))  	require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);  	$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); +	/* @var $phpbb_hook_finder \phpbb\hook\finder */  	$phpbb_hook_finder = $phpbb_container->get('hook_finder');  	foreach ($phpbb_hook_finder->find() as $hook)  	{ @@ -265,10 +269,40 @@ $config = new \phpbb\config\config(array(  	'load_tplcompile'	=> '1'  )); +/* @var $symfony_request \phpbb\symfony_request */  $symfony_request = $phpbb_container->get('symfony_request'); + +/* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */  $phpbb_filesystem = $phpbb_container->get('filesystem'); + +/* @var $phpbb_path_helper \phpbb\path_helper */  $phpbb_path_helper = $phpbb_container->get('path_helper'); -$template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context()); +$cache_path = $phpbb_root_path . 'cache/'; + +$twig_environment = new \phpbb\template\twig\environment( +	$config, +	$phpbb_filesystem, +	$phpbb_path_helper, +	$phpbb_container, +	$cache_path, +	null, +	$phpbb_container->get('template.twig.loader') +); + +$language_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); +$phpbb_container->set('template.twig.environment', $twig_environment); +$phpbb_container->set('language.loader', $language_loader); +$twig_context = new \phpbb\template\context(); +$template = new \phpbb\template\twig\twig( +	$phpbb_path_helper, +	$config, +	$twig_context, +	$twig_environment, +	$cache_path, +	$user, +	array($phpbb_container->get('template.twig.extensions.phpbb')) +); +  $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');  $paths = array_filter($paths, 'is_dir');  $template->set_custom_style(array( diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index e16c79474b..dd9835113b 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -96,6 +96,9 @@ class install_convert extends module  	/** @var string */  	protected $php_ext; +	/** @var  \phpbb\filesystem\filesystem_interface */ +	protected $filesystem; +  	/**  	* Variables used while converting, they are accessible from the global variable $convert  	*/ @@ -116,6 +119,7 @@ class install_convert extends module  		$this->template = $template;  		$this->phpbb_root_path = $phpbb_root_path;  		$this->php_ext = $phpEx; +		$this->filesystem = new \phpbb\filesystem\filesystem();  		if (!$this->check_phpbb_installed())  		{ @@ -127,10 +131,11 @@ class install_convert extends module  		// Enable super globals to prevent issues with the new \phpbb\request\request object  		$request->enable_super_globals();  		// Create a normal container now -		$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); -		$phpbb_container = $phpbb_container_builder->get_container(); +		$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +		$phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container();  		// Create cache +		/* @var $cache \phpbb\cache\service */  		$cache = $phpbb_container->get('cache');  		switch ($sub) @@ -148,13 +153,11 @@ class install_convert extends module  				unset($dbpasswd);  				// We need to fill the config to let internal functions correctly work -				$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -				set_config(null, null, null, $config); -				set_config_count(null, null, null, $config); +				$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  				// Detect if there is already a conversion in progress at this point and offer to resume  				// It's quite possible that the user will get disconnected during a large conversion so they need to be able to resume it -				$new_conversion = request_var('new_conv', 0); +				$new_conversion = $request->variable('new_conv', 0);  				if ($new_conversion)  				{ @@ -389,11 +392,9 @@ class install_convert extends module  		$this->page_title = $lang['STAGE_SETTINGS'];  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE); -		$convertor_tag = request_var('tag', ''); +		$convertor_tag = $request->variable('tag', '');  		if (empty($convertor_tag))  		{ @@ -418,20 +419,20 @@ class install_convert extends module  		$submit = (isset($_POST['submit'])) ? true : false; -		$src_dbms			= request_var('src_dbms', $convertor_data['dbms']); -		$src_dbhost			= request_var('src_dbhost', $convertor_data['dbhost']); -		$src_dbport			= request_var('src_dbport', $convertor_data['dbport']); -		$src_dbuser			= request_var('src_dbuser', $convertor_data['dbuser']); -		$src_dbpasswd		= request_var('src_dbpasswd', $convertor_data['dbpasswd']); -		$src_dbname			= request_var('src_dbname', $convertor_data['dbname']); -		$src_table_prefix	= request_var('src_table_prefix', $convertor_data['table_prefix']); -		$forum_path			= request_var('forum_path', $convertor_data['forum_path']); -		$refresh			= request_var('refresh', 1); +		$src_dbms			= $request->variable('src_dbms', $convertor_data['dbms']); +		$src_dbhost			= $request->variable('src_dbhost', $convertor_data['dbhost']); +		$src_dbport			= $request->variable('src_dbport', $convertor_data['dbport']); +		$src_dbuser			= $request->variable('src_dbuser', $convertor_data['dbuser']); +		$src_dbpasswd		= $request->variable('src_dbpasswd', $convertor_data['dbpasswd']); +		$src_dbname			= $request->variable('src_dbname', $convertor_data['dbname']); +		$src_table_prefix	= $request->variable('src_table_prefix', $convertor_data['table_prefix']); +		$forum_path			= $request->variable('forum_path', $convertor_data['forum_path']); +		$refresh			= $request->variable('refresh', 1);  		// Default URL of the old board  		// @todo Are we going to use this for attempting to convert URL references in posts, or should we remove it?  		//		-> We should convert old urls to the new relative urls format -		// $src_url = request_var('src_url', 'Not in use at the moment'); +		// $src_url = $request->variable('src_url', 'Not in use at the moment');  		// strip trailing slash from old forum path  		$forum_path = (strlen($forum_path) && $forum_path[strlen($forum_path) - 1] == '/') ? substr($forum_path, 0, -1) : $forum_path; @@ -494,7 +495,9 @@ class install_convert extends module  				{  					$prefixes = array(); -					$tables_existing = get_tables($src_db); +					$db_tools_factory = new \phpbb\db\tools\factory(); +					$db_tools = $db_tools_factory->get($src_db); +					$tables_existing = $db_tools->sql_list_tables();  					$tables_existing = array_map('strtolower', $tables_existing);  					foreach ($tables_existing as $table_name)  					{ @@ -533,24 +536,27 @@ class install_convert extends module  			if (!sizeof($error))  			{  				// Save convertor Status -				set_config('convert_progress', serialize(array( +				$config->set('convert_progress', serialize(array(  					'step'			=> '',  					'table_prefix'	=> $src_table_prefix,  					'tag'			=> $convertor_tag, -				)), true); -				set_config('convert_db_server', serialize(array( +				)), false); +				$config->set('convert_db_server', serialize(array(  					'dbms'			=> $src_dbms,  					'dbhost'		=> $src_dbhost,  					'dbport'		=> $src_dbport,  					'dbname'		=> $src_dbname, -				)), true); -				set_config('convert_db_user', serialize(array( +				)), false); +				$config->set('convert_db_user', serialize(array(  					'dbuser'		=> $src_dbuser,  					'dbpasswd'		=> $src_dbpasswd, -				)), true); +				)), false);  				// Save options -				set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true); +				$config->set('convert_options', serialize(array( +					'forum_path' => './../' . $forum_path, +					'refresh' => $refresh +				)), false);  				$template->assign_block_vars('checks', array(  					'TITLE'		=> $lang['VERIFY_OPTIONS'], @@ -633,9 +639,7 @@ class install_convert extends module  		unset($dbpasswd);  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  		// Override a couple of config variables for the duration  		$config['max_quote_depth'] = 0; @@ -787,7 +791,7 @@ class install_convert extends module  		if (!class_exists($search_type))  		{  			$search_type = '\phpbb\search\fulltext_native'; -			set_config('search_type', $search_type); +			$config->set('search_type', $search_type);  		}  		if (!class_exists($search_type)) @@ -806,10 +810,10 @@ class install_convert extends module  		include($phpbb_root_path . 'includes/message_parser.' . $phpEx);  		$message_parser = new parse_message(); -		$jump = request_var('jump', 0); -		$final_jump = request_var('final_jump', 0); -		$sync_batch = request_var('sync_batch', -1); -		$last_statement = request_var('last', 0); +		$jump = $request->variable('jump', 0); +		$final_jump = $request->variable('final_jump', 0); +		$sync_batch = $request->variable('sync_batch', -1); +		$last_statement = $request->variable('last', 0);  		// We are running sync...  		if ($sync_batch >= 0) @@ -830,9 +834,9 @@ class install_convert extends module  			return;  		} -		$current_table = request_var('current_table', 0); +		$current_table = $request->variable('current_table', 0);  		$old_current_table = min(-1, $current_table - 1); -		$skip_rows = request_var('skip_rows', 0); +		$skip_rows = $request->variable('skip_rows', 0);  		if (!$current_table && !$skip_rows)  		{ @@ -859,7 +863,7 @@ class install_convert extends module  							$this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__);  						} -						if (!$local_path || !phpbb_is_writable($phpbb_root_path . $local_path)) +						if (!$local_path || !$this->filesystem->is_writable($phpbb_root_path . $local_path))  						{  							if (!$local_path)  							{ @@ -1560,26 +1564,26 @@ class install_convert extends module  	*/  	function save_convert_progress($step)  	{ -		global $convert, $language; +		global $config, $convert, $language;  		// Save convertor Status -		set_config('convert_progress', serialize(array( +		$config->set('convert_progress', serialize(array(  			'step'			=> $step,  			'table_prefix'	=> $convert->src_table_prefix,  			'tag'			=> $convert->convertor_tag, -		)), true); +		)), false); -		set_config('convert_db_server', serialize(array( +		$config->set('convert_db_server', serialize(array(  			'dbms'			=> $convert->src_dbms,  			'dbhost'		=> $convert->src_dbhost,  			'dbport'		=> $convert->src_dbport,  			'dbname'		=> $convert->src_dbname, -		)), true); +		)), false); -		set_config('convert_db_user', serialize(array( +		$config->set('convert_db_user', serialize(array(  			'dbuser'		=> $convert->src_dbuser,  			'dbpasswd'		=> $convert->src_dbpasswd, -		)), true); +		)), false);  		return $this->p_master->module_url . "?mode={$this->mode}&sub=in_progress&tag={$convert->convertor_tag}$step&language=$language";  	} @@ -1603,8 +1607,7 @@ class install_convert extends module  		phpbb_cache_moderators($db, $cache, $auth);  		// And finally, add a note to the log -		$phpbb_log = $phpbb_container->get('log'); -		add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']); +		$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INSTALL_CONVERTED', false, array($convert->convertor_data['forum_name'], $config['version']));  		$url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language"; @@ -1759,7 +1762,7 @@ class install_convert extends module  			if (!isset($config['board_startdate']) || ($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0))  			{ -				set_config('board_startdate', $row['board_startdate']); +				$config->set('board_startdate', $row['board_startdate']);  				$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS);  			} diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 6f7fbd9d5f..b06ef0b51d 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -43,9 +43,15 @@ if (!empty($setmodules))  */  class install_install extends module  { +	/** +	 * @var \phpbb\filesystem\filesystem_interface +	 */ +	protected $filesystem; +  	function install_install(&$p_master)  	{  		$this->p_master = &$p_master; +		$this->filesystem = new \phpbb\filesystem\filesystem();  	}  	function main($mode, $sub) @@ -104,11 +110,14 @@ class install_install extends module  				$request->enable_super_globals();  				// Create a normal container now -				$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); -				$phpbb_container = $phpbb_container_builder->get_container(); +				$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +				$phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container();  				// Sets the global variables +				/* @var $cache \phpbb\cache\service */  				$cache = $phpbb_container->get('cache'); + +				/* @var $phpbb_log \phpbb\log\log_interface */  				$phpbb_log = $phpbb_container->get('log');  				$this->build_search_index($mode, $sub); @@ -154,7 +163,7 @@ class install_install extends module  		// Test the minimum PHP version  		$php_version = PHP_VERSION; -		if (version_compare($php_version, '5.3.3') < 0) +		if (version_compare($php_version, '5.3.9') < 0)  		{  			$result = '<strong style="color:red">' . $lang['NO'] . '</strong>';  		} @@ -463,13 +472,29 @@ class install_install extends module  			if (!file_exists($phpbb_root_path . $dir))  			{  				@mkdir($phpbb_root_path . $dir, 0777); -				phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); + +				try +				{ +					$this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); +				} +				catch (\phpbb\filesystem\exception\filesystem_exception $e) +				{ +					// Do nothing +				}  			}  			// Now really check  			if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))  			{ -				phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); +				try +				{ +					$this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); +				} +				catch (\phpbb\filesystem\exception\filesystem_exception $e) +				{ +					// Do nothing +				} +  				$exists = true;  			} @@ -511,7 +536,7 @@ class install_install extends module  			$write = $exists = true;  			if (file_exists($phpbb_root_path . $dir))  			{ -				if (!phpbb_is_writable($phpbb_root_path . $dir)) +				if (!$this->filesystem->is_writable($phpbb_root_path . $dir))  				{  					$write = false;  				} @@ -889,7 +914,7 @@ class install_install extends module  		$config_data = phpbb_create_config_file_data($data, $available_dbms[$data['dbms']]['DRIVER']);  		// Attempt to write out the config file directly. If it works, this is the easiest way to do it ... -		if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path)) +		if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && $this->filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx)) || $this->filesystem->is_writable($phpbb_root_path))  		{  			// Assume it will work ... if nothing goes wrong below  			$written = true; @@ -911,7 +936,14 @@ class install_install extends module  			if ($written)  			{  				// We may revert back to chmod() if we see problems with users not able to change their config.php file directly -				phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ); +				try +				{ +					$this->filesystem->phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ); +				} +				catch (\phpbb\filesystem\exception\filesystem_exception $e) +				{ +					// Do nothing +				}  			}  		} @@ -1190,12 +1222,14 @@ class install_install extends module  				include($phpbb_root_path . 'includes/constants.' . $phpEx);  			} -			$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); +			$finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path, null, $phpEx);  			$classes = $finder->core_path('phpbb/db/migration/data/')  				->get_classes();  			$sqlite_db = new \phpbb\db\driver\sqlite(); -			$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, new \phpbb\db\tools($sqlite_db, true), $phpbb_root_path, $phpEx, $table_prefix); +			$factory = new \phpbb\db\tools\factory(); +			$db_tools = $factory->get($sqlite_db, true); +			$schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix);  			$db_table_schema = $schema_generator->get_schema();  		} @@ -1207,7 +1241,8 @@ class install_install extends module  			define('CONFIG_TABLE', $data['table_prefix'] . 'config');  		} -		$db_tools = new \phpbb\db\tools($db); +		$factory = new \phpbb\db\tools\factory(); +		$db_tools = $factory->get($db);  		foreach ($db_table_schema as $table_name => $table_data)  		{  			$db_tools->sql_create_table( @@ -1487,9 +1522,7 @@ class install_install extends module  		include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  		$error = false;  		$search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); @@ -1515,12 +1548,18 @@ class install_install extends module  		// modules require an extension manager  		if (empty($phpbb_extension_manager))  		{ +			/* @var $phpbb_extension_manager \phpbb\extension\manager */  			$phpbb_extension_manager = $phpbb_container->get('ext.manager');  		} -		include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); - -		$_module = new acp_modules(); +		$_module = new \phpbb\module\module_manager( +			new \phpbb\cache\driver\dummy(), +			$db, +			$phpbb_extension_manager, +			MODULES_TABLE, +			$phpbb_root_path, +			$phpEx +		);  		$module_classes = array('acp', 'mcp', 'ucp');  		// Add categories @@ -1551,7 +1590,7 @@ class install_install extends module  				);  				// Add category -				$_module->update_module_data($module_data, true); +				$_module->update_module_data($module_data);  				// Check for last sql error happened  				if ($db->get_sql_error_triggered()) @@ -1585,7 +1624,7 @@ class install_install extends module  							'module_auth'		=> '',  						); -						$_module->update_module_data($module_data, true); +						$_module->update_module_data($module_data);  						// Check for last sql error happened  						if ($db->get_sql_error_triggered()) @@ -1601,7 +1640,7 @@ class install_install extends module  			}  			// Get the modules we want to add... returned sorted by name -			$module_info = $_module->get_module_infos('', $module_class); +			$module_info = $_module->get_module_infos($module_class);  			foreach ($module_info as $module_basename => $fileinfo)  			{ @@ -1625,7 +1664,7 @@ class install_install extends module  							'module_auth'		=> $row['auth'],  						); -						$_module->update_module_data($module_data, true); +						$_module->update_module_data($module_data);  						// Check for last sql error happened  						if ($db->get_sql_error_triggered()) @@ -1650,7 +1689,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_up', 4); +				$_module->move_module_by($row, 'acp', 'move_up', 4);  				// Move permissions intro screen module 4 up...  				$sql = 'SELECT * @@ -1662,7 +1701,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_up', 4); +				$_module->move_module_by($row, 'acp', 'move_up', 4);  				// Move manage users screen module 5 up...  				$sql = 'SELECT * @@ -1674,7 +1713,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_up', 5); +				$_module->move_module_by($row, 'acp', 'move_up', 5);  				// Move extension management module 1 up...  				$sql = 'SELECT * @@ -1687,7 +1726,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_up', 1); +				$_module->move_module_by($row, 'acp', 'move_up', 1);  			}  			if ($module_class == 'mcp') @@ -1702,7 +1741,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 3); +				$_module->move_module_by($row, 'mcp', 'move_down', 3);  				// Move closed pm reports module 3 down...  				$sql = 'SELECT * @@ -1714,7 +1753,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 3); +				$_module->move_module_by($row, 'mcp', 'move_down', 3);  				// Move open pm reports module 3 down...  				$sql = 'SELECT * @@ -1726,7 +1765,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 3); +				$_module->move_module_by($row, 'mcp', 'move_down', 3);  			}  			if ($module_class == 'ucp') @@ -1741,7 +1780,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 4); +				$_module->move_module_by($row, 'ucp', 'move_down', 4);  				// Move notification options module 4 down...  				$sql = 'SELECT * @@ -1753,7 +1792,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 4); +				$_module->move_module_by($row, 'ucp', 'move_down', 4);  				// Move OAuth module 5 down...  				$sql = 'SELECT * @@ -1765,7 +1804,7 @@ class install_install extends module  				$row = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); -				$_module->move_module_by($row, 'move_down', 5); +				$_module->move_module_by($row, 'ucp', 'move_down', 5);  			}  			// And now for the special ones @@ -1804,7 +1843,7 @@ class install_install extends module  							'module_auth'		=> $row['module_auth'],  						); -						$_module->update_module_data($module_data, true); +						$_module->update_module_data($module_data);  						// Check for last sql error happened  						if ($db->get_sql_error_triggered()) @@ -1816,7 +1855,7 @@ class install_install extends module  				}  			} -			$_module->remove_cache_file(); +			$_module->remove_cache_file($module_class);  		}  	} @@ -1903,9 +1942,7 @@ class install_install extends module  		$data = $this->get_submitted_data();  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  		$sql = 'SELECT group_id  			FROM ' . GROUPS_TABLE . " @@ -1969,7 +2006,7 @@ class install_install extends module  	*/  	function email_admin($mode, $sub)  	{ -		global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_log;  		$this->page_title = $lang['STAGE_FINAL']; @@ -1977,9 +2014,7 @@ class install_install extends module  		$data = $this->get_submitted_data();  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  		$user->session_begin();  		$auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); @@ -2010,7 +2045,7 @@ class install_install extends module  		}  		// And finally, add a note to the log -		add_log('admin', 'LOG_INSTALL_INSTALLED', $config['version']); +		$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INSTALL_INSTALLED', false, array($config['version']));  		$template->assign_vars(array(  			'TITLE'		=> $lang['INSTALL_CONGRATS'], @@ -2026,12 +2061,12 @@ class install_install extends module  	*/  	function disable_avatars_if_unwritable()  	{ -		global $phpbb_root_path; +		global $config, $phpbb_root_path; -		if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/')) +		if (!$this->filesystem->is_writable($phpbb_root_path . 'images/avatars/upload/'))  		{ -			set_config('allow_avatar', 0); -			set_config('allow_avatar_upload', 0); +			$config->set('allow_avatar', 0); +			$config->set('allow_avatar_upload', 0);  		}  	} @@ -2078,36 +2113,38 @@ class install_install extends module  	*/  	function get_submitted_data()  	{ +		global $request; +  		return array( -			'language'		=> basename(request_var('language', '')), -			'dbms'			=> request_var('dbms', ''), -			'dbhost'		=> request_var('dbhost', '', true), -			'dbport'		=> request_var('dbport', ''), -			'dbuser'		=> request_var('dbuser', ''), -			'dbpasswd'		=> request_var('dbpasswd', '', true), -			'dbname'		=> request_var('dbname', ''), -			'table_prefix'	=> request_var('table_prefix', ''), -			'default_lang'	=> basename(request_var('default_lang', '')), -			'admin_name'	=> utf8_normalize_nfc(request_var('admin_name', '', true)), -			'admin_pass1'	=> request_var('admin_pass1', '', true), -			'admin_pass2'	=> request_var('admin_pass2', '', true), -			'board_email'	=> strtolower(request_var('board_email', '')), -			'img_imagick'	=> request_var('img_imagick', ''), -			'ftp_path'		=> request_var('ftp_path', ''), -			'ftp_user'		=> request_var('ftp_user', ''), -			'ftp_pass'		=> request_var('ftp_pass', ''), -			'email_enable'	=> request_var('email_enable', ''), -			'smtp_delivery'	=> request_var('smtp_delivery', ''), -			'smtp_host'		=> request_var('smtp_host', ''), -			'smtp_auth'		=> request_var('smtp_auth', ''), -			'smtp_user'		=> request_var('smtp_user', ''), -			'smtp_pass'		=> request_var('smtp_pass', ''), -			'cookie_secure'	=> request_var('cookie_secure', ''), -			'force_server_vars'	=> request_var('force_server_vars', ''), -			'server_protocol'	=> request_var('server_protocol', ''), -			'server_name'	=> request_var('server_name', ''), -			'server_port'	=> request_var('server_port', ''), -			'script_path'	=> request_var('script_path', ''), +			'language'		=> basename($request->variable('language', '')), +			'dbms'			=> $request->variable('dbms', ''), +			'dbhost'		=> $request->variable('dbhost', ''), +			'dbport'		=> $request->variable('dbport', ''), +			'dbuser'		=> $request->variable('dbuser', ''), +			'dbpasswd'		=> $request->variable('dbpasswd', '', true), +			'dbname'		=> $request->variable('dbname', ''), +			'table_prefix'	=> $request->variable('table_prefix', ''), +			'default_lang'	=> basename($request->variable('default_lang', '')), +			'admin_name'	=> $request->variable('admin_name', '', true), +			'admin_pass1'	=> $request->variable('admin_pass1', '', true), +			'admin_pass2'	=> $request->variable('admin_pass2', '', true), +			'board_email'	=> strtolower($request->variable('board_email', '')), +			'img_imagick'	=> $request->variable('img_imagick', ''), +			'ftp_path'		=> $request->variable('ftp_path', ''), +			'ftp_user'		=> $request->variable('ftp_user', ''), +			'ftp_pass'		=> $request->variable('ftp_pass', ''), +			'email_enable'	=> $request->variable('email_enable', ''), +			'smtp_delivery'	=> $request->variable('smtp_delivery', ''), +			'smtp_host'		=> $request->variable('smtp_host', ''), +			'smtp_auth'		=> $request->variable('smtp_auth', ''), +			'smtp_user'		=> $request->variable('smtp_user', ''), +			'smtp_pass'		=> $request->variable('smtp_pass', ''), +			'cookie_secure'	=> $request->variable('cookie_secure', ''), +			'force_server_vars'	=> $request->variable('force_server_vars', ''), +			'server_protocol'	=> $request->variable('server_protocol', ''), +			'server_name'	=> $request->variable('server_name', ''), +			'server_port'	=> $request->variable('server_port', ''), +			'script_path'	=> $request->variable('script_path', ''),  		);  	} diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 82ca0fc18d..d9ba2e7fe9 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -55,6 +55,8 @@ class install_update extends module  	var $update_to_version; +	protected $filesystem; +  	// Set to false  	var $test_update = false; @@ -74,18 +76,25 @@ class install_update extends module  		$request->enable_super_globals();  		// Create a normal container now -		$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); -		$phpbb_container_builder->set_dump_container(false); -		$phpbb_container_builder->set_use_extensions(false); +		$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +		$phpbb_container = $phpbb_container_builder +			->with_config($phpbb_config_php_file) +			->without_cache() +			->without_extensions() +		; +  		if (file_exists($phpbb_root_path . 'install/update/new/config'))  		{ -			$phpbb_container_builder->set_config_path($phpbb_root_path . 'install/update/new/config'); +			$phpbb_container_builder->with_config_path($phpbb_root_path . 'install/update/new/config');  		}  		$phpbb_container = $phpbb_container_builder->get_container();  		// Writes into global $cache +		/* @var $cache \phpbb\cache\service */  		$cache = $phpbb_container->get('cache'); +		$this->filesystem = $phpbb_container->get('filesystem'); +  		$this->tpl_name = 'install_update';  		$this->page_title = 'UPDATE_INSTALLATION'; @@ -113,9 +122,7 @@ class install_update extends module  		unset($dbpasswd);  		// We need to fill the config to let internal functions correctly work -		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE); -		set_config(null, null, null, $config); -		set_config_count(null, null, null, $config); +		$config = new \phpbb\config\db($db, new \phpbb\cache\driver\dummy, CONFIG_TABLE);  		// Force template recompile  		$config['load_tplcompile'] = 1; @@ -161,6 +168,7 @@ class install_update extends module  		));  		// Get current and latest version +		/* @var $version_helper \phpbb\version_helper */  		$version_helper = $phpbb_container->get('version_helper');  		try  		{ @@ -234,7 +242,7 @@ class install_update extends module  		// Fill DB version  		if (empty($config['dbms_version']))  		{ -			set_config('dbms_version', $db->sql_server_info(true)); +			$config->set('dbms_version', $db->sql_server_info(true));  		}  		if ($this->test_update === false) @@ -351,7 +359,7 @@ class install_update extends module  				$this->page_title = 'STAGE_FILE_CHECK';  				// Now make sure our update list is correct if the admin refreshes -				$action = request_var('action', ''); +				$action = $request->variable('action', '');  				// We are directly within an update. To make sure our update list is correct we check its status.  				$update_list = ($request->variable('check_again', false, false, \phpbb\request\request_interface::POST)) ? false : $cache->get('_update_list'); @@ -519,6 +527,8 @@ class install_update extends module  				if ($all_up_to_date)  				{  					global $phpbb_container; + +					/* @var $phpbb_log \phpbb\log\log_interface */  					$phpbb_log = $phpbb_container->get('log');  					// Add database update to log @@ -539,8 +549,8 @@ class install_update extends module  				$s_hidden_fields = '';  				$params = array(); -				$conflicts = request_var('conflict', array('' => 0)); -				$modified = request_var('modified', array('' => 0)); +				$conflicts = $request->variable('conflict', array('' => 0)); +				$modified = $request->variable('modified', array('' => 0));  				foreach ($conflicts as $filename => $merge_option)  				{ @@ -558,7 +568,7 @@ class install_update extends module  					$params[] = 'modified[' . urlencode($filename) . ']=' . urlencode($merge_option);  				} -				$no_update = request_var('no_update', array(0 => '')); +				$no_update = $request->variable('no_update', array(0 => ''));  				foreach ($no_update as $index => $filename)  				{ @@ -793,7 +803,7 @@ class install_update extends module  				{  					$this->include_file('includes/functions_compress.' . $phpEx); -					$use_method = request_var('use_method', ''); +					$use_method = $request->variable('use_method', '');  					$methods = array('.tar');  					$available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); @@ -864,9 +874,9 @@ class install_update extends module  					$this->include_file('includes/functions_transfer.' . $phpEx);  					// Choose FTP, if not available use fsock... -					$method = basename(request_var('method', '')); +					$method = basename($request->variable('method', ''));  					$submit = (isset($_POST['submit'])) ? true : false; -					$test_ftp_connection = request_var('test_connection', ''); +					$test_ftp_connection = $request->variable('test_connection', '');  					if (!$method || !class_exists($method))  					{ @@ -883,12 +893,12 @@ class install_update extends module  					if ($test_ftp_connection || $submit)  					{  						$transfer = new $method( -							request_var('host', ''), -							request_var('username', ''), +							$request->variable('host', ''), +							$request->variable('username', ''),  							htmlspecialchars_decode($request->untrimmed_variable('password', '')), -							request_var('root_path', ''), -							request_var('port', ''), -							request_var('timeout', '') +							$request->variable('root_path', ''), +							$request->variable('port', ''), +							$request->variable('timeout', '')  						);  						$test_connection = $transfer->open_session(); @@ -959,7 +969,7 @@ class install_update extends module  				// Now init the connection  				if ($update_mode == 'download')  				{ -					if (function_exists('phpbb_is_writable') && !phpbb_is_writable($phpbb_root_path . 'store/')) +					if ($this->filesystem->is_writable($phpbb_root_path . 'store/'))  					{  						trigger_error(sprintf('The directory ā%sā is not writable.', $phpbb_root_path . 'store/'), E_USER_ERROR);  					} @@ -976,12 +986,12 @@ class install_update extends module  				else  				{  					$transfer = new $method( -						request_var('host', ''), -						request_var('username', ''), +						$request->variable('host', ''), +						$request->variable('username', ''),  						htmlspecialchars_decode($request->untrimmed_variable('password', '')), -						request_var('root_path', ''), -						request_var('port', ''), -						request_var('timeout', '') +						$request->variable('root_path', ''), +						$request->variable('port', ''), +						$request->variable('timeout', '')  					);  					$transfer->open_session();  				} @@ -1105,15 +1115,15 @@ class install_update extends module  	*/  	function show_diff(&$update_list)  	{ -		global $phpbb_root_path, $template, $user, $phpbb_adm_relative_path; +		global $phpbb_root_path, $template, $user, $request, $phpbb_adm_relative_path;  		$this->tpl_name = 'install_update_diff';  		$this->page_title = 'VIEWING_FILE_DIFF'; -		$status = request_var('status', ''); -		$file = request_var('file', ''); -		$diff_mode = request_var('diff_mode', 'inline'); +		$status = $request->variable('status', ''); +		$file = $request->variable('file', ''); +		$diff_mode = $request->variable('diff_mode', 'inline');  		// First of all make sure the file is within our file update list with the correct status  		$found_entry = array(); @@ -1142,7 +1152,7 @@ class install_update extends module  		switch ($status)  		{  			case 'conflict': -				$option = request_var('op', 0); +				$option = $request->variable('op', 0);  				switch ($option)  				{ @@ -1193,7 +1203,7 @@ class install_update extends module  			break;  			case 'modified': -				$option = request_var('op', 0); +				$option = $request->variable('op', 0);  				switch ($option)  				{ @@ -1689,7 +1699,7 @@ class install_update extends module  					// Get custom installed styles...  					$sql = 'SELECT style_name, style_path  						FROM ' . STYLES_TABLE . " -						WHERE LOWER(style_name) NOT IN ('subsilver2', 'prosilver')"; +						WHERE LOWER(style_name) NOT IN ('prosilver')";  					$result = $db->sql_query($sql);  					$templates = array(); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index b740977468..1f856f016c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -273,7 +273,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0  INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.5-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.0-a1-dev');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');  INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); | 
