From 14e8f712ae0278afff2a750b707dfd66f6e13182 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Fri, 17 Apr 2015 18:38:21 +0200 Subject: [PATCH 01/75] [ticket/13740] Moving old installer to install_old PHPBB3-13740 --- phpBB/install/install_install.php | 2368 ----------------- phpBB/install/install_main.php | 78 - .../convertors/convert_phpbb20.php | 0 .../convertors/functions_phpbb20.php | 0 .../data/confusables.php | 0 .../database_update.php | 0 phpBB/{install => install_old}/index.php | 0 .../install_convert.php | 0 .../install_update.php | 0 phpBB/{install => install_old}/phpinfo.php | 0 10 files changed, 2446 deletions(-) delete mode 100644 phpBB/install/install_install.php delete mode 100644 phpBB/install/install_main.php rename phpBB/{install => install_old}/convertors/convert_phpbb20.php (100%) rename phpBB/{install => install_old}/convertors/functions_phpbb20.php (100%) rename phpBB/{install => install_old}/data/confusables.php (100%) rename phpBB/{install => install_old}/database_update.php (100%) rename phpBB/{install => install_old}/index.php (100%) rename phpBB/{install => install_old}/install_convert.php (100%) rename phpBB/{install => install_old}/install_update.php (100%) rename phpBB/{install => install_old}/phpinfo.php (100%) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php deleted file mode 100644 index 0e223866b1..0000000000 --- a/phpBB/install/install_install.php +++ /dev/null @@ -1,2368 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -*/ -if (!defined('IN_INSTALL')) -{ - // Someone has tried to access the file direct. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - // If phpBB is already installed we do not include this module - if (phpbb_check_installation_exists($phpbb_root_path, $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) - { - return; - } - - $module[] = array( - 'module_type' => 'install', - 'module_title' => 'INSTALL', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 10, - 'module_subs' => '', - 'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'), - 'module_reqs' => '' - ); -} - -/** -* Installation -*/ -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) - { - global $lang, $template, $language, $phpbb_root_path, $phpEx; - global $phpbb_container, $cache, $phpbb_log, $request, $phpbb_config_php_file; - - switch ($sub) - { - case 'intro': - $phpbb_container->get('cache.driver')->purge(); - - $this->page_title = $lang['SUB_INTRO']; - - $template->assign_vars(array( - 'TITLE' => $lang['INSTALL_INTRO'], - 'BODY' => $lang['INSTALL_INTRO_BODY'], - 'L_SUBMIT' => $lang['NEXT_STEP'], - 'S_LANG_SELECT' => '', - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language", - )); - - break; - - case 'requirements': - $this->check_server_requirements($mode, $sub); - - break; - - case 'database': - $this->obtain_database_settings($mode, $sub); - - break; - - case 'administrator': - $this->obtain_admin_settings($mode, $sub); - - break; - - case 'config_file': - $this->create_config_file($mode, $sub); - - break; - - case 'advanced': - $this->obtain_advanced_settings($mode, $sub); - - break; - - case 'create_table': - $this->load_schema($mode, $sub); - break; - - case 'final': - // 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_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); - $this->add_modules($mode, $sub); - $this->add_language($mode, $sub); - $this->add_bots($mode, $sub); - $this->email_admin($mode, $sub); - $this->disable_avatars_if_unwritable(); - $this->populate_migrations($phpbb_container->get('ext.manager'), $phpbb_container->get('migrator')); - - // Remove the lock file - @unlink($phpbb_root_path . 'cache/install_lock'); - - break; - } - - $this->tpl_name = 'install_install'; - } - - /** - * Checks that the server we are installing on meets the requirements for running phpBB - */ - function check_server_requirements($mode, $sub) - { - global $lang, $template, $phpbb_root_path, $phpEx, $language; - - $this->page_title = $lang['STAGE_REQUIREMENTS']; - - $template->assign_vars(array( - 'TITLE' => $lang['REQUIREMENTS_TITLE'], - 'BODY' => $lang['REQUIREMENTS_EXPLAIN'], - )); - - $passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false, 'json' => false,); - - // Test for basic PHP settings - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_SETTINGS'], - 'LEGEND_EXPLAIN' => $lang['PHP_SETTINGS_EXPLAIN'], - )); - - // Test the minimum PHP version - $php_version = PHP_VERSION; - - if (version_compare($php_version, '5.3.9') < 0) - { - $result = '' . $lang['NO'] . ''; - } - else - { - $passed['php'] = true; - - // We also give feedback on whether we're running in safe mode - $result = '' . $lang['YES']; - if (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on') - { - $result .= ', ' . $lang['PHP_SAFE_MODE']; - } - $result .= ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_VERSION_REQD'], - 'RESULT' => $result, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - - // Don't check for register_globals on 5.4+ - if (version_compare($php_version, '5.4.0-dev') < 0) - { - // Check for register_globals being enabled - if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') - { - $result = '' . $lang['NO'] . ''; - } - else - { - $result = '' . $lang['YES'] . ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_REGISTER_GLOBALS'], - 'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - } - - // Check for url_fopen - if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on') - { - $result = '' . $lang['YES'] . ''; - } - else - { - $result = '' . $lang['NO'] . ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_URL_FOPEN_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - // Check for getimagesize - if (@function_exists('getimagesize')) - { - $passed['imagesize'] = true; - $result = '' . $lang['YES'] . ''; - } - else - { - $result = '' . $lang['NO'] . ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_GETIMAGESIZE_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - // Check for PCRE UTF-8 support - if (@preg_match('//u', '')) - { - $passed['pcre'] = true; - $result = '' . $lang['YES'] . ''; - } - else - { - $result = '' . $lang['NO'] . ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PCRE_UTF_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PCRE_UTF_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - // Check for php json support - if (@extension_loaded('json')) - { - $passed['json'] = true; - $result = '' . $lang['YES'] . ''; - } - else - { - $result = '' . $lang['NO'] . ''; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['PHP_JSON_SUPPORT'], - 'TITLE_EXPLAIN' => $lang['PHP_JSON_SUPPORT_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - - $passed['mbstring'] = true; - if (@extension_loaded('mbstring')) - { - // Test for available database modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['MBSTRING_CHECK'], - 'LEGEND_EXPLAIN' => $lang['MBSTRING_CHECK_EXPLAIN'], - )); - - $checks = array( - array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING), - array('encoding_translation', '!=', 0), - array('http_input', '!=', array('pass', '')), - array('http_output', '!=', array('pass', '')) - ); - - foreach ($checks as $mb_checks) - { - $ini_val = @ini_get('mbstring.' . $mb_checks[0]); - switch ($mb_checks[1]) - { - case '&': - if (intval($ini_val) & $mb_checks[2]) - { - $result = '' . $lang['NO'] . ''; - $passed['mbstring'] = false; - } - else - { - $result = '' . $lang['YES'] . ''; - } - break; - - case '!=': - if (!is_array($mb_checks[2]) && $ini_val != $mb_checks[2] || - is_array($mb_checks[2]) && !in_array($ini_val, $mb_checks[2])) - { - $result = '' . $lang['NO'] . ''; - $passed['mbstring'] = false; - } - else - { - $result = '' . $lang['YES'] . ''; - } - break; - } - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['MBSTRING_' . strtoupper($mb_checks[0])], - 'TITLE_EXPLAIN' => $lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'], - 'RESULT' => $result, - - 'S_EXPLAIN' => true, - 'S_LEGEND' => false, - )); - } - } - - // Test for available database modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_SUPPORTED_DB'], - 'LEGEND_EXPLAIN' => $lang['PHP_SUPPORTED_DB_EXPLAIN'], - )); - - $available_dbms = get_available_dbms(false, true); - $passed['db'] = $available_dbms['ANY_DB_SUPPORT']; - unset($available_dbms['ANY_DB_SUPPORT']); - - foreach ($available_dbms as $db_name => $db_ary) - { - if (!$db_ary['AVAILABLE']) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($db_name)], - 'RESULT' => '' . $lang['UNAVAILABLE'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($db_name)], - 'RESULT' => '' . $lang['AVAILABLE'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - // Test for other modules - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['PHP_OPTIONAL_MODULE'], - 'LEGEND_EXPLAIN' => $lang['PHP_OPTIONAL_MODULE_EXPLAIN'], - )); - - foreach ($this->php_dlls_other as $dll) - { - if (!@extension_loaded($dll)) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($dll)], - 'RESULT' => '' . $lang['UNAVAILABLE'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - continue; - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DLL_' . strtoupper($dll)], - 'RESULT' => '' . $lang['AVAILABLE'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // Can we find Imagemagick anywhere on the system? - $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; - - $magic_home = getenv('MAGICK_HOME'); - $img_imagick = ''; - if (empty($magic_home)) - { - $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); - $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); - - $locations = array_merge($path_locations, $locations); - foreach ($locations as $location) - { - // The path might not end properly, fudge it - if (substr($location, -1, 1) !== '/') - { - $location .= '/'; - } - - if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) - { - $img_imagick = str_replace('\\', '/', $location); - continue; - } - } - } - else - { - $img_imagick = str_replace('\\', '/', $magic_home); - } - - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['APP_MAGICK'], - 'RESULT' => ($img_imagick) ? '' . $lang['AVAILABLE'] . ', ' . $img_imagick . '' : '' . $lang['NO_LOCATION'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - - // Check permissions on files/directories we need access to - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['FILES_REQUIRED'], - 'LEGEND_EXPLAIN' => $lang['FILES_REQUIRED_EXPLAIN'], - )); - - $directories = array('cache/', 'files/', 'store/'); - - umask(0); - - $passed['files'] = true; - foreach ($directories as $dir) - { - $exists = $write = false; - - // Try to create the directory if it does not exist - if (!file_exists($phpbb_root_path . $dir)) - { - @mkdir($phpbb_root_path . $dir, 0777); - - 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)) - { - try - { - $this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); - } - catch (\phpbb\filesystem\exception\filesystem_exception $e) - { - // Do nothing - } - - $exists = true; - } - - // Now check if it is writable by storing a simple file - $fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb'); - if ($fp !== false) - { - $write = true; - } - @fclose($fp); - - @unlink($phpbb_root_path . $dir . 'test_lock'); - - $passed['files'] = ($exists && $write && $passed['files']) ? true : false; - - $exists = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . ''; - $write = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : ''); - - $template->assign_block_vars('checks', array( - 'TITLE' => $dir, - 'RESULT' => $exists . $write, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // Check permissions on files/directories it would be useful access to - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['FILES_OPTIONAL'], - 'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'], - )); - - $directories = array('config.' . $phpEx, 'images/avatars/upload/'); - - foreach ($directories as $dir) - { - $write = $exists = true; - if (file_exists($phpbb_root_path . $dir)) - { - if (!$this->filesystem->is_writable($phpbb_root_path . $dir)) - { - $write = false; - } - } - else - { - $write = $exists = false; - } - - $exists_str = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . ''; - $write_str = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : ''); - - $template->assign_block_vars('checks', array( - 'TITLE' => $dir, - 'RESULT' => $exists_str . $write_str, - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - - // And finally where do we want to go next (well today is taken isn't it :P) - $s_hidden_fields = ($img_imagick) ? '' : ''; - - $url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&sub=database&language=$language" : $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language "; - $submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST']; - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Obtain the information required to connect to the database - */ - function obtain_database_settings($mode, $sub) - { - global $lang, $template, $phpEx; - - $this->page_title = $lang['STAGE_DATABASE']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - $connect_test = false; - $error = array(); - $available_dbms = get_available_dbms(false, true); - - // Has the user opted to test the connection? - if (isset($_POST['testdb'])) - { - if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE']) - { - $error[] = $lang['INST_ERR_NO_DB']; - $connect_test = false; - } - else if (!preg_match(get_preg_expression('table_prefix'), $data['table_prefix'])) - { - $error[] = $lang['INST_ERR_DB_INVALID_PREFIX']; - $connect_test = false; - } - else - { - $connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']); - } - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['DB_CONNECTION'], - 'LEGEND_EXPLAIN' => false, - )); - - if ($connect_test) - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DB_TEST'], - 'RESULT' => '' . $lang['SUCCESSFUL_CONNECT'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['DB_TEST'], - 'RESULT' => '' . implode('
', $error) . '
', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - if (!$connect_test) - { - // Update the list of available DBMS modules to only contain those which can be used - $available_dbms_temp = array(); - foreach ($available_dbms as $type => $dbms_ary) - { - if (!$dbms_ary['AVAILABLE']) - { - continue; - } - - $available_dbms_temp[$type] = $dbms_ary; - } - - $available_dbms = &$available_dbms_temp; - - // And now for the main part of this page - $data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_'); - - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - } - - // And finally where do we want to go next (well today is taken isn't it :P) - $s_hidden_fields = ($data['img_imagick']) ? '' : ''; - $s_hidden_fields .= ''; - if ($connect_test) - { - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= ''; - } - } - - $url = ($connect_test) ? $this->p_master->module_url . "?mode=$mode&sub=administrator" : $this->p_master->module_url . "?mode=$mode&sub=database"; - $s_hidden_fields .= ($connect_test) ? '' : ''; - - $submit = $lang['NEXT_STEP']; - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Obtain the administrator's name, password and email address - */ - function obtain_admin_settings($mode, $sub) - { - global $lang, $template, $phpEx; - - $this->page_title = $lang['STAGE_ADMINISTRATOR']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '' : ''; - $passed = false; - - $data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language']; - - if (isset($_POST['check'])) - { - $error = array(); - - // Check the entered email address and password - if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '') - { - $error[] = $lang['INST_ERR_MISSING_DATA']; - } - - if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '') - { - $error[] = $lang['INST_ERR_PASSWORD_MISMATCH']; - } - - // Test against the default username rules - if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3) - { - $error[] = $lang['INST_ERR_USER_TOO_SHORT']; - } - - if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20) - { - $error[] = $lang['INST_ERR_USER_TOO_LONG']; - } - - // Test against the default password rules - if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6) - { - $error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT']; - } - - if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30) - { - $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; - } - - if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email'])) - { - $error[] = $lang['INST_ERR_EMAIL_INVALID']; - } - - $template->assign_block_vars('checks', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang['STAGE_ADMINISTRATOR'], - 'LEGEND_EXPLAIN' => false, - )); - - if (!sizeof($error)) - { - $passed = true; - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['ADMIN_TEST'], - 'RESULT' => '' . $lang['TESTS_PASSED'] . '', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - else - { - $template->assign_block_vars('checks', array( - 'TITLE' => $lang['ADMIN_TEST'], - 'RESULT' => '' . implode('
', $error) . '
', - - 'S_EXPLAIN' => false, - 'S_LEGEND' => false, - )); - } - } - - if (!$passed) - { - foreach ($this->admin_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - } - else - { - foreach ($this->admin_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= ''; - } - } - - $s_hidden_fields .= ($data['img_imagick']) ? '' : ''; - $s_hidden_fields .= ''; - - foreach ($this->db_config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= ''; - } - - $submit = $lang['NEXT_STEP']; - - $url = ($passed) ? $this->p_master->module_url . "?mode=$mode&sub=config_file" : $this->p_master->module_url . "?mode=$mode&sub=administrator"; - $s_hidden_fields .= ($passed) ? '' : ''; - - $template->assign_vars(array( - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Writes the config file to disk, or if unable to do so offers alternative methods - */ - function create_config_file($mode, $sub) - { - global $lang, $template, $phpbb_root_path, $phpEx; - - $this->page_title = $lang['STAGE_CONFIG_FILE']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '' : ''; - $s_hidden_fields .= ''; - $written = false; - - // Create a list of any PHP modules we wish to have loaded - $available_dbms = get_available_dbms($data['dbms']); - - // Create a lock file to indicate that there is an install in progress - $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb'); - if ($fp === false) - { - // We were unable to create the lock file - abort - $this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__); - } - @fclose($fp); - - @chmod($phpbb_root_path . 'cache/install_lock', 0777); - - // Time to convert the data provided into a config file - $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) && $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; - - if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w'))) - { - // Something went wrong ... so let's try another method - $written = false; - } - - if (!(@fwrite($fp, $config_data))) - { - // Something went wrong ... so let's try another method - $written = false; - } - - @fclose($fp); - - if ($written) - { - // We may revert back to chmod() if we see problems with users not able to change their config.php file directly - try - { - $this->filesystem->phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ); - } - catch (\phpbb\filesystem\exception\filesystem_exception $e) - { - // Do nothing - } - } - } - - if (isset($_POST['dldone'])) - { - // Do a basic check to make sure that the file has been uploaded - // Note that all we check is that the file has _something_ in it - // We don't compare the contents exactly - if they can't upload - // a single file correctly, it's likely they will have other problems.... - if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) - { - $written = true; - } - } - - $config_options = array_merge($this->db_config_options, $this->admin_config_options); - - foreach ($config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= ''; - } - - if (!$written) - { - // OK, so it didn't work let's try the alternatives - - if (isset($_POST['dlconfig'])) - { - // They want a copy of the file to download, so send the relevant headers and dump out the data - header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); - header("Content-disposition: attachment; filename=config.$phpEx"); - echo $config_data; - exit; - } - - // The option to download the config file is always available, so output it here - $template->assign_vars(array( - 'BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'], - 'L_DL_CONFIG' => $lang['DL_CONFIG'], - 'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'], - 'L_DL_DONE' => $lang['DONE'], - 'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'], - 'S_HIDDEN' => $s_hidden_fields, - 'S_SHOW_DOWNLOAD' => true, - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=config_file", - )); - return; - } - else - { - $template->assign_vars(array( - 'BODY' => $lang['CONFIG_FILE_WRITTEN'], - 'L_SUBMIT' => $lang['NEXT_STEP'], - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=advanced", - )); - return; - } - } - - /** - * Provide an opportunity to customise some advanced settings during the install - * in case it is necessary for them to be set to access later - */ - function obtain_advanced_settings($mode, $sub) - { - global $lang, $template, $phpEx, $request; - - $this->page_title = $lang['STAGE_ADVANCED']; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $s_hidden_fields = ($data['img_imagick']) ? '' : ''; - $s_hidden_fields .= ''; - - // HTTP_HOST is having the correct browser url in most cases... - $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); - - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') !== false) - { - $server_name = substr($server_name, 0, strpos($server_name, ':')); - } - - $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true; - $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : $server_name; - $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : $request->server('SERVER_PORT', 0); - $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ($request->is_secure() ? 'https://' : 'http://'); - $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : $request->is_secure(); - - if ($data['script_path'] === '') - { - $name = htmlspecialchars_decode($request->server('PHP_SELF')); - if (!$name) - { - $name = htmlspecialchars_decode($request->server('REQUEST_URI')); - } - - // Replace backslashes and doubled slashes (could happen on some proxy setups) - $name = str_replace(array('\\', '//'), '/', $name); - $data['script_path'] = trim(dirname(dirname($name))); - } - - foreach ($this->advanced_config_options as $config_key => $vars) - { - if (!is_array($vars) && strpos($config_key, 'legend') === false) - { - continue; - } - - if (strpos($config_key, 'legend') !== false) - { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => $lang[$vars]) - ); - - continue; - } - - $options = isset($vars['options']) ? $vars['options'] : ''; - - $template->assign_block_vars('options', array( - 'KEY' => $config_key, - 'TITLE' => $lang[$vars['lang']], - 'S_EXPLAIN' => $vars['explain'], - 'S_LEGEND' => false, - 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', - 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), - ) - ); - } - - $config_options = array_merge($this->db_config_options, $this->admin_config_options); - foreach ($config_options as $config_key => $vars) - { - if (!is_array($vars)) - { - continue; - } - $s_hidden_fields .= ''; - } - - $submit = $lang['NEXT_STEP']; - - $url = $this->p_master->module_url . "?mode=$mode&sub=create_table"; - - $template->assign_vars(array( - 'BODY' => $lang['STAGE_ADVANCED_EXPLAIN'], - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => $s_hidden_fields, - 'U_ACTION' => $url, - )); - } - - /** - * Load the contents of the schema into the database and then alter it based on what has been input during the installation - */ - function load_schema($mode, $sub) - { - global $db, $lang, $template, $phpbb_root_path, $phpEx, $request; - - $this->page_title = $lang['STAGE_CREATE_TABLE']; - $s_hidden_fields = ''; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - - if ($data['dbms'] == '') - { - // Someone's been silly and tried calling this page direct - // So we send them back to the start to do it again properly - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - // HTTP_HOST is having the correct browser url in most cases... - $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); - $referer = strtolower($request->header('Referer')); - - // HTTP HOST can carry a port number... - if (strpos($server_name, ':') !== false) - { - $server_name = substr($server_name, 0, strpos($server_name, ':')); - } - - $cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : $server_name; - - // Try to come up with the best solution for cookie domain... - if (strpos($cookie_domain, 'www.') === 0) - { - $cookie_domain = str_replace('www.', '.', $cookie_domain); - } - - // If we get here and the extension isn't loaded it should be safe to just go ahead and load it - $available_dbms = get_available_dbms($data['dbms']); - - if (!isset($available_dbms[$data['dbms']])) - { - // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $dbms = $available_dbms[$data['dbms']]['DRIVER']; - - // Instantiate the database - $db = new $dbms(); - $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); - - // NOTE: trigger_error does not work here. - $db->sql_return_on_error(true); - - // If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;) - if ($data['dbms'] == 'mysql') - { - if (version_compare($db->sql_server_info(true), '4.1.3', '>=')) - { - $available_dbms[$data['dbms']]['SCHEMA'] .= '_41'; - } - else - { - $available_dbms[$data['dbms']]['SCHEMA'] .= '_40'; - } - } - - // Ok we have the db info go ahead and read in the relevant schema - // and work on building the table - $dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql'; - - // How should we treat this schema? - $delimiter = $available_dbms[$data['dbms']]['DELIM']; - - if (file_exists($dbms_schema)) - { - $sql_query = @file_get_contents($dbms_schema); - $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); - $sql_query = phpbb_remove_comments($sql_query); - $sql_query = split_sql_file($sql_query, $delimiter); - - foreach ($sql_query as $sql) - { - // Ignore errors when the functions or types already exist - // to allow installing phpBB twice in the same database with - // a different prefix - $db->sql_query($sql); - } - unset($sql_query); - } - - // Ok we have the db info go ahead and work on building the table - if (file_exists('schemas/schema.json')) - { - $db_table_schema = @file_get_contents('schemas/schema.json'); - $db_table_schema = json_decode($db_table_schema, true); - } - else - { - global $phpbb_root_path, $phpEx, $table_prefix; - $table_prefix = 'phpbb_'; - - 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($phpbb_root_path . 'includes/constants.' . $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(); - $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(); - } - - 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', $data['table_prefix'] . 'config'); - } - - $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( - $data['table_prefix'] . substr($table_name, 6), - $table_data - ); - } - - // Ok tables have been built, let's fill in the basic information - $sql_query = file_get_contents('schemas/schema_data.sql'); - - // Deal with any special comments and characters - switch ($data['dbms']) - { - case 'mssql': - case 'mssql_odbc': - case 'mssqlnative': - $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); - break; - - case 'postgres': - $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query); - break; - - case 'mysql': - case 'mysqli': - $sql_query = str_replace('\\', '\\\\', $sql_query); - break; - } - - // Change prefix - $sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $data['table_prefix'] . '\1 ', $sql_query); - - // Change language strings... - $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query); - - $sql_query = phpbb_remove_comments($sql_query); - $sql_query = split_sql_file($sql_query, ';'); - - foreach ($sql_query as $sql) - { - //$sql = trim(str_replace('|', ';', $sql)); - if (!$db->sql_query($sql)) - { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); - } - } - unset($sql_query); - - $current_time = time(); - - $user_ip = $request->server('REMOTE_ADDR') ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : ''; - - if ($data['script_path'] !== '/') - { - // Adjust destination path (no trailing slash) - if (substr($data['script_path'], -1) == '/') - { - $data['script_path'] = substr($data['script_path'], 0, -1); - } - - $data['script_path'] = str_replace(array('../', './'), '', $data['script_path']); - - if ($data['script_path'][0] != '/') - { - $data['script_path'] = '/' . $data['script_path']; - } - } - - // Set default config and post data, this applies to all DB's - $sql_ary = array( - 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) - VALUES ('board_startdate', '$current_time')", - - 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) - VALUES ('default_lang', '" . $db->sql_escape($data['default_lang']) . "')", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['img_imagick']) . "' - WHERE config_name = 'img_imagick'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_name']) . "' - WHERE config_name = 'server_name'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_port']) . "' - WHERE config_name = 'server_port'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email']) . "' - WHERE config_name = 'board_email'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['board_email']) . "' - WHERE config_name = 'board_contact'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($cookie_domain) . "' - WHERE config_name = 'cookie_domain'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($lang['default_dateformat']) . "' - WHERE config_name = 'default_dateformat'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['email_enable']) . "' - WHERE config_name = 'email_enable'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_delivery']) . "' - WHERE config_name = 'smtp_delivery'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_host']) . "' - WHERE config_name = 'smtp_host'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_auth']) . "' - WHERE config_name = 'smtp_auth_method'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_user']) . "' - WHERE config_name = 'smtp_username'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['smtp_pass']) . "' - WHERE config_name = 'smtp_password'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['cookie_secure']) . "' - WHERE config_name = 'cookie_secure'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['force_server_vars']) . "' - WHERE config_name = 'force_server_vars'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['script_path']) . "' - WHERE config_name = 'script_path'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['server_protocol']) . "' - WHERE config_name = 'server_protocol'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($data['admin_name']) . "' - WHERE config_name = 'newest_username'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . md5(mt_rand()) . "' - WHERE config_name = 'avatar_salt'", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . md5(mt_rand()) . "' - WHERE config_name = 'plupload_salt'", - - 'UPDATE ' . $data['table_prefix'] . "users - SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' - WHERE username = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "moderator_cache - SET username = '" . $db->sql_escape($data['admin_name']) . "' - WHERE username = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "forums - SET forum_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' - WHERE forum_last_poster_name = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "topics - SET topic_first_poster_name = '" . $db->sql_escape($data['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' - WHERE topic_first_poster_name = 'Admin' - OR topic_last_poster_name = 'Admin'", - - 'UPDATE ' . $data['table_prefix'] . "users - SET user_regdate = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "posts - SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'", - - 'UPDATE ' . $data['table_prefix'] . "topics - SET topic_time = $current_time, topic_last_post_time = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "forums - SET forum_last_post_time = $current_time", - - 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($db->sql_server_info(true)) . "' - WHERE config_name = 'dbms_version'", - ); - - if (@extension_loaded('gd')) - { - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = 'core.captcha.plugins.gd' - WHERE config_name = 'captcha_plugin'"; - - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - SET config_value = '1' - WHERE config_name = 'captcha_gd'"; - } - - $ref = substr($referer, strpos($referer, '://') + 3); - - if (!(stripos($ref, $server_name) === 0)) - { - $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config - 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 ' . $data['table_prefix'] . "config - SET config_value = '" . $db->sql_escape($cookie_name) . "' - WHERE config_name = 'cookie_name'"; - - foreach ($sql_ary as $sql) - { - //$sql = trim(str_replace('|', ';', $sql)); - - if (!$db->sql_query($sql)) - { - $error = $db->sql_error(); - $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); - } - } - - $submit = $lang['NEXT_STEP']; - - $url = $this->p_master->module_url . "?mode=$mode&sub=final"; - - $template->assign_vars(array( - 'BODY' => $lang['STAGE_CREATE_TABLE_EXPLAIN'], - 'L_SUBMIT' => $submit, - 'S_HIDDEN' => build_hidden_fields($data), - 'U_ACTION' => $url, - )); - } - - /** - * Build the search index... - */ - function build_search_index($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpbb_dispatcher, $phpEx, $config, $auth, $user; - - // Obtain any submitted data - $data = $this->get_submitted_data(); - $table_prefix = $data['table_prefix']; - - // If we get here and the extension isn't loaded it should be safe to just go ahead and load it - $available_dbms = get_available_dbms($data['dbms']); - - if (!isset($available_dbms[$data['dbms']])) - { - // Someone's been silly and tried providing a non-existant dbms - $this->p_master->redirect("index.$phpEx?mode=install"); - } - - $dbms = $available_dbms[$data['dbms']]['DRIVER']; - - // Instantiate the database - $db = new $dbms(); - $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); - - // NOTE: trigger_error does not work here. - $db->sql_return_on_error(true); - - include_once($phpbb_root_path . 'includes/constants.' . $phpEx); - 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\dummy, CONFIG_TABLE); - - $error = false; - $search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); - - $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id - FROM ' . POSTS_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']); - } - $db->sql_freeresult($result); - } - - /** - * Populate the module tables - */ - function add_modules($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager, $config, $phpbb_container; - - // 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'); - } - - $_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 - foreach ($module_classes as $module_class) - { - $categories = array(); - - // Set the module class - $_module->module_class = $module_class; - - foreach ($this->module_categories[$module_class] as $cat_name => $subs) - { - $basename = ''; - // Check if this sub-category has a basename. If it has, use it. - if (isset($this->module_categories_basenames[$cat_name])) - { - $basename = $this->module_categories_basenames[$cat_name]; - } - $module_data = array( - 'module_basename' => $basename, - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => 0, - 'module_class' => $module_class, - 'module_langname' => $cat_name, - 'module_mode' => '', - 'module_auth' => '', - ); - - // Add category - $_module->update_module_data($module_data); - - // Check for last sql error happened - if ($db->get_sql_error_triggered()) - { - $error = $db->sql_error($db->get_sql_error_sql()); - $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); - } - - $categories[$cat_name]['id'] = (int) $module_data['module_id']; - $categories[$cat_name]['parent_id'] = 0; - - // Create sub-categories... - if (is_array($subs)) - { - foreach ($subs as $level2_name) - { - $basename = ''; - // Check if this sub-category has a basename. If it has, use it. - if (isset($this->module_categories_basenames[$level2_name])) - { - $basename = $this->module_categories_basenames[$level2_name]; - } - $module_data = array( - 'module_basename' => $basename, - 'module_enabled' => 1, - 'module_display' => 1, - 'parent_id' => (int) $categories[$cat_name]['id'], - 'module_class' => $module_class, - 'module_langname' => $level2_name, - 'module_mode' => '', - 'module_auth' => '', - ); - - $_module->update_module_data($module_data); - - // Check for last sql error happened - if ($db->get_sql_error_triggered()) - { - $error = $db->sql_error($db->get_sql_error_sql()); - $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); - } - - $categories[$level2_name]['id'] = (int) $module_data['module_id']; - $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; - } - } - } - - // Get the modules we want to add... returned sorted by name - $module_info = $_module->get_module_infos($module_class); - - foreach ($module_info as $module_basename => $fileinfo) - { - foreach ($fileinfo['modes'] as $module_mode => $row) - { - foreach ($row['cat'] as $cat_name) - { - if (!isset($categories[$cat_name])) - { - continue; - } - - $module_data = array( - 'module_basename' => $module_basename, - 'module_enabled' => 1, - 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, - 'parent_id' => (int) $categories[$cat_name]['id'], - 'module_class' => $module_class, - 'module_langname' => $row['title'], - 'module_mode' => $module_mode, - 'module_auth' => $row['auth'], - ); - - $_module->update_module_data($module_data); - - // Check for last sql error happened - if ($db->get_sql_error_triggered()) - { - $error = $db->sql_error($db->get_sql_error_sql()); - $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); - } - } - } - } - - // Move some of the modules around since the code above will put them in the wrong place - if ($module_class == 'acp') - { - // Move main module 4 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_main' - AND module_class = 'acp' - AND module_mode = 'main'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'acp', 'move_up', 4); - - // Move permissions intro screen module 4 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_permissions' - AND module_class = 'acp' - AND module_mode = 'intro'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'acp', 'move_up', 4); - - // Move manage users screen module 5 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'acp_users' - AND module_class = 'acp' - AND module_mode = 'overview'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'acp', 'move_up', 5); - - // Move extension management module 1 up... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT' - AND module_class = 'acp' - AND module_mode = '' - AND module_basename = ''"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'acp', 'move_up', 1); - } - - if ($module_class == 'mcp') - { - // Move pm report details module 3 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'mcp_pm_reports' - AND module_class = 'mcp' - AND module_mode = 'pm_report_details'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'mcp', 'move_down', 3); - - // Move closed pm reports module 3 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'mcp_pm_reports' - AND module_class = 'mcp' - AND module_mode = 'pm_reports_closed'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'mcp', 'move_down', 3); - - // Move open pm reports module 3 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'mcp_pm_reports' - AND module_class = 'mcp' - AND module_mode = 'pm_reports'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'mcp', 'move_down', 3); - } - - if ($module_class == 'ucp') - { - // Move attachment module 4 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'ucp_attachments' - AND module_class = 'ucp' - AND module_mode = 'attachments'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'ucp', 'move_down', 4); - - // Move notification options module 4 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'ucp_notifications' - AND module_class = 'ucp' - AND module_mode = 'notification_options'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'ucp', 'move_down', 4); - - // Move OAuth module 5 down... - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_basename = 'ucp_auth_link' - AND module_class = 'ucp' - AND module_mode = 'auth_link'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $_module->move_module_by($row, 'ucp', 'move_down', 5); - } - - // And now for the special ones - // (these are modules which appear in multiple categories and thus get added manually to some for more control) - if (isset($this->module_extras[$module_class])) - { - foreach ($this->module_extras[$module_class] as $cat_name => $mods) - { - $sql = 'SELECT module_id, left_id, right_id - FROM ' . MODULES_TABLE . " - WHERE module_langname = '" . $db->sql_escape($cat_name) . "' - AND module_class = '" . $db->sql_escape($module_class) . "'"; - $result = $db->sql_query_limit($sql, 1); - $row2 = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - foreach ($mods as $mod_name) - { - $sql = 'SELECT * - FROM ' . MODULES_TABLE . " - WHERE module_langname = '" . $db->sql_escape($mod_name) . "' - AND module_class = '" . $db->sql_escape($module_class) . "' - AND module_basename <> ''"; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $module_data = array( - 'module_basename' => $row['module_basename'], - 'module_enabled' => (int) $row['module_enabled'], - 'module_display' => (int) $row['module_display'], - 'parent_id' => (int) $row2['module_id'], - 'module_class' => $row['module_class'], - 'module_langname' => $row['module_langname'], - 'module_mode' => $row['module_mode'], - 'module_auth' => $row['module_auth'], - ); - - $_module->update_module_data($module_data); - - // Check for last sql error happened - if ($db->get_sql_error_triggered()) - { - $error = $db->sql_error($db->get_sql_error_sql()); - $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); - } - } - } - } - - $_module->remove_cache_file($module_class); - } - } - - /** - * Populate the language tables - */ - function add_language($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx; - - $dir = @opendir($phpbb_root_path . 'language'); - - if (!$dir) - { - $this->error('Unable to access the language directory', __LINE__, __FILE__); - } - - $installed_languages = array(); - while (($file = readdir($dir)) !== false) - { - $path = $phpbb_root_path . 'language/' . $file; - - if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') - { - continue; - } - - if (is_dir($path) && file_exists($path . '/iso.txt')) - { - $lang_file = file("$path/iso.txt"); - - $lang_pack = array( - 'lang_iso' => basename($path), - 'lang_dir' => basename($path), - 'lang_english_name' => trim(htmlspecialchars($lang_file[0])), - 'lang_local_name' => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')), - 'lang_author' => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')), - ); - - $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack)); - - $installed_languages[] = (int) $db->sql_nextid(); - if ($db->get_sql_error_triggered()) - { - $error = $db->sql_error($db->get_sql_error_sql()); - $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); - } - } - } - closedir($dir); - - $sql = 'SELECT * - FROM ' . PROFILE_FIELDS_TABLE; - $result = $db->sql_query($sql); - - $profile_fields = array(); - $insert_buffer = new \phpbb\db\sql_insert_buffer($db, PROFILE_LANG_TABLE); - while ($row = $db->sql_fetchrow($result)) - { - foreach ($installed_languages as $lang_id) - { - $insert_buffer->insert(array( - 'field_id' => $row['field_id'], - 'lang_id' => $lang_id, - 'lang_name' => strtoupper(substr($row['field_name'], 6)),// Remove phpbb_ from field name - 'lang_explain' => '', - 'lang_default_value' => '', - )); - } - } - $db->sql_freeresult($result); - - $insert_buffer->flush(); - } - - /** - * Add search robots to the database - */ - function add_bots($mode, $sub) - { - global $db, $lang, $phpbb_root_path, $phpEx, $config; - - // Obtain any submitted data - $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\dummy, CONFIG_TABLE); - - $sql = 'SELECT group_id - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS'"; - $result = $db->sql_query($sql); - $group_id = (int) $db->sql_fetchfield('group_id'); - $db->sql_freeresult($result); - - if (!$group_id) - { - // If we reach this point then something has gone very wrong - $this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__); - } - - if (!function_exists('user_add')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } - - foreach ($this->bot_list as $bot_name => $bot_ary) - { - $user_row = array( - 'user_type' => USER_IGNORE, - 'group_id' => $group_id, - 'username' => $bot_name, - 'user_regdate' => time(), - 'user_password' => '', - 'user_colour' => '9E8DA7', - 'user_email' => '', - 'user_lang' => $data['default_lang'], - 'user_style' => 1, - 'user_timezone' => 'UTC', - 'user_dateformat' => $lang['default_dateformat'], - 'user_allow_massemail' => 0, - 'user_allow_pm' => 0, - ); - - $user_id = user_add($user_row); - - if (!$user_id) - { - // If we can't insert this user then continue to the next one to avoid inconsistent data - $this->p_master->db_error('Unable to insert bot into users table', $db->get_sql_error_sql(), __LINE__, __FILE__, true); - continue; - } - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'bot_active' => 1, - 'bot_name' => (string) $bot_name, - 'user_id' => (int) $user_id, - 'bot_agent' => (string) $bot_ary[0], - 'bot_ip' => (string) $bot_ary[1], - )); - - $db->sql_query($sql); - } - } - - /** - * Sends an email to the board administrator with their password and some useful links - */ - function email_admin($mode, $sub) - { - global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_log; - - $this->page_title = $lang['STAGE_FINAL']; - - // Obtain any submitted data - $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\dummy, CONFIG_TABLE); - - $user->session_begin(); - $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); - - // OK, Now that we've reached this point we can be confident that everything - // is installed and working......I hope :) - // So it's time to send an email to the administrator confirming the details - // they entered - - if ($config['email_enable']) - { - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - - $messenger = new messenger(false); - - $messenger->template('installed', $data['language']); - - $messenger->to($data['board_email'], $data['admin_name']); - - $messenger->anti_abuse_headers($config, $user); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($data['admin_name']), - 'PASSWORD' => htmlspecialchars_decode($data['admin_pass1'])) - ); - - $messenger->send(NOTIFY_EMAIL); - } - - // And finally, add a note to the log - $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'], - 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), - 'L_SUBMIT' => $lang['INSTALL_LOGIN'], - 'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), - )); - } - - /** - * Check if the avatar directory is writable and disable avatars - * if it isn't writable. - */ - function disable_avatars_if_unwritable() - { - global $config, $phpbb_root_path; - - if (!$this->filesystem->is_writable($phpbb_root_path . 'images/avatars/upload/')) - { - $config->set('allow_avatar', 0); - $config->set('allow_avatar_upload', 0); - } - } - - /** - * Populate migrations for the installation - * - * This "installs" all migrations from (root path)/phpbb/db/migrations/data. - * "installs" means it adds all migrations to the migrations table, but does not - * perform any of the actions in the migrations. - * - * @param \phpbb\extension\manager $extension_manager - * @param \phpbb\db\migrator $migrator - */ - function populate_migrations($extension_manager, $migrator) - { - $finder = $extension_manager->get_finder(); - - $migrations = $finder - ->core_path('phpbb/db/migration/data/') - ->get_classes(); - $migrator->populate_migrations($migrations); - } - - /** - * Generate a list of available mail server authentication methods - */ - function mail_auth_select($selected_method) - { - global $lang; - - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); - $s_smtp_auth_options = ''; - - foreach ($auth_methods as $method) - { - $s_smtp_auth_options .= ''; - } - - return $s_smtp_auth_options; - } - - /** - * Get submitted data - */ - function get_submitted_data() - { - global $request; - - return array( - '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', ''), - ); - } - - /** - * The information below will be used to build the input fields presented to the user - */ - var $db_config_options = array( - 'legend1' => 'DB_CONFIG', - 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false), - 'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true), - 'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true), - 'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false), - 'dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false), - 'dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false), - 'table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => true), - ); - var $admin_config_options = array( - 'legend1' => 'ADMIN_CONFIG', - 'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false), - 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), - 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), - 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), - 'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'email:25:100', 'explain' => false), - ); - var $advanced_config_options = array( - 'legend1' => 'ACP_EMAIL_SETTINGS', - 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true), - 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false), - 'smtp_auth' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true), - 'smtp_user' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')), - 'smtp_pass' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')), - - 'legend2' => 'SERVER_URL_SETTINGS', - 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true), - 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'type' => 'text:10:10', 'explain' => true), - 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true), - 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true), - 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true), - ); - - /** - * Specific PHP modules we may require for certain optional or extended features - */ - var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml'); - - /** - * A list of the web-crawlers/bots we recognise by default - * - * Candidates but not included: - * 'Accoona [Bot]' 'Accoona-AI-Agent/' - * 'ASPseek [Crawler]' 'ASPseek/' - * 'Boitho [Crawler]' 'boitho.com-dc/' - * 'Bunnybot [Bot]' 'powered by www.buncat.de' - * 'Cosmix [Bot]' 'cfetch/' - * 'Crawler Search [Crawler]' '.Crawler-Search.de' - * 'Findexa [Crawler]' 'Findexa Crawler (' - * 'GBSpider [Spider]' 'GBSpider v' - * 'genie [Bot]' 'genieBot (' - * 'Hogsearch [Bot]' 'oegp v. 1.3.0' - * 'Insuranco [Bot]' 'InsurancoBot' - * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' - * 'ISC Systems [Bot]' 'ISC Systems iRc Search' - * 'Jyxobot [Bot]' 'Jyxobot/' - * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' - * 'LinkWalker' 'LinkWalker' - * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' - * 'Naver [Bot]' 'nhnbot@naver.com)' - * 'NetResearchServer' 'NetResearchServer/' - * 'Nimble [Crawler]' 'NimbleCrawler' - * 'Ocelli [Bot]' 'Ocelli/' - * 'Onsearch [Bot]' 'onCHECK-Robot' - * 'Orange [Spider]' 'OrangeSpider' - * 'Sproose [Bot]' 'http://www.sproose.com/bot' - * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' - * 'Tbot [Bot]' 'Tbot/' - * 'Thumbshots [Capture]' 'thumbshots-de-Bot' - * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' - * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' - * 'WissenOnline [Bot]' 'WissenOnline-Bot' - * 'WWWeasel [Bot]' 'WWWeasel Robot v' - * 'Xaldon [Spider]' 'Xaldon WebSpider' - */ - var $bot_list = array( - 'AdsBot [Google]' => array('AdsBot-Google', ''), - 'Alexa [Bot]' => array('ia_archiver', ''), - 'Alta Vista [Bot]' => array('Scooter/', ''), - 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), - 'Baidu [Spider]' => array('Baiduspider', ''), - 'Bing [Bot]' => array('bingbot/', ''), - 'Exabot [Bot]' => array('Exabot', ''), - 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), - 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), - 'Francis [Bot]' => array('http://www.neomo.de/', ''), - 'Gigabot [Bot]' => array('Gigabot/', ''), - 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), - 'Google Desktop' => array('Google Desktop', ''), - 'Google Feedfetcher' => array('Feedfetcher-Google', ''), - 'Google [Bot]' => array('Googlebot', ''), - 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), - 'Heritrix [Crawler]' => array('heritrix/1.', ''), - 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), - 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), - 'ichiro [Crawler]' => array('ichiro/', ''), - 'Majestic-12 [Bot]' => array('MJ12bot/', ''), - 'Metager [Bot]' => array('MetagerBot/', ''), - 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), - 'MSN [Bot]' => array('msnbot/', ''), - 'MSNbot Media' => array('msnbot-media/', ''), - 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), - 'Online link [Validator]' => array('online link validator', ''), - 'psbot [Picsearch]' => array('psbot/0', ''), - 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), - 'SEO Crawler' => array('SEO search Crawler/', ''), - 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), - 'SEOSearch [Crawler]' => array('SEOsearch/', ''), - 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), - 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), - 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), - 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), - 'Voyager [Bot]' => array('voyager/', ''), - 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), - 'W3C [Linkcheck]' => array('W3C-checklink/', ''), - 'W3C [Validator]' => array('W3C_Validator', ''), - 'YaCy [Bot]' => array('yacybot', ''), - 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), - 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), - 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), - 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), - ); - - /** - * Define the module structure so that we can populate the database without - * needing to hard-code module_id values - */ - var $module_categories = array( - 'acp' => array( - 'ACP_CAT_GENERAL' => array( - 'ACP_QUICK_ACCESS', - 'ACP_BOARD_CONFIGURATION', - 'ACP_CLIENT_COMMUNICATION', - 'ACP_SERVER_CONFIGURATION', - ), - 'ACP_CAT_FORUMS' => array( - 'ACP_MANAGE_FORUMS', - 'ACP_FORUM_BASED_PERMISSIONS', - ), - 'ACP_CAT_POSTING' => array( - 'ACP_MESSAGES', - 'ACP_ATTACHMENTS', - ), - 'ACP_CAT_USERGROUP' => array( - 'ACP_CAT_USERS', - 'ACP_GROUPS', - 'ACP_USER_SECURITY', - ), - 'ACP_CAT_PERMISSIONS' => array( - 'ACP_GLOBAL_PERMISSIONS', - 'ACP_FORUM_BASED_PERMISSIONS', - 'ACP_PERMISSION_ROLES', - 'ACP_PERMISSION_MASKS', - ), - 'ACP_CAT_CUSTOMISE' => array( - 'ACP_STYLE_MANAGEMENT', - 'ACP_EXTENSION_MANAGEMENT', - 'ACP_LANGUAGE', - ), - 'ACP_CAT_MAINTENANCE' => array( - 'ACP_FORUM_LOGS', - 'ACP_CAT_DATABASE', - ), - 'ACP_CAT_SYSTEM' => array( - 'ACP_AUTOMATION', - 'ACP_GENERAL_TASKS', - 'ACP_MODULE_MANAGEMENT', - ), - 'ACP_CAT_DOT_MODS' => null, - ), - 'mcp' => array( - 'MCP_MAIN' => null, - 'MCP_QUEUE' => null, - 'MCP_REPORTS' => null, - 'MCP_NOTES' => null, - 'MCP_WARN' => null, - 'MCP_LOGS' => null, - 'MCP_BAN' => null, - ), - 'ucp' => array( - 'UCP_MAIN' => null, - 'UCP_PROFILE' => null, - 'UCP_PREFS' => null, - 'UCP_PM' => null, - 'UCP_USERGROUPS' => null, - 'UCP_ZEBRA' => null, - ), - ); - var $module_categories_basenames = array( - 'UCP_PM' => 'ucp_pm', - ); - - var $module_extras = array( - 'acp' => array( - 'ACP_QUICK_ACCESS' => array( - 'ACP_MANAGE_USERS', - 'ACP_GROUPS_MANAGE', - 'ACP_MANAGE_FORUMS', - 'ACP_MOD_LOGS', - 'ACP_BOTS', - 'ACP_PHP_INFO', - ), - 'ACP_FORUM_BASED_PERMISSIONS' => array( - 'ACP_FORUM_PERMISSIONS', - 'ACP_FORUM_PERMISSIONS_COPY', - 'ACP_FORUM_MODERATORS', - 'ACP_USERS_FORUM_PERMISSIONS', - 'ACP_GROUPS_FORUM_PERMISSIONS', - ), - ), - ); -} diff --git a/phpBB/install/install_main.php b/phpBB/install/install_main.php deleted file mode 100644 index d5874dac83..0000000000 --- a/phpBB/install/install_main.php +++ /dev/null @@ -1,78 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -*/ - -if ( !defined('IN_INSTALL') ) -{ - // Someone has tried to access the file direct. This is not a good idea, so exit - exit; -} - -if (!empty($setmodules)) -{ - $module[] = array( - 'module_type' => 'install', - 'module_title' => 'OVERVIEW', - 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), - 'module_order' => 0, - 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'), - 'module_stages' => '', - 'module_reqs' => '' - ); -} - -/** -* Main Tab - Installation -*/ -class install_main extends module -{ - function install_main(&$p_master) - { - $this->p_master = &$p_master; - } - - function main($mode, $sub) - { - global $lang, $template, $language; - - switch ($sub) - { - case 'intro' : - $title = $lang['SUB_INTRO']; - $body = $lang['OVERVIEW_BODY']; - break; - - case 'license' : - $title = $lang['GPL']; - $body = implode("
\n", file(__DIR__ . '/../docs/LICENSE.txt')); - break; - - case 'support' : - $title = $lang['SUB_SUPPORT']; - $body = $lang['SUPPORT_BODY']; - break; - } - - $this->tpl_name = 'install_main'; - $this->page_title = $title; - - $template->assign_vars(array( - 'TITLE' => $title, - 'BODY' => $body, - - 'S_LANG_SELECT' => '', - )); - } -} diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install_old/convertors/convert_phpbb20.php similarity index 100% rename from phpBB/install/convertors/convert_phpbb20.php rename to phpBB/install_old/convertors/convert_phpbb20.php diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install_old/convertors/functions_phpbb20.php similarity index 100% rename from phpBB/install/convertors/functions_phpbb20.php rename to phpBB/install_old/convertors/functions_phpbb20.php diff --git a/phpBB/install/data/confusables.php b/phpBB/install_old/data/confusables.php similarity index 100% rename from phpBB/install/data/confusables.php rename to phpBB/install_old/data/confusables.php diff --git a/phpBB/install/database_update.php b/phpBB/install_old/database_update.php similarity index 100% rename from phpBB/install/database_update.php rename to phpBB/install_old/database_update.php diff --git a/phpBB/install/index.php b/phpBB/install_old/index.php similarity index 100% rename from phpBB/install/index.php rename to phpBB/install_old/index.php diff --git a/phpBB/install/install_convert.php b/phpBB/install_old/install_convert.php similarity index 100% rename from phpBB/install/install_convert.php rename to phpBB/install_old/install_convert.php diff --git a/phpBB/install/install_update.php b/phpBB/install_old/install_update.php similarity index 100% rename from phpBB/install/install_update.php rename to phpBB/install_old/install_update.php diff --git a/phpBB/install/phpinfo.php b/phpBB/install_old/phpinfo.php similarity index 100% rename from phpBB/install/phpinfo.php rename to phpBB/install_old/phpinfo.php From 5afc632bcaee256811942b442d244ef284d1eff6 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 28 Apr 2015 15:49:07 +0200 Subject: [PATCH 02/75] [ticket/13740] Core file workarounds [ci skip] PHPBB3-13740 --- phpBB/common.php | 2 +- phpBB/config/default/container/services.yml | 32 +----- .../default/container/services_files.yml | 3 + .../default/container/services_http.yml | 23 +++++ .../config/default/container/services_php.yml | 3 + phpBB/config/default/container/tables.yml | 1 + phpBB/includes/compatibility_globals.php | 99 +++++++++++-------- 7 files changed, 92 insertions(+), 71 deletions(-) create mode 100644 phpBB/config/default/container/services_files.yml create mode 100644 phpBB/config/default/container/services_http.yml create mode 100644 phpBB/config/default/container/services_php.yml diff --git a/phpBB/common.php b/phpBB/common.php index 0b898d9553..38761cfadc 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -52,7 +52,7 @@ if (!defined('PHPBB_INSTALLED')) } // $phpbb_root_path accounts for redirects from e.g. /adm - $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx; + $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx; // Replace any number of consecutive backslashes and/or slashes with a single slash // (could happen on some proxy setups and/or Windows servers) $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index aec61e0272..841b50c38b 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -8,13 +8,16 @@ imports: - { resource: services_db.yml } - { resource: services_event.yml } - { resource: services_feed.yml } + - { resource: services_files.yml } - { resource: services_help.yml } + - { resource: services_http.yml } - { resource: services_language.yml } - { resource: services_migrator.yml } - { resource: services_mimetype_guesser.yml } - { resource: services_module.yml } - { resource: services_notification.yml } - { resource: services_password.yml } + - { resource: services_php.yml } - { resource: services_profilefield.yml } - { resource: services_report.yml } - { resource: services_routing.yml } @@ -107,19 +110,9 @@ services: - %core.php_ext% - @cache.driver - filesystem: - class: phpbb\filesystem\filesystem - file_downloader: class: phpbb\file_downloader - http_kernel: - class: Symfony\Component\HttpKernel\HttpKernel - arguments: - - @dispatcher - - @controller.resolver - - @request_stack - log: class: phpbb\log\log arguments: @@ -142,9 +135,6 @@ services: - %core.php_ext% - %core.adm_relative_path% - php_ini: - class: phpbb\php\ini - plupload: class: phpbb\plupload\plupload arguments: @@ -155,22 +145,6 @@ services: - @php_ini - @mimetype.guesser - request: - class: phpbb\request\request - arguments: - - null - - %core.disable_super_globals% - - # WARNING: The Symfony request does not escape the input and should be used very carefully - # prefer the phpbb request (service @request) as possible - symfony_request: - class: phpbb\symfony_request - arguments: - - @request - - request_stack: - class: Symfony\Component\HttpFoundation\RequestStack - upload_imagesize: class: fastImageSize\fastImageSize diff --git a/phpBB/config/default/container/services_files.yml b/phpBB/config/default/container/services_files.yml new file mode 100644 index 0000000000..828f9076dd --- /dev/null +++ b/phpBB/config/default/container/services_files.yml @@ -0,0 +1,3 @@ +services: + filesystem: + class: phpbb\filesystem\filesystem diff --git a/phpBB/config/default/container/services_http.yml b/phpBB/config/default/container/services_http.yml new file mode 100644 index 0000000000..9c2bdd2337 --- /dev/null +++ b/phpBB/config/default/container/services_http.yml @@ -0,0 +1,23 @@ +services: + # WARNING: The Symfony request does not escape the input and should be used very carefully + # prefer the phpbb request (service @request) as possible + symfony_request: + class: phpbb\symfony_request + arguments: + - @request + + request_stack: + class: Symfony\Component\HttpFoundation\RequestStack + + request: + class: phpbb\request\request + arguments: + - null + - %core.disable_super_globals% + + http_kernel: + class: Symfony\Component\HttpKernel\HttpKernel + arguments: + - @dispatcher + - @controller.resolver + - @request_stack diff --git a/phpBB/config/default/container/services_php.yml b/phpBB/config/default/container/services_php.yml new file mode 100644 index 0000000000..8aabc7341f --- /dev/null +++ b/phpBB/config/default/container/services_php.yml @@ -0,0 +1,3 @@ +services: + php_ini: + class: phpbb\php\ini diff --git a/phpBB/config/default/container/tables.yml b/phpBB/config/default/container/tables.yml index 00067d5abe..c4b5ac2375 100644 --- a/phpBB/config/default/container/tables.yml +++ b/phpBB/config/default/container/tables.yml @@ -11,6 +11,7 @@ parameters: tables.forums: %core.table_prefix%forums tables.log: %core.table_prefix%log tables.migrations: %core.table_prefix%migrations + tables.moderator_cache: %core.table_prefix%moderator_cache tables.modules: %core.table_prefix%modules tables.notification_types: %core.table_prefix%notification_types tables.notifications: %core.table_prefix%notifications diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php index 5c18793655..cb4087d09b 100644 --- a/phpBB/includes/compatibility_globals.php +++ b/phpBB/includes/compatibility_globals.php @@ -1,62 +1,79 @@ -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ /** -*/ + */ if (!defined('IN_PHPBB')) { exit; } -// set up caching -/* @var $cache \phpbb\cache\service */ -$cache = $phpbb_container->get('cache'); +/** + * Sets compatibility globals in the global scope + * + * This function registers compatibility variables to the global + * variable scope. This is required to make it possible to include this file + * in a service. + */ +function register_compatibility_globals() +{ + global $phpbb_container; -// Instantiate some basic classes -/* @var $phpbb_dispatcher \phpbb\event\dispatcher */ -$phpbb_dispatcher = $phpbb_container->get('dispatcher'); + global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log; + global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; -/* @var $request \phpbb\request\request_interface */ -$request = $phpbb_container->get('request'); + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); -/* @var $user \phpbb\user */ -$user = $phpbb_container->get('user'); + // Instantiate some basic classes + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); -/* @var $auth \phpbb\auth\auth */ -$auth = $phpbb_container->get('auth'); + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); -/* @var $db \phpbb\db\driver\driver_interface */ -$db = $phpbb_container->get('dbal.conn'); + /* @var $user \phpbb\user */ + $user = $phpbb_container->get('user'); -// Grab global variables, re-cache if necessary -/* @var $config phpbb\config\db */ -$config = $phpbb_container->get('config'); + /* @var $auth \phpbb\auth\auth */ + $auth = $phpbb_container->get('auth'); -/* @var $phpbb_log \phpbb\log\log_interface */ -$phpbb_log = $phpbb_container->get('log'); + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); -/* @var $symfony_request \phpbb\symfony_request */ -$symfony_request = $phpbb_container->get('symfony_request'); + // Grab global variables, re-cache if necessary + /* @var $config phpbb\config\db */ + $config = $phpbb_container->get('config'); -/* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ -$phpbb_filesystem = $phpbb_container->get('filesystem'); + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); -/* @var $phpbb_path_helper \phpbb\path_helper */ -$phpbb_path_helper = $phpbb_container->get('path_helper'); + /* @var $symfony_request \phpbb\symfony_request */ + $symfony_request = $phpbb_container->get('symfony_request'); -// load extensions -/* @var $phpbb_extension_manager \phpbb\extension\manager */ -$phpbb_extension_manager = $phpbb_container->get('ext.manager'); + /* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ + $phpbb_filesystem = $phpbb_container->get('filesystem'); -/* @var $template \phpbb\template\template */ -$template = $phpbb_container->get('template'); + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + /* @var $template \phpbb\template\template */ + $template = $phpbb_container->get('template'); +} + +register_compatibility_globals(); From 53c5610080d45660fc8d5528135408cb9ac293cf Mon Sep 17 00:00:00 2001 From: MateBartus Date: Thu, 23 Apr 2015 14:22:05 +0200 Subject: [PATCH 03/75] [ticket/13740] Add new language file for install [ci skip] PHPBB3-13740 --- phpBB/language/en/install.php | 650 ++++++------------------------ phpBB/language/en/old_install.php | 629 +++++++++++++++++++++++++++++ 2 files changed, 752 insertions(+), 527 deletions(-) create mode 100644 phpBB/language/en/old_install.php diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 75e5d50225..59ad1b0d41 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -36,553 +36,141 @@ if (empty($lang) || !is_array($lang)) // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine +// Common installer pages $lang = array_merge($lang, array( + 'INSTALL_PANEL' => 'Installation Panel', + + // Introduction page + 'INTRODUCTION_TITLE' => 'Introduction', + 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + // Support page + 'SUPPORT_TITLE' => 'Support', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', + + // License + 'LICENSE_TITLE' => 'General Public License', +)); + +// Requirements translation +$lang = array_merge($lang, array( + // Filesystem requirements + 'FILE_NOT_EXISTS' => 'File not exists', + 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s file need to exist.', + 'FILE_NOT_WRITABLE' => 'File not writable', + 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s file need to be writable.', + + 'DIRECTORY_NOT_EXISTS' => 'Directory not exists', + 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s directory need to exist.', + 'DIRECTORY_NOT_WRITABLE' => 'Directory not writable', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s directory need to be writable.', + + // Server requirements + 'PHP_VERSION_REQD' => 'PHP version', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 5.3.9 or higher.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', +)); + +// General error messages +$lang = array_merge($lang, array( + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', +)); + +// Data obtaining translations +$lang = array_merge($lang, array( + // + // Admin data + // + 'STAGE_ADMINISTRATOR' => 'Administrator details', + + // Form labels 'ADMIN_CONFIG' => 'Administrator configuration', 'ADMIN_PASSWORD' => 'Administrator password', 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', - 'ADMIN_TEST' => 'Check administrator settings', 'ADMIN_USERNAME' => 'Administrator username', 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', - 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', - 'AUTHOR_NOTES' => 'Author notes
» %s', - 'AVAILABLE' => 'Available', - 'AVAILABLE_CONVERTORS' => 'Available convertors', - 'BEGIN_CONVERT' => 'Begin conversion', - 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', - 'BOARD_NOT_INSTALLED' => 'No installation found', - 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', - 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', - - 'CATEGORY' => 'Category', - 'CACHE_STORE' => 'Cache type', - 'CACHE_STORE_EXPLAIN' => 'The physical location where data is cached, filesystem is preferred.', - 'CAT_CONVERT' => 'Convert', - 'CAT_INSTALL' => 'Install', - 'CAT_OVERVIEW' => 'Overview', - 'CAT_UPDATE' => 'Update', - 'CHANGE' => 'Change', - 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', - 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', - 'CLEANING_USERNAMES' => 'Cleaning usernames', - 'COLLIDING_CLEAN_USERNAME' => '%s is the clean username for:', - 'COLLIDING_USERNAMES_FOUND' => 'Colliding usernames were found on your old board. In order to complete the conversion please delete or rename these users so that there is only one user on your old board for each clean username.', - 'COLLIDING_USER' => '» user id: %d username: %s (%d posts)', - 'CONFIG_CONVERT' => 'Converting the configuration', - 'CONFIG_FILE_UNABLE_WRITE' => 'It was not possible to write the configuration file. Alternative methods for this file to be created are presented below.', - 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', - 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', - 'CONFIG_RETRY' => 'Retry', - 'CONTINUE_CONVERT' => 'Continue conversion', - 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', - 'CONTINUE_LAST' => 'Continue last statements', - 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', - 'CONVERT' => 'Convert', - 'CONVERT_COMPLETE' => 'Conversion completed', - 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', - 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', - 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', - 'CONVERT_NEW_CONVERSION' => 'New conversion', - 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', - 'CONVERT_OPTIONS' => 'Options', - 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, please push the button below.', - 'CONV_ERR_FATAL' => 'Fatal conversion error', - - 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', - 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', - 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', - 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', - 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', - 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', - 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', - 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', - 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', - 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', - 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', - 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', - 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', - 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', - 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', - 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', - 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', - 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', - 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', - 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', - 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', - 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', - 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', - 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', - 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', - 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', - 'CONV_SAVED_MESSAGES' => 'Saved messages', - - 'COULD_NOT_COPY' => 'Could not copy file %1$s to %2$s

Please check that the target directory exists and is writable by the webserver.', - 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', - - 'DBMS' => 'Database type', - 'DB_CONFIG' => 'Database configuration', - 'DB_CONNECTION' => 'Database connection', - 'DB_ERR_INSERT' => 'Error while processing INSERT query.', - 'DB_ERR_LAST' => 'Error while processing query_last.', - 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', - 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', - 'DB_ERR_SELECT' => 'Error while running SELECT query.', - 'DB_HOST' => 'Database server hostname or DSN', - 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', - 'DB_NAME' => 'Database name', - 'DB_PASSWORD' => 'Database password', - 'DB_PORT' => 'Database server port', - 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', - 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$s”. The version you currently have installed is “%2$s”. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', - 'DB_USERNAME' => 'Database username', - 'DB_TEST' => 'Test connection', - 'DEFAULT_LANG' => 'Default board language', - 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', - 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', - 'DIRECTORIES_AND_FILES' => 'Directory and file setup', - 'DISABLE_KEYS' => 'Disabling keys', - 'DLL_FTP' => 'Remote FTP support [ Installation ]', - 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', - 'DLL_MBSTRING' => 'Multi-byte character support', - 'DLL_MSSQL' => 'MSSQL Server 2000+', - 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', - 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', - 'DLL_MYSQL' => 'MySQL', - 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', - 'DLL_ORACLE' => 'Oracle', - 'DLL_POSTGRES' => 'PostgreSQL', - 'DLL_SQLITE' => 'SQLite 2', - 'DLL_SQLITE3' => 'SQLite 3', - 'DLL_XML' => 'XML support [ Jabber ]', - 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', - 'DL_CONFIG' => 'Download config', - 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', - 'DL_DOWNLOAD' => 'Download', - 'DONE' => 'Done', - - 'ENABLE_KEYS' => 'Re-enabling keys. This can take a while.', - - 'FILES_OPTIONAL' => 'Optional files and directories', - 'FILES_OPTIONAL_EXPLAIN' => 'Optional - These files, directories or permission settings are not required. The installation system will attempt to use various techniques to create them if they do not exist or cannot be written to. However, the presence of these will speed installation.', - 'FILES_REQUIRED' => 'Files and Directories', - 'FILES_REQUIRED_EXPLAIN' => 'Required - In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see “Not Found” you need to create the relevant file or directory. If you see “Unwritable” you need to change the permissions on the file or directory to allow phpBB to write to it.', - 'FILLING_TABLE' => 'Filling table %s', - 'FILLING_TABLES' => 'Filling tables', - - 'FINAL_STEP' => 'Process final step', - 'FORUM_ADDRESS' => 'Board address', - 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example http://www.example.com/phpBB2/. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', - 'FORUM_PATH' => 'Board path', - 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', - 'FOUND' => 'Found', - 'FTP_CONFIG' => 'Transfer config by FTP', - 'FTP_CONFIG_EXPLAIN' => 'phpBB has detected the presence of the FTP module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are).', - 'FTP_PATH' => 'FTP path', - 'FTP_PATH_EXPLAIN' => 'This is the path from your root directory to that of phpBB, e.g. htdocs/phpBB3/.', - 'FTP_UPLOAD' => 'Upload', - - 'GPL' => 'General Public License', - - 'INITIAL_CONFIG' => 'Basic configuration', - 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', - 'INSTALL_CONGRATS' => 'Congratulations!', - 'INSTALL_CONGRATS_EXPLAIN' => ' - You have successfully installed phpBB %1$s. Please proceed by choosing one of the following options:

-

Convert an existing board to phpBB3

-

The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.

-

Go live with your phpBB3!

-

Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.

Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.', - 'INSTALL_INTRO' => 'Welcome to Installation', - - 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

- -
    -
  • The Database Type - the database you will be using.
  • -
  • The Database server hostname or DSN - the address of the database server.
  • -
  • The Database server port - the port of the database server (most of the time this is not needed).
  • -
  • The Database name - the name of the database on the server.
  • -
  • The Database username and Database password - the login data to access the database.
  • -
- -

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

- -

phpBB3 supports the following databases:

-
    -
  • MySQL 3.23 or above (MySQLi supported)
  • -
  • PostgreSQL 8.3+
  • -
  • SQLite 2.8.2+
  • -
  • SQLite 3.6.15+
  • -
  • MS SQL Server 2000 or above (directly or via ODBC)
  • -
  • MS SQL Server 2005 or above (native)
  • -
  • Oracle
  • -
- -

Only those databases supported on your server will be displayed.', - 'INSTALL_INTRO_NEXT' => 'To commence the installation, please press the button below.', - 'INSTALL_LOGIN' => 'Login', - 'INSTALL_NEXT' => 'Next stage', - 'INSTALL_NEXT_FAIL' => 'Some tests failed and you should correct these problems before proceeding to the next stage. Failure to do so may result in an incomplete installation.', - 'INSTALL_NEXT_PASS' => 'All the basic tests have been passed and you may proceed to the next stage of installation. If you have changed any permissions, modules, etc. and wish to re-test you can do so if you wish.', - 'INSTALL_PANEL' => 'Installation Panel', - 'INSTALL_SEND_CONFIG' => 'Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writable. A number of options will be listed below enabling you to complete installation of config.php.', - 'INSTALL_START' => 'Start install', - 'INSTALL_TEST' => 'Test again', - 'INST_ERR' => 'Installation error', - 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', - 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', - 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', - 'INST_ERR_DB_NO_ERROR' => 'No error message given.', - 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', - 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', - 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', - 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', - 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', - 'INST_ERR_DB_NO_NAME' => 'No database name specified.', - 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', - 'INST_ERR_EMAIL_MISMATCH' => 'The emails you entered did not match.', - 'INST_ERR_FATAL' => 'Fatal installation error', - 'INST_ERR_FATAL_DB' => 'A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.', - 'INST_ERR_FTP_PATH' => 'Could not change to the given directory, please check the path.', - 'INST_ERR_FTP_LOGIN' => 'Could not login to FTP server, check your username and password.', - 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', - 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + // Errors + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', - 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', - 'INST_ERR_PREFIX_INVALID' => 'The table prefix you have specified is invalid for your database. Please try another, removing characters such as the hyphen.', - 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', - 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', - 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', - 'INVALID_PRIMARY_KEY' => 'Invalid primary key : %s', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', - 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', + // + // Board data + // + // Form labels + 'BOARD_CONFIG' => 'Bulletin board configuration', + 'DEFAULT_LANGUAGE' => 'Default language', + 'BOARD_NAME' => 'Title of the board', + 'BOARD_DESCRIPTION' => 'Short description of the board', - // mbstring - 'MBSTRING_CHECK' => 'mbstring extension check', - 'MBSTRING_CHECK_EXPLAIN' => 'Required - mbstring is a PHP extension that provides multibyte string functions. Certain features of mbstring are not compatible with phpBB and must be disabled.', - 'MBSTRING_FUNC_OVERLOAD' => 'Function overloading', - 'MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4.', - 'MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding', - 'MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0.', - 'MBSTRING_HTTP_INPUT' => 'HTTP input character conversion', - 'MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass.', - 'MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion', - 'MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass.', + // + // Database data + // + 'STAGE_DATABASE' => 'Database settings', - 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', - 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', + // Form labels + 'DB_CONFIG' => 'Database configuration', + 'DBMS' => 'Database type', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_PASSWORD' => 'Database password', + 'DB_NAME' => 'Database name', + 'DB_USERNAME' => 'Database username', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', - 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.
Before you proceed the update, you need to upgrade the schema.

Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.', + // Database options + 'DB_OPTION_MSSQL' => 'MSSQL Server 2000+', + 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DB_OPTION_MYSQL' => 'MySQL', + 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', + 'DB_OPTION_ORACLE' => 'Oracle', + 'DB_OPTION_POSTGRES' => 'PostgreSQL', + 'DB_OPTION_SQLITE' => 'SQLite 2', + 'DB_OPTION_SQLITE3' => 'SQLite 3', - 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', - 'NEXT_STEP' => 'Proceed to next step', - 'NOT_FOUND' => 'Cannot find', - 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', - 'NO_CONVERTORS' => 'No convertors are available for use.', - 'NO_CONVERT_SPECIFIED' => 'No convertor specified.', - 'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel', - 'NO_TABLES_FOUND' => 'No tables found.', + // Errors + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', - 'OVERVIEW_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', - - 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', - 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', - 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available', - 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the getimagesize function needs to be available.', - 'PHP_JSON_SUPPORT' => 'PHP JSON support', - 'PHP_JSON_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the PHP JSON extension needs to be available.', - 'PHP_OPTIONAL_MODULE' => 'Optional modules', - 'PHP_OPTIONAL_MODULE_EXPLAIN' => 'Optional - These modules or applications are optional. However, if they are available they will enable extra features.', - 'PHP_SUPPORTED_DB' => 'Supported databases', - 'PHP_SUPPORTED_DB_EXPLAIN' => 'Required - You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', - 'PHP_REGISTER_GLOBALS' => 'PHP setting register_globals is disabled', - 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', - 'PHP_SAFE_MODE' => 'Safe mode', - 'PHP_SETTINGS' => 'PHP version and settings', - 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.9 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', - 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting allow_url_fopen is enabled', - 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', - 'PHP_VERSION_REQD' => 'PHP version >= 5.3.9', - 'POST_ID' => 'Post ID', - 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', - 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', - 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', - 'PROCESS_LAST' => 'Processing last statements', - - 'REFRESH_PAGE' => 'Refresh page to continue conversion', - 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', - 'REQUIREMENTS_TITLE' => 'Installation compatibility', - 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with the full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to use any of the features depending on the optional tests, you should ensure that these tests are passed also.', - 'RETRY_WRITE' => 'Retry writing config', - 'RETRY_WRITE_EXPLAIN' => 'If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB has finished installation.', + // + // Email data + // + 'EMAIL_CONFIG' => 'E-mail configuration', + // + // Server data + // + // Form labels + 'SERVER_CONFIG' => 'Server configuration', 'SCRIPT_PATH' => 'Script path', 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', - 'SELECT_LANG' => 'Select language', - 'SERVER_CONFIG' => 'Server configuration', - 'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted', - 'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.', - 'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):', - 'SOFTWARE' => 'Board software', - 'SPECIFY_OPTIONS' => 'Specify conversion options', - 'STAGE_ADMINISTRATOR' => 'Administrator details', - 'STAGE_ADVANCED' => 'Advanced settings', - 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', - 'STAGE_CONFIG_FILE' => 'Configuration file', - 'STAGE_CREATE_TABLE' => 'Create database tables', - 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', - 'STAGE_DATABASE' => 'Database settings', - 'STAGE_FINAL' => 'Final stage', - 'STAGE_INTRO' => 'Introduction', - 'STAGE_IN_PROGRESS' => 'Conversion in progress', - 'STAGE_REQUIREMENTS' => 'Requirements', - 'STAGE_SETTINGS' => 'Settings', - 'STARTING_CONVERT' => 'Starting conversion process', - 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', - 'SUB_INTRO' => 'Introduction', - 'SUB_LICENSE' => 'License', - 'SUB_SUPPORT' => 'Support', - 'SUCCESSFUL_CONNECT' => 'Successful connection', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', - 'SYNC_FORUMS' => 'Starting to synchronise forums', - 'SYNC_POST_COUNT' => 'Synchronising post_counts', - 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', - 'SYNC_TOPICS' => 'Starting to synchronise topics', - 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', - - 'TABLES_MISSING' => 'Could not find these tables
» %s.', - 'TABLE_PREFIX' => 'Prefix for tables in database', - 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', - 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', - 'TESTS_PASSED' => 'Tests passed', - 'TESTS_FAILED' => 'Tests failed', - - 'UNABLE_WRITE_LOCK' => 'Unable to write lock file.', - 'UNAVAILABLE' => 'Unavailable', - 'UNWRITABLE' => 'Unwritable', - 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', - 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', - 'VERIFY_OPTIONS' => 'Verifying conversion options', - 'VERSION' => 'Version', - - 'WELCOME_INSTALL' => 'Welcome to phpBB3 Installation', - 'WRITABLE' => 'Writable', -)); - -// Updater -$lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', - 'ARCHIVE_FILE' => 'Source file within archive', - - 'BACK' => 'Back', - 'BINARY_FILE' => 'Binary file', - 'BOT' => 'Spider/Robot', - - 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', - 'CHECK_FILES' => 'Check files', - 'CHECK_FILES_AGAIN' => 'Check files again', - 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', - 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', - 'CHECK_UPDATE_DATABASE' => 'Continue update process', - 'COLLECTED_INFORMATION' => 'File information', - 'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', - 'COLLECTING_FILE_DIFFS' => 'Collecting file differences', - 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory!', - 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater - 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished - 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', - 'CURRENT_VERSION' => 'Current version', - - 'DATABASE_TYPE' => 'Database type', - 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', - 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', - 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', - 'DELETE_USER_REMOVE' => 'Delete user and remove posts', - 'DELETE_USER_RETAIN' => 'Delete user but keep posts', - 'DESTINATION' => 'Destination file', - 'DIFF_INLINE' => 'Inline', - 'DIFF_RAW' => 'Raw unified diff', - 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', - 'DIFF_SIDE_BY_SIDE' => 'Side by Side', - 'DIFF_UNIFIED' => 'Unified diff', - 'DO_NOT_UPDATE' => 'Do not update this file', - 'DONE' => 'Done', - 'DOWNLOAD' => 'Download', - 'DOWNLOAD_AS' => 'Download as', - 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', - 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', - 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', - 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', - 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - - 'EDIT_USERNAME' => 'Edit username', - 'ERROR' => 'Error', - 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', - - 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', - 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', - 'FILE_USED' => 'Information used from', // Single file - 'FILES_CONFLICT' => 'Conflict files', - 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', - 'FILES_DELETED' => 'Deleted files', - 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', - 'FILES_MODIFIED' => 'Modified files', - 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', - 'FILES_NEW' => 'New files', - 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', - 'FILES_NEW_CONFLICT' => 'New conflicting files', - 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', - 'FILES_NOT_MODIFIED' => 'Not modified files', - 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', - 'FILES_UP_TO_DATE' => 'Already updated files', - 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', - 'FTP_SETTINGS' => 'FTP settings', - 'FTP_UPDATE_METHOD' => 'FTP upload', - - 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', - 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete.', - 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.', - - 'KEEP_OLD_NAME' => 'Keep username', - - 'LATEST_VERSION' => 'Latest version', - 'LINE' => 'Line', - 'LINE_ADDED' => 'Added', - 'LINE_MODIFIED' => 'Modified', - 'LINE_REMOVED' => 'Removed', - 'LINE_UNMODIFIED' => 'Unmodified', - 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', - - 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', - - 'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications', - - 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', - 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', - 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (removes new phpBB code within conflicting block)', - 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (removes modified code within conflicting block)', - 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', - 'MERGING_FILES' => 'Merging differences', - 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.

Please wait until phpBB has completed all operations on changed files.', - - 'NEW_FILE' => 'End of Conflict', - 'NEW_USERNAME' => 'New username', - 'NO_AUTH_UPDATE' => 'Not authorised to update', - 'NO_ERRORS' => 'No errors', - 'NO_UPDATE_FILES' => 'Not updating the following files', - 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', - 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit https://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.', - 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', - 'NO_UPDATE_INFO' => 'Update file information could not be found.', - 'NO_UPDATES_REQUIRED' => 'No updates required', - 'NO_VISIBLE_CHANGES' => 'No visible changes', - 'NOTICE' => 'Notice', - 'NUM_CONFLICTS' => 'Number of conflicts', - 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.
Please wait until all files are checked.', - - 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', - - 'PACKAGE_UPDATES_TO' => 'Current package updates to version', - 'PERFORM_DATABASE_UPDATE' => 'Perform database update', - 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a button to the database update script. The database update can take a while, so please do not stop the execution if it seems to hang. After the database update has been performed just follow the instructions to continue the update process.', - 'PREVIOUS_VERSION' => 'Previous version', - 'PROGRESS' => 'Progress', - - 'RELEASE_ANNOUNCEMENT' => 'Announcement', - 'RESULT' => 'Result', - 'RUN_DATABASE_SCRIPT' => 'Update my database now', - - 'SELECT_DIFF_MODE' => 'Select diff mode', - 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', - 'SELECT_FTP_SETTINGS' => 'Select FTP settings', - 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', - 'SHOW_DIFF_DELETED' => 'Show file contents', - 'SHOW_DIFF_FINAL' => 'Show resulting file', - 'SHOW_DIFF_MODIFIED' => 'Show merged differences', - 'SHOW_DIFF_NEW' => 'Show file contents', - 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', - 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', - 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.', - 'SQL' => 'SQL', - 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See README for details on how to obtain advice.', - 'STAGE_FILE_CHECK' => 'Check files', - 'STAGE_UPDATE_DB' => 'Update database', - 'STAGE_UPDATE_FILES' => 'Update files', - 'STAGE_VERSION_CHECK' => 'Version check', - 'STATUS_CONFLICT' => 'Modified file producing conflicts', - 'STATUS_DELETED' => 'Deleted file', - 'STATUS_MODIFIED' => 'Modified file', - 'STATUS_NEW' => 'New file', - 'STATUS_NEW_CONFLICT' => 'Conflicting new file', - 'STATUS_NOT_MODIFIED' => 'Not modified file', - 'STATUS_UP_TO_DATE' => 'Already updated file', - - 'TOGGLE_DISPLAY' => 'View/Hide file list', - 'TRY_DOWNLOAD_METHOD' => 'You may want to try the download modified files method.
This method always works and is also the recommended update path.', - 'TRY_DOWNLOAD_METHOD_BUTTON'=> 'Try this method now', - - 'UPDATE_COMPLETED' => 'Update completed', - 'UPDATE_DATABASE' => 'Update database', - 'UPDATE_DATABASE_EXPLAIN' => 'Within the next step the database will be updated.', - 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', - 'UPDATE_FILES' => 'Update files', - 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', - 'UPDATE_INSTALLATION' => 'Update phpBB installation', - 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', - 'UPDATE_INSTRUCTIONS' => ' - -

Release announcement

- -

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

- -
- -

How to update your installation with the Automatic Update Package

- -

The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:

- -
    -
  • Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.

  • -
  • Unpack the archive.

  • -
  • Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  • -
- -

Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.

- Now start the update process by pointing your browser to the install folder.
-
- You will then be guided through the update process. You will be notified once the update is complete. -

- ', - 'UPDATE_METHOD' => 'Update method', - 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', - 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', - 'UPDATE_SUCCESS' => 'Update was successful', - 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', - 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimising tables', - 'UPDATING_DATA' => 'Updating data', - 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', - 'UPDATED_VERSION' => 'Updated version', - 'UPLOAD_METHOD' => 'Upload method', - - 'UPDATE_DB_SUCCESS' => 'Database update was successful.', - 'UPDATE_FILE_SUCCESS' => 'File update was successful.', - 'USER_ACTIVE' => 'Active user', - 'USER_INACTIVE' => 'Inactive user', - - 'VERSION_CHECK' => 'Version check', - 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', - 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', - 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', - 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', - 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', - 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', - 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', - 'VIEWING_FILE_DIFF' => 'Viewing file differences', - - 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', )); // Default database schema entries... @@ -630,3 +218,11 @@ $lang = array_merge($lang, array( 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', )); + +// Common navigation items' translation +$lang = array_merge($lang, array( + 'MENU_OVERVIEW' => 'Overview', + 'MENU_INTRO' => 'Introduction', + 'MENU_LICENSE' => 'License', + 'MENU_SUPPORT' => 'Support', +)); diff --git a/phpBB/language/en/old_install.php b/phpBB/language/en/old_install.php new file mode 100644 index 0000000000..a776a539ed --- /dev/null +++ b/phpBB/language/en/old_install.php @@ -0,0 +1,629 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_TEST' => 'Check administrator settings', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', + 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', + 'AUTHOR_NOTES' => 'Author notes
» %s', + 'AVAILABLE' => 'Available', + 'AVAILABLE_CONVERTORS' => 'Available convertors', + + 'BEGIN_CONVERT' => 'Begin conversion', + 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', + 'BOARD_NOT_INSTALLED' => 'No installation found', + 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', + 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', + + 'CATEGORY' => 'Category', + 'CACHE_STORE' => 'Cache type', + 'CACHE_STORE_EXPLAIN' => 'The physical location where data is cached, filesystem is preferred.', + 'CAT_CONVERT' => 'Convert', + 'CAT_INSTALL' => 'Install', + 'CAT_OVERVIEW' => 'Overview', + 'CAT_UPDATE' => 'Update', + 'CHANGE' => 'Change', + 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', + 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', + 'CLEANING_USERNAMES' => 'Cleaning usernames', + 'COLLIDING_CLEAN_USERNAME' => '%s is the clean username for:', + 'COLLIDING_USERNAMES_FOUND' => 'Colliding usernames were found on your old board. In order to complete the conversion please delete or rename these users so that there is only one user on your old board for each clean username.', + 'COLLIDING_USER' => '» user id: %d username: %s (%d posts)', + 'CONFIG_CONVERT' => 'Converting the configuration', + 'CONFIG_FILE_UNABLE_WRITE' => 'It was not possible to write the configuration file. Alternative methods for this file to be created are presented below.', + 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', + 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', + 'CONFIG_RETRY' => 'Retry', + 'CONTINUE_CONVERT' => 'Continue conversion', + 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', + 'CONTINUE_LAST' => 'Continue last statements', + 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', + 'CONVERT' => 'Convert', + 'CONVERT_COMPLETE' => 'Conversion completed', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', + 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', + 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', + 'CONVERT_NEW_CONVERSION' => 'New conversion', + 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', + 'CONVERT_OPTIONS' => 'Options', + 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, please push the button below.', + 'CONV_ERR_FATAL' => 'Fatal conversion error', + + 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', + 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', + 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', + 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', + 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', + 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', + 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', + 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', + 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', + 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', + 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', + 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', + 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', + 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', + 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', + 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', + 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', + 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', + 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', + 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', + 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', + 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', + 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', + 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', + 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', + 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', + 'CONV_SAVED_MESSAGES' => 'Saved messages', + + 'COULD_NOT_COPY' => 'Could not copy file %1$s to %2$s

Please check that the target directory exists and is writable by the webserver.', + 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', + + 'DBMS' => 'Database type', + 'DB_CONFIG' => 'Database configuration', + 'DB_CONNECTION' => 'Database connection', + 'DB_ERR_INSERT' => 'Error while processing INSERT query.', + 'DB_ERR_LAST' => 'Error while processing query_last.', + 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', + 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', + 'DB_ERR_SELECT' => 'Error while running SELECT query.', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_NAME' => 'Database name', + 'DB_PASSWORD' => 'Database password', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$s”. The version you currently have installed is “%2$s”. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', + 'DB_USERNAME' => 'Database username', + 'DB_TEST' => 'Test connection', + 'DEFAULT_LANG' => 'Default board language', + 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', + 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', + 'DIRECTORIES_AND_FILES' => 'Directory and file setup', + 'DISABLE_KEYS' => 'Disabling keys', + 'DLL_FTP' => 'Remote FTP support [ Installation ]', + 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', + 'DLL_MBSTRING' => 'Multi-byte character support', + 'DLL_MSSQL' => 'MSSQL Server 2000+', + 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DLL_MYSQL' => 'MySQL', + 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', + 'DLL_ORACLE' => 'Oracle', + 'DLL_POSTGRES' => 'PostgreSQL', + 'DLL_SQLITE' => 'SQLite 2', + 'DLL_SQLITE3' => 'SQLite 3', + 'DLL_XML' => 'XML support [ Jabber ]', + 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', + 'DL_CONFIG' => 'Download config', + 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', + 'DL_DOWNLOAD' => 'Download', + 'DONE' => 'Done', + + 'ENABLE_KEYS' => 'Re-enabling keys. This can take a while.', + + 'FILES_OPTIONAL' => 'Optional files and directories', + 'FILES_OPTIONAL_EXPLAIN' => 'Optional - These files, directories or permission settings are not required. The installation system will attempt to use various techniques to create them if they do not exist or cannot be written to. However, the presence of these will speed installation.', + 'FILES_REQUIRED' => 'Files and Directories', + 'FILES_REQUIRED_EXPLAIN' => 'Required - In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see “Not Found” you need to create the relevant file or directory. If you see “Unwritable” you need to change the permissions on the file or directory to allow phpBB to write to it.', + 'FILLING_TABLE' => 'Filling table %s', + 'FILLING_TABLES' => 'Filling tables', + + 'FINAL_STEP' => 'Process final step', + 'FORUM_ADDRESS' => 'Board address', + 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example http://www.example.com/phpBB2/. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', + 'FORUM_PATH' => 'Board path', + 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', + 'FOUND' => 'Found', + 'FTP_CONFIG' => 'Transfer config by FTP', + 'FTP_CONFIG_EXPLAIN' => 'phpBB has detected the presence of the FTP module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are).', + 'FTP_PATH' => 'FTP path', + 'FTP_PATH_EXPLAIN' => 'This is the path from your root directory to that of phpBB, e.g. htdocs/phpBB3/.', + 'FTP_UPLOAD' => 'Upload', + + 'GPL' => 'General Public License', + + 'INITIAL_CONFIG' => 'Basic configuration', + 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', + 'INSTALL_CONGRATS' => 'Congratulations!', + 'INSTALL_CONGRATS_EXPLAIN' => ' + You have successfully installed phpBB %1$s. Please proceed by choosing one of the following options:

+

Convert an existing board to phpBB3

+

The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.

+

Go live with your phpBB3!

+

Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.

Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.', + 'INSTALL_INTRO' => 'Welcome to Installation', + + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ +
    +
  • The Database Type - the database you will be using.
  • +
  • The Database server hostname or DSN - the address of the database server.
  • +
  • The Database server port - the port of the database server (most of the time this is not needed).
  • +
  • The Database name - the name of the database on the server.
  • +
  • The Database username and Database password - the login data to access the database.
  • +
+ +

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

+ +

phpBB3 supports the following databases:

+
    +
  • MySQL 3.23 or above (MySQLi supported)
  • +
  • PostgreSQL 8.3+
  • +
  • SQLite 2.8.2+
  • +
  • SQLite 3.6.15+
  • +
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • +
  • Oracle
  • +
+ +

Only those databases supported on your server will be displayed.', + 'INSTALL_INTRO_NEXT' => 'To commence the installation, please press the button below.', + 'INSTALL_LOGIN' => 'Login', + 'INSTALL_NEXT' => 'Next stage', + 'INSTALL_NEXT_FAIL' => 'Some tests failed and you should correct these problems before proceeding to the next stage. Failure to do so may result in an incomplete installation.', + 'INSTALL_NEXT_PASS' => 'All the basic tests have been passed and you may proceed to the next stage of installation. If you have changed any permissions, modules, etc. and wish to re-test you can do so if you wish.', + 'INSTALL_PANEL' => 'Installation Panel', + 'INSTALL_SEND_CONFIG' => 'Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writable. A number of options will be listed below enabling you to complete installation of config.php.', + 'INSTALL_START' => 'Start install', + 'INSTALL_TEST' => 'Test again', + 'INST_ERR' => 'Installation error', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_EMAIL_MISMATCH' => 'The emails you entered did not match.', + 'INST_ERR_FATAL' => 'Fatal installation error', + 'INST_ERR_FATAL_DB' => 'A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.', + 'INST_ERR_FTP_PATH' => 'Could not change to the given directory, please check the path.', + 'INST_ERR_FTP_LOGIN' => 'Could not login to FTP server, check your username and password.', + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_PREFIX_INVALID' => 'The table prefix you have specified is invalid for your database. Please try another, removing characters such as the hyphen.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + 'INVALID_PRIMARY_KEY' => 'Invalid primary key : %s', + + 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', + + // mbstring + 'MBSTRING_CHECK' => 'mbstring extension check', + 'MBSTRING_CHECK_EXPLAIN' => 'Required - mbstring is a PHP extension that provides multibyte string functions. Certain features of mbstring are not compatible with phpBB and must be disabled.', + 'MBSTRING_FUNC_OVERLOAD' => 'Function overloading', + 'MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4.', + 'MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding', + 'MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0.', + 'MBSTRING_HTTP_INPUT' => 'HTTP input character conversion', + 'MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass.', + 'MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion', + 'MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass.', + + 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', + 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', + + 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.
Before you proceed the update, you need to upgrade the schema.

Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.', + + 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', + 'NEXT_STEP' => 'Proceed to next step', + 'NOT_FOUND' => 'Cannot find', + 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', + 'NO_CONVERTORS' => 'No convertors are available for use.', + 'NO_CONVERT_SPECIFIED' => 'No convertor specified.', + 'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel', + 'NO_TABLES_FOUND' => 'No tables found.', + + 'OVERVIEW_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_OPTIONAL_MODULE' => 'Optional modules', + 'PHP_OPTIONAL_MODULE_EXPLAIN' => 'Optional - These modules or applications are optional. However, if they are available they will enable extra features.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'Required - You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + 'PHP_REGISTER_GLOBALS' => 'PHP setting register_globals is disabled', + 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', + 'PHP_SAFE_MODE' => 'Safe mode', + 'PHP_SETTINGS' => 'PHP version and settings', + 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.9 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', + 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting allow_url_fopen is enabled', + 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', + 'PHP_VERSION_REQD' => 'PHP version >= 5.3.9', + 'POST_ID' => 'Post ID', + 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', + 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', + 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', + 'PROCESS_LAST' => 'Processing last statements', + + 'REFRESH_PAGE' => 'Refresh page to continue conversion', + 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', + 'REQUIREMENTS_TITLE' => 'Installation compatibility', + 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with the full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to use any of the features depending on the optional tests, you should ensure that these tests are passed also.', + 'RETRY_WRITE' => 'Retry writing config', + 'RETRY_WRITE_EXPLAIN' => 'If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB has finished installation.', + + 'SELECT_LANG' => 'Select language', + 'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted', + 'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.', + 'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):', + 'SOFTWARE' => 'Board software', + 'SPECIFY_OPTIONS' => 'Specify conversion options', + 'STAGE_ADMINISTRATOR' => 'Administrator details', + 'STAGE_ADVANCED' => 'Advanced settings', + 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', + 'STAGE_CONFIG_FILE' => 'Configuration file', + 'STAGE_CREATE_TABLE' => 'Create database tables', + 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', + 'STAGE_DATABASE' => 'Database settings', + 'STAGE_FINAL' => 'Final stage', + 'STAGE_INTRO' => 'Introduction', + 'STAGE_IN_PROGRESS' => 'Conversion in progress', + 'STAGE_REQUIREMENTS' => 'Requirements', + 'STAGE_SETTINGS' => 'Settings', + 'STARTING_CONVERT' => 'Starting conversion process', + 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', + 'SUB_INTRO' => 'Introduction', + 'SUB_LICENSE' => 'License', + 'SUB_SUPPORT' => 'Support', + 'SUCCESSFUL_CONNECT' => 'Successful connection', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', + 'SYNC_FORUMS' => 'Starting to synchronise forums', + 'SYNC_POST_COUNT' => 'Synchronising post_counts', + 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', + 'SYNC_TOPICS' => 'Starting to synchronise topics', + 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', + + 'TABLES_MISSING' => 'Could not find these tables
» %s.', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', + 'TESTS_PASSED' => 'Tests passed', + 'TESTS_FAILED' => 'Tests failed', + + 'UNABLE_WRITE_LOCK' => 'Unable to write lock file.', + 'UNAVAILABLE' => 'Unavailable', + 'UNWRITABLE' => 'Unwritable', + 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', + 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', + 'VERIFY_OPTIONS' => 'Verifying conversion options', + 'VERSION' => 'Version', + + 'WELCOME_INSTALL' => 'Welcome to phpBB3 Installation', + 'WRITABLE' => 'Writable', +)); + +// Updater +$lang = array_merge($lang, array( + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', + 'ARCHIVE_FILE' => 'Source file within archive', + + 'BACK' => 'Back', + 'BINARY_FILE' => 'Binary file', + 'BOT' => 'Spider/Robot', + + 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', + 'CHECK_FILES' => 'Check files', + 'CHECK_FILES_AGAIN' => 'Check files again', + 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', + 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', + 'CHECK_UPDATE_DATABASE' => 'Continue update process', + 'COLLECTED_INFORMATION' => 'File information', + 'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', + 'COLLECTING_FILE_DIFFS' => 'Collecting file differences', + 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory!', + 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater + 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished + 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', + 'CURRENT_VERSION' => 'Current version', + + 'DATABASE_TYPE' => 'Database type', + 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', + 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', + 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', + 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', + 'DELETE_USER_REMOVE' => 'Delete user and remove posts', + 'DELETE_USER_RETAIN' => 'Delete user but keep posts', + 'DESTINATION' => 'Destination file', + 'DIFF_INLINE' => 'Inline', + 'DIFF_RAW' => 'Raw unified diff', + 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', + 'DIFF_SIDE_BY_SIDE' => 'Side by Side', + 'DIFF_UNIFIED' => 'Unified diff', + 'DO_NOT_UPDATE' => 'Do not update this file', + 'DONE' => 'Done', + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_AS' => 'Download as', + 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', + 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', + 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', + 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', + + 'EDIT_USERNAME' => 'Edit username', + 'ERROR' => 'Error', + 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', + 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', + 'FILE_USED' => 'Information used from', // Single file + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'FTP_SETTINGS' => 'FTP settings', + 'FTP_UPDATE_METHOD' => 'FTP upload', + + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', + 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete.', + 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.', + + 'KEEP_OLD_NAME' => 'Keep username', + + 'LATEST_VERSION' => 'Latest version', + 'LINE' => 'Line', + 'LINE_ADDED' => 'Added', + 'LINE_MODIFIED' => 'Modified', + 'LINE_REMOVED' => 'Removed', + 'LINE_UNMODIFIED' => 'Unmodified', + 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', + + 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', + + 'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications', + + 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', + 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', + 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (removes new phpBB code within conflicting block)', + 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (removes modified code within conflicting block)', + 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', + 'MERGING_FILES' => 'Merging differences', + 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.

Please wait until phpBB has completed all operations on changed files.', + + 'NEW_FILE' => 'End of Conflict', + 'NEW_USERNAME' => 'New username', + 'NO_AUTH_UPDATE' => 'Not authorised to update', + 'NO_ERRORS' => 'No errors', + 'NO_UPDATE_FILES' => 'Not updating the following files', + 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', + 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit https://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.', + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'NO_UPDATE_INFO' => 'Update file information could not be found.', + 'NO_UPDATES_REQUIRED' => 'No updates required', + 'NO_VISIBLE_CHANGES' => 'No visible changes', + 'NOTICE' => 'Notice', + 'NUM_CONFLICTS' => 'Number of conflicts', + 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.
Please wait until all files are checked.', + + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + + 'PACKAGE_UPDATES_TO' => 'Current package updates to version', + 'PERFORM_DATABASE_UPDATE' => 'Perform database update', + 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a button to the database update script. The database update can take a while, so please do not stop the execution if it seems to hang. After the database update has been performed just follow the instructions to continue the update process.', + 'PREVIOUS_VERSION' => 'Previous version', + 'PROGRESS' => 'Progress', + + 'RELEASE_ANNOUNCEMENT' => 'Announcement', + 'RESULT' => 'Result', + 'RUN_DATABASE_SCRIPT' => 'Update my database now', + + 'SELECT_DIFF_MODE' => 'Select diff mode', + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + 'SELECT_FTP_SETTINGS' => 'Select FTP settings', + 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_DELETED' => 'Show file contents', + 'SHOW_DIFF_FINAL' => 'Show resulting file', + 'SHOW_DIFF_MODIFIED' => 'Show merged differences', + 'SHOW_DIFF_NEW' => 'Show file contents', + 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', + 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', + 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.', + 'SQL' => 'SQL', + 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See README for details on how to obtain advice.', + 'STAGE_FILE_CHECK' => 'Check files', + 'STAGE_UPDATE_DB' => 'Update database', + 'STAGE_UPDATE_FILES' => 'Update files', + 'STAGE_VERSION_CHECK' => 'Version check', + 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'STATUS_DELETED' => 'Deleted file', + 'STATUS_MODIFIED' => 'Modified file', + 'STATUS_NEW' => 'New file', + 'STATUS_NEW_CONFLICT' => 'Conflicting new file', + 'STATUS_NOT_MODIFIED' => 'Not modified file', + 'STATUS_UP_TO_DATE' => 'Already updated file', + + 'TOGGLE_DISPLAY' => 'View/Hide file list', + 'TRY_DOWNLOAD_METHOD' => 'You may want to try the download modified files method.
This method always works and is also the recommended update path.', + 'TRY_DOWNLOAD_METHOD_BUTTON'=> 'Try this method now', + + 'UPDATE_COMPLETED' => 'Update completed', + 'UPDATE_DATABASE' => 'Update database', + 'UPDATE_DATABASE_EXPLAIN' => 'Within the next step the database will be updated.', + 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', + 'UPDATE_FILES' => 'Update files', + 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', + 'UPDATE_INSTALLATION' => 'Update phpBB installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', + 'UPDATE_INSTRUCTIONS' => ' + +

Release announcement

+ +

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+ +
+ +

How to update your installation with the Automatic Update Package

+ +

The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:

+ +
    +
  • Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.

  • +
  • Unpack the archive.

  • +
  • Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  • +
+ +

Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.

+ Now start the update process by pointing your browser to the install folder.
+
+ You will then be guided through the update process. You will be notified once the update is complete. +

+ ', + 'UPDATE_METHOD' => 'Update method', + 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', + 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', + 'UPDATE_SUCCESS' => 'Update was successful', + 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', + 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimising tables', + 'UPDATING_DATA' => 'Updating data', + 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', + 'UPDATED_VERSION' => 'Updated version', + 'UPLOAD_METHOD' => 'Upload method', + + 'UPDATE_DB_SUCCESS' => 'Database update was successful.', + 'UPDATE_FILE_SUCCESS' => 'File update was successful.', + 'USER_ACTIVE' => 'Active user', + 'USER_INACTIVE' => 'Inactive user', + + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', + 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', + 'VIEWING_FILE_DIFF' => 'Viewing file differences', + + 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', +)); + +// Default database schema entries... +$lang = array_merge($lang, array( + 'CONFIG_BOARD_EMAIL_SIG' => 'Thanks, The Management', + 'CONFIG_SITE_DESC' => 'A short text to describe your forum', + 'CONFIG_SITENAME' => 'yourdomain.com', + + 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', + + 'FORUMS_FIRST_CATEGORY' => 'Your first category', + 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', + 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', + + 'RANKS_SITE_ADMIN_TITLE' => 'Site Admin', + 'REPORT_WAREZ' => 'The post contains links to illegal or pirated software.', + 'REPORT_SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', + 'REPORT_OFF_TOPIC' => 'The reported post is off topic.', + 'REPORT_OTHER' => 'The reported post does not fit into any other category, please use the further information field.', + + 'SMILIES_ARROW' => 'Arrow', + 'SMILIES_CONFUSED' => 'Confused', + 'SMILIES_COOL' => 'Cool', + 'SMILIES_CRYING' => 'Crying or Very Sad', + 'SMILIES_EMARRASSED' => 'Embarrassed', + 'SMILIES_EVIL' => 'Evil or Very Mad', + 'SMILIES_EXCLAMATION' => 'Exclamation', + 'SMILIES_GEEK' => 'Geek', + 'SMILIES_IDEA' => 'Idea', + 'SMILIES_LAUGHING' => 'Laughing', + 'SMILIES_MAD' => 'Mad', + 'SMILIES_MR_GREEN' => 'Mr. Green', + 'SMILIES_NEUTRAL' => 'Neutral', + 'SMILIES_QUESTION' => 'Question', + 'SMILIES_RAZZ' => 'Razz', + 'SMILIES_ROLLING_EYES' => 'Rolling Eyes', + 'SMILIES_SAD' => 'Sad', + 'SMILIES_SHOCKED' => 'Shocked', + 'SMILIES_SMILE' => 'Smile', + 'SMILIES_SURPRISED' => 'Surprised', + 'SMILIES_TWISTED_EVIL' => 'Twisted Evil', + 'SMILIES_UBER_GEEK' => 'Uber Geek', + 'SMILIES_VERY_HAPPY' => 'Very Happy', + 'SMILIES_WINK' => 'Wink', + + 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', +)); From 8155205ae7a5ec27ff3058137513fc480d7ee6c5 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Fri, 17 Apr 2015 23:17:23 +0200 Subject: [PATCH 04/75] [ticket/13740] Implementation of the new installer framework [ci skip] PHPBB3-13740 --- .../cannot_build_container_exception.php | 22 + .../exception/invalid_dbms_exception.php | 22 + .../user_interaction_required_exception.php | 22 + phpBB/install/helper/config.php | 259 ++++++++++ phpBB/install/helper/container_factory.php | 149 ++++++ phpBB/install/helper/database.php | 459 ++++++++++++++++++ .../helper/iohandler/ajax_iohandler.php | 202 ++++++++ .../iohandler_not_implemented_exception.php | 19 + phpBB/install/helper/iohandler/factory.php | 72 +++ .../helper/iohandler/iohandler_base.php | 121 +++++ .../helper/iohandler/iohandler_interface.php | 119 +++++ .../helper/navigation/install_navigation.php | 28 ++ .../navigation/navigation_interface.php | 43 ++ .../helper/navigation/navigation_provider.php | 92 ++++ phpBB/install/installer.php | 146 ++++++ phpBB/install/module_base.php | 175 +++++++ phpBB/install/module_interface.php | 56 +++ phpBB/install/task_base.php | 53 ++ phpBB/install/task_interface.php | 47 ++ 19 files changed, 2106 insertions(+) create mode 100644 phpBB/install/exception/cannot_build_container_exception.php create mode 100644 phpBB/install/exception/invalid_dbms_exception.php create mode 100644 phpBB/install/exception/user_interaction_required_exception.php create mode 100644 phpBB/install/helper/config.php create mode 100644 phpBB/install/helper/container_factory.php create mode 100644 phpBB/install/helper/database.php create mode 100644 phpBB/install/helper/iohandler/ajax_iohandler.php create mode 100644 phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php create mode 100644 phpBB/install/helper/iohandler/factory.php create mode 100644 phpBB/install/helper/iohandler/iohandler_base.php create mode 100644 phpBB/install/helper/iohandler/iohandler_interface.php create mode 100644 phpBB/install/helper/navigation/install_navigation.php create mode 100644 phpBB/install/helper/navigation/navigation_interface.php create mode 100644 phpBB/install/helper/navigation/navigation_provider.php create mode 100644 phpBB/install/installer.php create mode 100644 phpBB/install/module_base.php create mode 100644 phpBB/install/module_interface.php create mode 100644 phpBB/install/task_base.php create mode 100644 phpBB/install/task_interface.php diff --git a/phpBB/install/exception/cannot_build_container_exception.php b/phpBB/install/exception/cannot_build_container_exception.php new file mode 100644 index 0000000000..11be507bc9 --- /dev/null +++ b/phpBB/install/exception/cannot_build_container_exception.php @@ -0,0 +1,22 @@ + + * @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\exception; + +/** + * This exception should be thrown when + */ +class cannot_build_container_exception extends installer_exception +{ + +} diff --git a/phpBB/install/exception/invalid_dbms_exception.php b/phpBB/install/exception/invalid_dbms_exception.php new file mode 100644 index 0000000000..ccb35bc237 --- /dev/null +++ b/phpBB/install/exception/invalid_dbms_exception.php @@ -0,0 +1,22 @@ + + * @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\exception; + +/** + * This exception should be thrown when + */ +class invalid_dbms_exception extends installer_exception +{ + +} diff --git a/phpBB/install/exception/user_interaction_required_exception.php b/phpBB/install/exception/user_interaction_required_exception.php new file mode 100644 index 0000000000..0aaae648cf --- /dev/null +++ b/phpBB/install/exception/user_interaction_required_exception.php @@ -0,0 +1,22 @@ + + * @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\exception; + +/** + * This exception should be thrown when user interaction is inevitable + */ +class user_interaction_required_exception extends installer_exception +{ + +} diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php new file mode 100644 index 0000000000..b759df737e --- /dev/null +++ b/phpBB/install/helper/config.php @@ -0,0 +1,259 @@ + + * @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\helper; + +/** + * Stores common settings and installation status + */ +class config +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Array which contains config settings for the installer + * + * The array will also store all the user input, as well as any + * data that is passed to other tasks by a task. + * + * @var array + */ + protected $installer_config; + + /** + * @var string + */ + protected $install_config_file; + + /** + * @var \phpbb\php\ini + */ + protected $php_ini; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Array containing progress information + * + * @var array + */ + protected $progress_data; + + /** + * Array containing system information + * + * The array contains run time and memory limitations. + * + * @var array + */ + protected $system_data; + + /** + * Constructor + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\php\ini $php_ini, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->php_ini = $php_ini; + $this->phpbb_root_path = $phpbb_root_path; + + // Set up data arrays + $this->installer_config = array(); + $this->system_data = array(); + $this->progress_data = array( + 'last_task_module_index' => 0, + 'last_task_module_name' => '', // Stores the service name of the latest finished module + 'last_task_index' => 0, + 'last_task_name' => '', // Stores the service name of the latest finished task + ); + + $this->install_config_file = $this->phpbb_root_path . 'store/install_config.php'; + + $this->setup_system_data(); + } + + /** + * Returns data for a specified parameter + * + * @param string $param_name Name of the parameter to return + * @param mixed $default Default value to return when the specified data + * does not exist. + * + * @return mixed value of the specified parameter or the default value if the data + * cannot be recovered. + */ + public function get($param_name, $default = false) + { + return (isset($this->installer_config[$param_name])) ? $this->installer_config[$param_name] : $default; + } + + /** + * Sets a parameter in installer_config + * + * @param string $param_name Name of the parameter + * @param mixed $value Values to set the parameter + * + * @return null + */ + public function set($param_name, $value) + { + $this->installer_config = array_merge($this->installer_config, array( + $param_name => $value, + )); + } + + /** + * Returns system parameter + * + * @param string $param_name Name of the parameter + * + * @return mixed Returns system parameter if it is defined, false otherwise + */ + public function system_get($param_name) + { + return (isset($this->system_data[$param_name])) ? $this->system_data[$param_name] : false; + } + + /** + * Returns remaining time until the run time limit + * + * @return int Remaining time until the run time limit in seconds + */ + public function get_time_remaining() + { + return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time(); + } + + /** + * Returns remaining memory available for PHP + * + * @return int Remaining memory until reaching the limit + */ + public function get_memory_remaining() + { + if (function_exists('memory_get_usage')) + { + return ($this->system_data['memory_limit'] - memory_get_usage()); + } + + // If we cannot get the information then just return a positive number (and cross fingers) + return 1; + } + + /** + * Saves the latest executed task + * + * @param string $task_service_name Name of the installer task service + * @param int $task_index Index of the task in the task list array + * + * @return null + */ + public function set_finished_task($task_service_name, $task_index) + { + $this->progress_data['last_task_name'] = $task_service_name; + $this->progress_data['last_task_index'] = $task_index; + } + + /** + * Set active module + * + * @param string $module_service_name Name of the installer module service + * @param int $module_index Index of the module in the module list array + * + * @return null + */ + public function set_active_module($module_service_name, $module_index) + { + $this->progress_data['last_task_module_name'] = $module_service_name; + $this->progress_data['last_task_module_index'] = $module_index; + } + + /** + * Getter for progress data + * + * @return array + */ + public function get_progress_data() + { + return $this->progress_data; + } + + /** + * Recovers install configuration from file + * + * @return null + */ + public function load_config() + { + if (!$this->filesystem->exists($this->install_config_file)) + { + return; + } + + $file_content = @file_get_contents($this->install_config_file); + $serialized_data = trim(substr($file_content, 8)); + $unserialized_data = unserialize($serialized_data); + + $this->installer_config = $unserialized_data['installer_config']; + $this->progress_data = $unserialized_data['progress_data']; + } + + /** + * Dumps install configuration to disk + * + * @return null + */ + public function save_config() + { + // Create array to save + $save_array = array( + 'installer_config' => $this->installer_config, + 'progress_data' => $this->progress_data, + ); + + // Create file content + $file_content = 'install_config_file, 'w'); + fwrite($fp, $file_content); + fclose($fp); + } + + /** + * Filling up system_data array + * + * @return null + */ + protected function setup_system_data() + { + // Query maximum runtime from php.ini + $execution_time = $this->php_ini->get_int('max_execution_time'); + $execution_time = min(15, $execution_time / 2); + $this->system_data['max_execution_time'] = $execution_time; + + // Set start time + $this->system_data['start_time'] = time(); + + // Get memory limit + $this->system_data['memory_limit'] = $this->php_ini->get_bytes('memory_limit'); + } +} diff --git a/phpBB/install/helper/container_factory.php b/phpBB/install/helper/container_factory.php new file mode 100644 index 0000000000..255f8f428e --- /dev/null +++ b/phpBB/install/helper/container_factory.php @@ -0,0 +1,149 @@ + + * @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\helper; + +use phpbb\install\exception\cannot_build_container_exception; + +class container_factory +{ + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var \phpbb\request\request + */ + protected $request; + + /** + * The full phpBB container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Constructor + * + * @param \phpbb\request\request $request Request interface + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(\phpbb\request\request $request, $phpbb_root_path, $php_ext) + { + $this->request = $request; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->container = null; + } + + /** + * Container getter + * + * @param null|string $service_name Name of the service to return + * + * @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container + * or the service specified in $service_name + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined + */ + public function get($service_name = null) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + $this->build_container(); + } + else + { + throw new cannot_build_container_exception(); + } + } + + return ($service_name === null) ? $this->container : $this->container->get($service_name); + } + + /** + * Returns the specified parameter from the container + * + * @param string $param_name + * + * @return mixed + */ + public function get_parameter($param_name) + { + return $this->container->getParameter($param_name); + } + + /** + * Build dependency injection container + */ + protected function build_container() + { + // If the container has been already built just return. + // Although this should never happen + if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) + { + return; + } + + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); + $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); + + // For BC with functions that we need during install + global $phpbb_container; + + $disable_super_globals = $this->request->super_globals_disabled(); + + // This is needed because container_builder::get_env_parameters() uses $_SERVER + if ($disable_super_globals) + { + $this->request->enable_super_globals(); + } + + $this->container = $phpbb_container = $phpbb_container_builder + ->with_config($phpbb_config_php_file) + ->without_cache() + ->without_compiled_container() + ->get_container(); + + // Setting request is required for the compatibility globals as those are generated from + // this container + $this->container->register('request')->setSynthetic(true); + $this->container->set('request', $this->request); + $this->container->compile(); + + // Restore super globals to previous state + if ($disable_super_globals) + { + $this->request->disable_super_globals(); + } + + // Get compatibilty globals + require ($this->phpbb_root_path . 'includes/compatibility_globals.' . $this->php_ext); + } +} diff --git a/phpBB/install/helper/database.php b/phpBB/install/helper/database.php new file mode 100644 index 0000000000..d728c8b93b --- /dev/null +++ b/phpBB/install/helper/database.php @@ -0,0 +1,459 @@ + + * @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\helper; + +use phpbb\install\exception\invalid_dbms_exception; + +/** + * Database related general functionality for installer + */ +class database +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var array + */ + protected $supported_dbms; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem interface + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + + // DBMS supported by phpBB + $this->supported_dbms = array( + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. + 'mysqli' => array( + 'LABEL' => 'MySQL with MySQLi Extension', + 'SCHEMA' => 'mysql_41', + 'MODULE' => 'mysqli', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysqli', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mysql' => array( + 'LABEL' => 'MySQL', + 'SCHEMA' => 'mysql', + 'MODULE' => 'mysql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql' => array( + 'LABEL' => 'MS SQL Server 2000+', + 'SCHEMA' => 'mssql', + 'MODULE' => 'mssql', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql_odbc'=> array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'odbc', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'oracle' => array( + 'LABEL' => 'Oracle', + 'SCHEMA' => 'oracle', + 'MODULE' => 'oci8', + 'DELIM' => '/', + 'DRIVER' => 'phpbb\db\driver\oracle', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 8.3+', + 'SCHEMA' => 'postgres', + 'MODULE' => 'pgsql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\postgres', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'sqlite' => array( + 'LABEL' => 'SQLite', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + ); + } + + /** + * Returns an array of available DBMS supported by phpBB + * + * If a DBMS is specified it will only return data for that DBMS + * and will load its extension if necessary. + * + * @param mixed $dbms name of the DBMS that's info is required or false for all DBMS info + * @param bool $return_unavailable set it to true if you expect unavailable but supported DBMS + * returned as well + * @param bool $only_20x_options set it to true if you only want to recover 2.0.x options + * + * @return array Array of available and supported DBMS + */ + public function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) + { + $available_dbms = $this->supported_dbms; + + if ($dbms) + { + if (isset($this->supported_dbms[$dbms])) + { + $available_dbms = array($dbms => $this->supported_dbms[$dbms]); + } + else + { + return array(); + } + } + + $any_dbms_available = false; + foreach ($available_dbms as $db_name => $db_array) + { + if ($only_20x_options && !$db_array['2.0.x']) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $dll = $db_array['MODULE']; + if (!@extension_loaded($dll)) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $any_dbms_available = true; + } + + if ($return_unavailable) + { + $available_dbms['ANY_DB_SUPPORT'] = $any_dbms_available; + } + + return $available_dbms; + } + + /** + * Removes "/* style" as well as "# style" comments from $input. + * + * @param string $sql_query Input string + * + * @return string Input string with comments removed + */ + public function remove_comments($sql_query) + { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql_query = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql_query); + + // Remove # style comments + $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query)); + + return $sql_query; + } + + /** + * split_sql_file() will split an uploaded sql file into single sql statements. + * + * Note: expects trim() to have already been run on $sql. + * + * @param string $sql SQL statements + * @param string $delimiter Delimiter between sql statements + * + * @return array Array of sql statements + */ + public function split_sql_file($sql, $delimiter) + { + $sql = str_replace("\r" , '', $sql); + $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + + $data = array_map('trim', $data); + + // The empty case + $end_data = end($data); + + if (empty($end_data)) + { + unset($data[key($data)]); + } + + return $data; + } + + /** + * Validates table prefix + * + * @param string $dbms The selected dbms + * @param string $table_prefix The table prefix to validate + * + * @return bool|array true if table prefix is valid, array of errors otherwise + * + * @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid + */ + public function validate_table_prefix($dbms, $table_prefix) + { + $errors = array(); + + if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $table_prefix)) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_INVALID_PREFIX', + ); + } + + // Do dbms specific checks + $dbms_info = $this->get_available_dbms($dbms); + switch ($dbms_info[$dbms]['SCHEMA']) + { + case 'mysql': + case 'mysql_41': + $prefix_length = 36; + break; + case 'mssql': + $prefix_length = 90; + break; + case 'oracle': + $prefix_length = 6; + break; + case 'postgres': + $prefix_length = 36; + break; + case 'sqlite': + $prefix_length = 200; + break; + default: + throw new invalid_dbms_exception(); + break; + } + + // Check the prefix length to ensure that index names are not too long + if (strlen($table_prefix) > $prefix_length) + { + $errors[] = array( + 'title' => array('INST_ERR_PREFIX_TOO_LONG', $prefix_length), + ); + } + + return (empty($errors)) ? true : $errors; + } + + /** + * Check if the user provided database parameters are correct + * + * This function checks the database connection data and also checks for + * any other problems that could cause an error during the installation + * such as if there is any database table names conflicting. + * + * Note: The function assumes that $table_prefix has been already validated + * with validate_table_prefix(). + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return array|bool Returns true if test is successful, array of errors otherwise + */ + public function check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $dbms_info = $this->get_available_dbms($dbms); + $dbms_info = $dbms_info[$dbms]; + $errors = array(); + + // Instantiate it and set return on error true + /** @var \phpbb\db\driver\driver_interface $db */ + $db = new $dbms_info['DRIVER']; + $db->sql_return_on_error(true); + + // Check that we actually have a database name before going any further + if (!in_array($dbms_info['SCHEMA'], array('sqlite', 'oracle')) && $dbname === '') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_NAME', + ); + } + + // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea + if ($dbms_info['SCHEMA'] === 'sqlite' + && stripos($this->filesystem->realpath($dbhost), $this->filesystem->realpath($this->phpbb_root_path) === 0)) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_FORUM_PATH', + ); + } + + // Try to connect to db + if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true))) + { + $db_error = $db->sql_error(); + $errors[] = array( + 'title' => 'INST_ERR_DB_CONNECT', + 'description' => ($db_error['message']) ? utf8_convert_message($db_error['message']) : 'INST_ERR_DB_NO_ERROR', + ); + } + else + { + // Check if there is any table name collisions + $temp_prefix = strtolower($table_prefix); + $table_ary = array( + $temp_prefix . 'attachments', + $temp_prefix . 'config', + $temp_prefix . 'sessions', + $temp_prefix . 'topics', + $temp_prefix . 'users', + ); + + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + $tables = $db_tools->sql_list_tables(); + $tables = array_map('strtolower', $tables); + $table_intersect = array_intersect($tables, $table_ary); + + if (sizeof($table_intersect)) + { + $errors[] = array( + 'title' => 'INST_ERR_PREFIX', + ); + } + + // Check if database version is supported + switch ($dbms) + { + case 'mysqli': + if (version_compare(mysqli_get_server_info($db->get_db_connect_id()), '4.1.3', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_MYSQLI', + ); + } + break; + case 'sqlite': + if (version_compare(sqlite_libversion(), '2.8.2', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE', + ); + } + break; + case 'sqlite3': + $version = \SQLite3::version(); + if (version_compare($version['versionString'], '3.6.15', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE3', + ); + } + break; + case 'oracle': + $sql = "SELECT * + FROM NLS_DATABASE_PARAMETERS + WHERE PARAMETER = 'NLS_RDBMS_VERSION' + OR PARAMETER = 'NLS_CHARACTERSET'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $stats[$row['parameter']] = $row['value']; + } + $db->sql_freeresult($result); + + if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_ORACLE', + ); + } + break; + case 'postgres': + $sql = "SHOW server_encoding;"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_POSTGRES', + ); + } + break; + } + } + + return (empty($errors)) ? true : $errors; + } +} diff --git a/phpBB/install/helper/iohandler/ajax_iohandler.php b/phpBB/install/helper/iohandler/ajax_iohandler.php new file mode 100644 index 0000000000..44a185139e --- /dev/null +++ b/phpBB/install/helper/iohandler/ajax_iohandler.php @@ -0,0 +1,202 @@ + + * @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\helper\iohandler; + +/** + * Input-Output handler for the AJAX frontend + */ +class ajax_iohandler extends iohandler_base +{ + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var string + */ + protected $form; + + /** + * Constructor + * + * @param \phpbb\request\request_interface $request HTTP request interface + * @param \phpbb\template\template $template Template engine + */ + public function __construct(\phpbb\request\request_interface $request, \phpbb\template\template $template) + { + $this->request = $request; + $this->template = $template; + $this->form = ''; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + public function get_input($name, $default, $multibyte = false) + { + return $this->request->variable($name, $default, $multibyte); + } + + /** + * {@inheritdoc} + */ + public function get_server_variable($name, $default = '') + { + return $this->request->server($name, $default); + } + + /** + * {@inheritdoc} + */ + public function get_header_variable($name, $default = '') + { + return $this->request->header($name, $default); + } + + /** + * {@inheritdoc} + */ + public function is_secure() + { + return $this->request->is_secure(); + } + + /** + * {@inheritdoc} + */ + public function add_user_form_group($title, $form) + { + // + // This code is pretty ugly... but works + // + + $this->template->assign_block_vars('options', array( + 'LEGEND' => $this->language->lang($title), + 'S_LEGEND' => true, + )); + + foreach ($form as $input_name => $input_options) + { + if (!isset($input_options['type'])) + { + continue; + } + + $tpl_ary = array(); + + $tpl_ary['TYPE'] = $input_options['type']; + $tpl_ary['TITLE'] = $this->language->lang($input_options['label']); + $tpl_ary['KEY'] = $input_name; + $tpl_ary['S_EXPLAIN'] = false; + + if (isset($input_options['default'])) + { + $default = $input_options['default']; + $default = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $default); + $tpl_ary['DEFAULT'] = $default; + } + + if (isset($input_options['description'])) + { + $tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']); + $tpl_ary['S_EXPLAIN'] = true; + } + + if (in_array($input_options['type'], array('select', 'radio'))) + { + for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) + { + if (isset($input_options['options'][$i]['label'])) + { + $input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']); + } + } + + $tpl_ary['OPTIONS'] = $input_options['options']; + } + + $this->template->assign_block_vars('options', $tpl_ary); + } + + $this->template->set_filenames(array( + 'form_install' => 'installer_form.html', + )); + + $this->form = $this->template->assign_display('form_install'); + } + + /** + * {@inheritdoc} + */ + public function send_response() + { + $json_data_array = $this->prepare_json_array(); + $json_data = json_encode($json_data_array); + + // Try to push content to the browser + print (str_pad(' ', 4096) . "\n"); + print ($json_data . "\n\n"); + flush(); + } + + /** + * Prepares iohandler's data to be sent out to the client. + * + * @return array + */ + protected function prepare_json_array() + { + $json_array = array( + 'errors' => $this->errors, + 'warnings' => $this->warnings, + 'logs' => $this->logs, + ); + + if (!empty($this->form)) + { + $json_array['form'] = $this->form; + $this->form = ''; + } + + $this->errors = array(); + $this->warnings = array(); + $this->logs = array(); + + return $json_array; + } + + /** + * Callback function for language replacing + * + * @param array $matches + * @return string + */ + public function lang_replace_callback($matches) + { + if (!empty($matches[1])) + { + return $this->language->lang($matches[1]); + } + + return ''; + } +} diff --git a/phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php b/phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php new file mode 100644 index 0000000000..f2ddeda6f7 --- /dev/null +++ b/phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php @@ -0,0 +1,19 @@ + + * @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\helper\iohandler\exception; + +class iohandler_not_implemented_exception extends \Exception +{ + +} diff --git a/phpBB/install/helper/iohandler/factory.php b/phpBB/install/helper/iohandler/factory.php new file mode 100644 index 0000000000..0b59e5ec63 --- /dev/null +++ b/phpBB/install/helper/iohandler/factory.php @@ -0,0 +1,72 @@ + + * @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\helper\iohandler; + +use phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception; + +/** + * Input-output handler factory + */ +class factory +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var string + */ + protected $environment; + + /** + * Constructor + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container + */ + public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->container = $container; + $this->environment = null; + } + + /** + * @param string $environment The name of the input-output handler to use + */ + public function set_environment($environment) + { + $this->environment = $environment; + } + + /** + * Factory getter for iohandler + * + * @return \phpbb\install\helper\iohandler\iohandler_interface + * + * @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception + * When the specified iohandler_interface does not exists + */ + public function get() + { + switch ($this->environment) + { + case 'ajax': + return $this->container->get('installer.helper.iohandler_ajax'); + break; + default: + throw new iohandler_not_implemented_exception(); + break; + } + } +} diff --git a/phpBB/install/helper/iohandler/iohandler_base.php b/phpBB/install/helper/iohandler/iohandler_base.php new file mode 100644 index 0000000000..0d5467d202 --- /dev/null +++ b/phpBB/install/helper/iohandler/iohandler_base.php @@ -0,0 +1,121 @@ + + * @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\helper\iohandler; + +/** + * Base class for installer input-output handlers + */ +abstract class iohandler_base implements iohandler_interface +{ + /** + * Array of errors + * + * Errors should be added, when the installation cannot continue without + * user interaction. If the aim is to notify the user about something, please + * use a warning instead. + * + * @var array + */ + protected $errors; + + /** + * Array of warnings + * + * @var array + */ + protected $warnings; + + /** + * Array of logs + * + * @var array + */ + protected $logs; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * Constructor + */ + public function __construct() + { + $this->errors = array(); + $this->warnings = array(); + $this->logs = array(); + } + + /** + * Set language service + * + * @param \phpbb\language\language $language + * + * @return null + */ + public function set_language(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * {@inheritdoc} + */ + public function add_error_message($error_title, $error_description = false) + { + $this->errors[] = $this->translate_message($error_title, $error_description); + } + + /** + * {@inheritdoc} + */ + public function add_warning_message($warning_title, $warning_description = false) + { + $this->warnings[] = $this->translate_message($warning_title, $warning_description); + } + + /** + * {@inheritdoc} + */ + public function add_log_message($log_title, $log_description = false) + { + $this->logs[] = $this->translate_message($log_title, $log_description); + } + + /** + * Localize message. + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param array|string $title Title of the message + * @param array|string|bool $description Description of the message + * + * @return array Localized message in an array + */ + protected function translate_message($title, $description) + { + $message_array = array(); + + $message_array['title'] = call_user_func_array(array($this->language, 'lang'), (array) $title); + + if ($description !== false) + { + $message_array['description'] = call_user_func_array(array($this->language, 'lang'), (array) $description); + } + + return $message_array; + } +} diff --git a/phpBB/install/helper/iohandler/iohandler_interface.php b/phpBB/install/helper/iohandler/iohandler_interface.php new file mode 100644 index 0000000000..cea5610586 --- /dev/null +++ b/phpBB/install/helper/iohandler/iohandler_interface.php @@ -0,0 +1,119 @@ + + * @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\helper\iohandler; + +/** + * Input-Output handler interface for the installer + */ +interface iohandler_interface +{ + /** + * Renders or returns response message + */ + public function send_response(); + + /** + * Returns input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * + * @return mixed Value of the input variable + */ + public function get_input($name, $default, $multibyte = false); + + /** + * Returns server variable + * + * This function should work the same as request_interterface::server(). + * + * @param string $name Name of the server variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed Value of the server variable + */ + public function get_server_variable($name, $default = ''); + + /** + * Wrapper function for request_interterface::header() + * + * @param string $name Name of the request header variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed + */ + public function get_header_variable($name, $default = ''); + + /** + * Returns true if the connection is encrypted + * + * @return bool + */ + public function is_secure(); + + /** + * Adds an error message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $error_title Title of the error message. + * @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available. + * + * @return null + */ + public function add_error_message($error_title, $error_description = false); + + /** + * Adds a warning message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $warning_title Title of the error message + * @param string|bool|array $warning_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available + * + * @return null + */ + public function add_warning_message($warning_title, $warning_description = false); + + /** + * Adds a log message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $log_title Title of the error message + * @param string|bool|array $log_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available + * + * @return null + */ + public function add_log_message($log_title, $log_description = false); + + /** + * Adds a requested data group to the rendering queue + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + * + * @return null + */ + public function add_user_form_group($title, $form); +} diff --git a/phpBB/install/helper/navigation/install_navigation.php b/phpBB/install/helper/navigation/install_navigation.php new file mode 100644 index 0000000000..3e29e55038 --- /dev/null +++ b/phpBB/install/helper/navigation/install_navigation.php @@ -0,0 +1,28 @@ + + * @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\helper\navigation; + +class install_navigation implements navigation_interface +{ + public function get() + { + return array( + 'install' => array( + 'label' => 'INSTALL', + 'route' => 'phpbb_installer_install', + 'order' => 0, + ), + ); + } +} diff --git a/phpBB/install/helper/navigation/navigation_interface.php b/phpBB/install/helper/navigation/navigation_interface.php new file mode 100644 index 0000000000..eebdbe923f --- /dev/null +++ b/phpBB/install/helper/navigation/navigation_interface.php @@ -0,0 +1,43 @@ + + * @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\helper\navigation; + +/** + * Interface for installer's navigation defining services + */ +interface navigation_interface +{ + /** + * Returns an array with the navigation items + * + * The returned array should have the following format: + * + * array( + * 'parent_nav_name' => array( + * 'nav_name' => array( + * 'label' => 'MY_MENU', + * 'route' => 'phpbb_route_name', + * ) + * ) + * ) + * + * + * Navigation item setting options: + * - label: The language variable name + * - route: Name of the route which it is belongs to + * + * @return array + */ + public function get(); +} diff --git a/phpBB/install/helper/navigation/navigation_provider.php b/phpBB/install/helper/navigation/navigation_provider.php new file mode 100644 index 0000000000..ddb2509348 --- /dev/null +++ b/phpBB/install/helper/navigation/navigation_provider.php @@ -0,0 +1,92 @@ + + * @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\helper\navigation; + +/** + * Installers navigation provider + */ +class navigation_provider +{ + /** + * @var array + */ + private $menu_collection; + + /** + * Constructor + * + * @param \phpbb\di\service_collection $plugins + */ + public function __construct(\phpbb\di\service_collection $plugins) + { + $this->menu_collection = array(); + + foreach ($plugins as $plugin => $plugin_instance) + { + $this->register($plugin_instance); + } + } + + /** + * Returns navigation array + * + * @return array + */ + public function get() + { + return $this->menu_collection; + } + + /** + * Registers a navigation provider's navigation items + * + * @param navigation_interface $navigation + */ + public function register(navigation_interface $navigation) + { + $nav_arry = $navigation->get(); + $this->merge($nav_arry, $this->menu_collection); + } + + /** + * Recursive array merge + * + * This function is necessary to be able to replace the options of + * already set navigation items. + * + * @param array $array_to_merge + * @param array $array_to_merge_into + */ + private function merge(&$array_to_merge, &$array_to_merge_into) + { + foreach ($array_to_merge as $key => $value) + { + if (isset($array_to_merge_into[$key])) + { + if (is_array($array_to_merge_into[$key]) && is_array($value)) + { + $this->merge($value, $array_to_merge_into[$key]); + } + else + { + $array_to_merge_into[$key] = $value; + } + } + else + { + $array_to_merge_into[$key] = $value; + } + } + } +} diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php new file mode 100644 index 0000000000..5a2fcc4d85 --- /dev/null +++ b/phpBB/install/installer.php @@ -0,0 +1,146 @@ + + * @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; + +class installer +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var array + */ + protected $installer_modules; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer config handler + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container + */ + public function __construct(\phpbb\install\helper\config $config, \Symfony\Component\DependencyInjection\ContainerInterface $container) + { + $this->install_config = $config; + $this->container = $container; + $this->installer_modules = array(); + } + + /** + * Sets modules to execute + * + * Note: The installer will run modules in the order they are set in + * the array. + * + * @param array $modules Array of module service names + */ + public function set_modules($modules) + { + $modules = (array) $modules; + + $this->installer_modules = $modules; + } + + /** + * Run phpBB installer + * + * @return null + */ + public function run() + { + // Load install progress + $this->install_config->load_config(); + + // Recover install progress + $module_index = $this->recover_progress(); + + $install_finished = false; + + try + { + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if module exists, if not the install is completed + if (!isset($this->installer_modules[$module_index])) + { + $install_finished = true; + break; + } + + // Log progress + $module_service_name = $this->installer_modules[$module_index]; + $this->install_config->set_active_module($module_service_name, $module_index); + + // Get module from container + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($module_service_name); + + $module_index++; + + // Check if module should be executed + if (!$module->is_essential() && !$module->check_requirements()) + { + continue; + } + + $module->run(); + + // Clear task progress + $this->install_config->set_finished_task('', 0); + } + + if ($install_finished) + { + die ("install finished"); + } + else + { + die ("install memory or time limit reached"); + } + } + catch (\phpbb\install\exception\user_interaction_required_exception $e) + { + // @todo handle exception + } + + // Save install progress + $this->install_config->save_config(); + } + + /** + * Recover install progress + * + * @return int Index of the next installer module to execute + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + $module_service = $progress_array['last_task_module_name']; + $module_index = $progress_array['last_task_module_index']; + + if ($this->installer_modules[$module_index] === $module_service) + { + return $module_index; + } + + return 0; + } +} diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php new file mode 100644 index 0000000000..defccaefef --- /dev/null +++ b/phpBB/install/module_base.php @@ -0,0 +1,175 @@ + + * @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; + +/** + * Base class for installer module + */ +abstract class module_base implements module_interface +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var bool + */ + protected $is_essential; + + /** + * Array of tasks for installer module + * + * @var array + */ + protected $task_collection; + + /** + * Installer module constructor + * + * @param array $tasks array of installer tasks for installer module + * @param bool $essential flag that indicates if module is essential or not + */ + public function __construct(array $tasks, $essential = true) + { + $this->task_collection = $tasks; + $this->is_essential = $essential; + } + + /** + * Dependency getter + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * @param \phpbb\install\helper\config $config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * + * @return null + */ + public function setup(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\install\helper\config $config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->container = $container; + $this->install_config = $config; + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_index = $this->recover_progress(); + + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if task exists + if (!isset($this->task_collection[$task_index])) + { + break; + } + + // Recover task to be executed + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + + // Iterate to the next task + $task_index++; + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + continue; + } + + $task->run(); + + // Increment progress + if ($this->get_task_count() !== 0) + { + //$this->iohandler->increment_progress(); + } + + $this->iohandler->send_response(); + + // Log install progress + $current_task_index = $task_index - 1; + $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + } + } + + /** + * Returns the next task's index + * + * @return int index of the array element of the next task + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + $last_finished_task_name = $progress_array['last_task_name']; + $last_finished_task_index = $progress_array['last_task_index']; + + // Check if the data is relevant to this module + if (isset($this->task_collection[$last_finished_task_index])) + { + if ($this->task_collection[$last_finished_task_index] === $last_finished_task_name) + { + // Return the task index of the next task + return $last_finished_task_index + 1; + } + } + + // As of now if the progress has not been resolved we assume that it is because + // the task progress belongs to the previous module, + // so just default to the first task + // @todo make module aware of it's service name that way this can be improved + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_count() + { + return sizeof($this->task_collection); + } +} diff --git a/phpBB/install/module_interface.php b/phpBB/install/module_interface.php new file mode 100644 index 0000000000..e0ec4e4347 --- /dev/null +++ b/phpBB/install/module_interface.php @@ -0,0 +1,56 @@ + + * @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; + +/** + * Interface for installer modules + * + * An installer module is a task collection which executes installer tasks. + */ +interface module_interface +{ + /** + * Checks if the execution of the module is essential to install phpBB or it can be skipped + * + * Note: Please note that all the non-essential modules have to implement check_requirements() + * method. + * + * @return bool true if the module is essential, false otherwise + */ + public function is_essential(); + + /** + * Checks requirements for the tasks + * + * Note: Only need to be implemented for non-essential tasks, as essential tasks + * requirements should be checked in the requirements install module. + * + * @return bool true if the task's requirements are met + */ + public function check_requirements(); + + /** + * Executes the task + * + * @return null + */ + public function run(); + + /** + * Returns the number of tasks in the module + * + * @return int + */ + public function get_task_count(); +} diff --git a/phpBB/install/task_base.php b/phpBB/install/task_base.php new file mode 100644 index 0000000000..5946be8c52 --- /dev/null +++ b/phpBB/install/task_base.php @@ -0,0 +1,53 @@ + + * @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; + +/** + * Base class for installer task + */ +abstract class task_base implements task_interface +{ + /** + * @var bool + */ + protected $is_essential; + + /** + * Constructor + * + * @param bool $essential + */ + public function __construct($essential = true) + { + $this->is_essential = $essential; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } +} diff --git a/phpBB/install/task_interface.php b/phpBB/install/task_interface.php new file mode 100644 index 0000000000..9cfc4d19c2 --- /dev/null +++ b/phpBB/install/task_interface.php @@ -0,0 +1,47 @@ + + * @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; + +/** + * Interface for installer tasks + */ +interface task_interface +{ + /** + * Checks if the task is essential to install phpBB or it can be skipped + * + * Note: Please note that all the non-essential modules have to implement check_requirements() + * method. + * + * @return bool true if the task is essential, false otherwise + */ + public function is_essential(); + + /** + * Checks requirements for the tasks + * + * Note: Only need to be implemented for non-essential tasks, as essential tasks + * requirements should be checked in the requirements install module. + * + * @return bool true if the task's requirements are met + */ + public function check_requirements(); + + /** + * Executes the task + * + * @return null + */ + public function run(); +} From 11623dd6718ec12504286db3dfcd042ccb4e3688 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 28 Apr 2015 22:33:04 +0200 Subject: [PATCH 05/75] [ticket/13740] Front facing files and controllers [ci skip] PHPBB3-13740 --- phpBB/adm/style/admin.css | 6 +- phpBB/adm/style/installer_form.html | 52 ++++ phpBB/adm/style/installer_install.html | 13 + phpBB/assets/javascript/installer.js | 205 ++++++++++++++++ .../config/installer/routing/environment.yml | 2 + phpBB/config/installer/routing/installer.yml | 22 ++ phpBB/install/app.php | 83 +++++++ phpBB/install/controller/helper.php | 228 ++++++++++++++++++ phpBB/install/controller/install.php | 109 +++++++++ phpBB/install/controller/install_index.php | 79 ++++++ 10 files changed, 798 insertions(+), 1 deletion(-) create mode 100644 phpBB/adm/style/installer_form.html create mode 100644 phpBB/adm/style/installer_install.html create mode 100644 phpBB/assets/javascript/installer.js create mode 100644 phpBB/config/installer/routing/environment.yml create mode 100644 phpBB/config/installer/routing/installer.yml create mode 100644 phpBB/install/app.php create mode 100644 phpBB/install/controller/helper.php create mode 100644 phpBB/install/controller/install.php create mode 100644 phpBB/install/controller/install_index.php diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 145bcfaec1..dd5878a976 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -1776,7 +1776,7 @@ li.pagination ul { /* Action Highlighting ---------------------------------------- */ -.successbox, .errorbox { +.successbox, .errorbox, .warningbox { padding: 8px; margin: 10px 0; color: #FFFFFF; @@ -1800,6 +1800,10 @@ li.pagination ul { background-color: #BC2A4D; } +.warningbox { + background-color: #fca600; +} + .successbox h3, .errorbox h3 { color: #FFFFFF; margin: 0 0 0.5em; diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html new file mode 100644 index 0000000000..dbcf3c19f8 --- /dev/null +++ b/phpBB/adm/style/installer_form.html @@ -0,0 +1,52 @@ +
+ +
+ + + + +
+ +
+ + {options.LEGEND} + + + +
+

{options.TITLE_EXPLAIN}
+
+ + + + + + + + + + + + + + + checked /> {options.OPTIONS.label} + + +
+
+ +
+
+ {L_SUBMIT} + +
+ + + + +
diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html new file mode 100644 index 0000000000..7d62075c62 --- /dev/null +++ b/phpBB/adm/style/installer_install.html @@ -0,0 +1,13 @@ + +

{L_INSTALL}

+{CONTENT} + +
+
+ {L_SUBMIT} + +
+
+ + + diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js new file mode 100644 index 0000000000..302d95e7c6 --- /dev/null +++ b/phpBB/assets/javascript/installer.js @@ -0,0 +1,205 @@ +/** + * Installer's AJAX frontend handler + */ + +(function($) { // Avoid conflicts with other libraries + // Global variables + var pollTimer = null; + var nextReadPosition = 0; + + // Template related variables + var $contentWrapper = $('.install-body').find('.main'); + + // Intercept form submits + intercept_form_submit($('#install_install')); + + function poll_content(xhReq) { + var messages = xhReq.responseText; + + do { + var unprocessed = messages.substring(nextReadPosition); + var messageEndIndex = unprocessed.indexOf('}\n\n'); + + if (messageEndIndex !== -1) { + var endOfMessageIndex = messageEndIndex + 3; // 3 is the length of "}\n\n" + var message = unprocessed.substring(0, endOfMessageIndex); + parse_message(message); + nextReadPosition += endOfMessageIndex; + } + } while (messageEndIndex !== -1); + + if (xhReq.readyState === 4) { + $('#loading_indicator').css('display', 'none'); + reset_polling(); + } + } + + function parse_message(messageJSON) { + $('#loading_indicator').css('display', 'none'); + + messageJSON = messageJSON.trim(); + var responseObject = JSON.parse(messageJSON); + + // Parse object + if (responseObject.hasOwnProperty('errors')) { + add_message('error', responseObject.errors) + } + + if (responseObject.hasOwnProperty('warnings')) { + add_message('warning', responseObject.warnings) + } + + if (responseObject.hasOwnProperty('logs')) { + add_message('log', responseObject.logs); + } + + if (responseObject.hasOwnProperty('form')) { + add_form(responseObject.form); + } + } + + function add_message(type, messages) { + // Get message containers + var errorContainer = $('#error-container'); + var warningContainer = $('#warning-container'); + var logContainer = $('#log-container'); + + var title, description, msgElement, arraySize = messages.length; + for (var i = 0; i < arraySize; i++) { + msgElement = $('
'); + title = $(document.createElement('strong')); + title.text(messages[i].title); + msgElement.append(title); + + if (messages[i].hasOwnProperty('description')) { + description = $(document.createElement('p')); + description.text(messages[i].description); + msgElement.append(description); + } + + switch (type) { + case 'error': + msgElement.addClass('errorbox'); + errorContainer.append(msgElement); + break; + case 'warning': + msgElement.addClass('warningbox'); + warningContainer.append(msgElement); + break; + case 'log': + msgElement.addClass('log'); + logContainer.append(msgElement); + break; + } + } + } + + function add_form(formHtml) { + var formContainer = $('#content-container'); + formContainer.html(formHtml); + var form = $('#install_install'); + intercept_form_submit(form); + } + + function start_polling(xhReq) { + reset_polling(); + pollTimer = setInterval(function () { + poll_content(xhReq); + }, 500); + } + + function reset_polling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } + + function submit_form(form, submitBtn) { + form.css('display', 'none'); + + var xhReq = create_xhr_object(); + xhReq.open('POST', form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhReq.send(get_form_fields(form, submitBtn)); + + // Clear content + setup_ajax_layout(); + $('#loading_indicator').css('display', 'block'); + + start_polling(xhReq); + } + + // Workaround for submit buttons + function get_form_fields(form, submitBtn) { + var formData = form.serialize(); + //var submitBtn = form.find(':submit'); + formData += ((formData.length) ? '&' : '') + encodeURIComponent(submitBtn.attr('name')) + '='; + formData += encodeURIComponent(submitBtn.attr('value')); + + return formData; + } + + function intercept_form_submit(form) { + if (!form.length) { + return; + } + + form.find(':submit').bind('click', function (event) { + event.preventDefault(); + submit_form(form, $(this)); + }); + + } + + /** + * jQuery cannot be used as the response is streamed, and + * as of now, jQuery does not provide access to the response until + * the connection is not closed. + */ + function create_xhr_object() { + var xhReq; + + if (window.XMLHttpRequest) { + xhReq = new XMLHttpRequest(); + } + else if (window.ActiveXObject) { + xhReq = new ActiveXObject("Msxml2.XMLHTTP"); + } + + return xhReq; + } + + function setup_ajax_layout() { + // Clear content + $contentWrapper.html(''); + + var $header = $('
'); + $header.attr('id', 'header-container'); + $contentWrapper.append($header); + + var $description = $('
'); + $description.attr('id', 'description-container'); + $contentWrapper.append($description); + + var $errorContainer = $('
'); + $errorContainer.attr('id', 'error-container'); + $contentWrapper.append($errorContainer); + + var $warningContainer = $('
'); + $warningContainer.attr('id', 'warning-container'); + $contentWrapper.append($warningContainer); + + var $installerContentWrapper = $('
'); + $installerContentWrapper.attr('id', 'content-container'); + $contentWrapper.append($installerContentWrapper); + + var $logContainer = $('
'); + $logContainer.attr('id', 'log-container'); + $contentWrapper.append($logContainer); + + var $spinner = $('
'); + $spinner.attr('id', 'loading_indicator'); + $spinner.html(' '); + $contentWrapper.append($spinner); + } +})(jQuery); // Avoid conflicts with other libraries diff --git a/phpBB/config/installer/routing/environment.yml b/phpBB/config/installer/routing/environment.yml new file mode 100644 index 0000000000..60324c975b --- /dev/null +++ b/phpBB/config/installer/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: "installer.yml" diff --git a/phpBB/config/installer/routing/installer.yml b/phpBB/config/installer/routing/installer.yml new file mode 100644 index 0000000000..80a995ab6e --- /dev/null +++ b/phpBB/config/installer/routing/installer.yml @@ -0,0 +1,22 @@ +phpbb_installer_index: + path: / + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: "intro" + +phpbb_installer_license: + path: /license + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: "license" + +phpbb_installer_support: + path: /support + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: "support" + +phpbb_installer_install: + path: /install + defaults: + _controller: phpbb.installer.controller.install:handle diff --git a/phpBB/install/app.php b/phpBB/install/app.php new file mode 100644 index 0000000000..58ca141af7 --- /dev/null +++ b/phpBB/install/app.php @@ -0,0 +1,83 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * @ignore + */ +define('IN_PHPBB', true); +define('IN_INSTALL', true); +define('PHPBB_ENVIRONMENT', 'production'); +$phpbb_root_path = '../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +// +// Let's do the common.php logic +// +require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\install\\', "{$phpbb_root_path}install/", $phpEx); +$phpbb_class_loader->register(); + +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); +require($phpbb_root_path . 'includes/functions_user.' . $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'); + +$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_installer_container = $phpbb_installer_container_builder + ->with_environment('installer') + ->without_extensions() + ->without_cache() + ->get_container(); + +// Path to templates +$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); +$paths = array_filter($paths, 'is_dir'); + +/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); + +/** @var \phpbb\template\template $template */ +$template = $phpbb_installer_container->get('template'); +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), +), $paths); + +/** @var \phpbb\language\language $language */ +$language = $phpbb_installer_container->get('language'); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + +/* @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */ +$http_kernel = $phpbb_installer_container->get('http_kernel'); + +/* @var $symfony_request \phpbb\symfony_request */ +$symfony_request = $phpbb_installer_container->get('symfony_request'); +$response = $http_kernel->handle($symfony_request); +$response->send(); +$http_kernel->terminate($symfony_request, $response); diff --git a/phpBB/install/controller/helper.php b/phpBB/install/controller/helper.php new file mode 100644 index 0000000000..7a5e20406d --- /dev/null +++ b/phpBB/install/controller/helper.php @@ -0,0 +1,228 @@ + + * @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\controller; + +use Symfony\Component\HttpFoundation\Response; + +/** + * A duplicate of \phpbb\controller\helper + * + * This class is necessary because of controller\helper's legacy function calls + * to page_header() page_footer() functions which has unavailable dependencies. + */ +class helper +{ + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $lang_helper; + + /** + * @var \phpbb\install\helper\navigation\navigation_provider + */ + protected $navigation_provider; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\path_helper + */ + protected $path_helper; + + /** + * @var \phpbb\symfony_request + */ + protected $request; + + /** + * @var \phpbb\routing\router + */ + protected $router; + + /** + * @var string + */ + protected $phpbb_admin_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + public function __construct(\phpbb\language\language $language, \phpbb\language\language_file_helper $lang_helper, \phpbb\install\helper\navigation\navigation_provider $nav, \phpbb\template\template $template, \phpbb\path_helper $path_helper, \phpbb\symfony_request $request, \phpbb\routing\router $router, $phpbb_root_path) + { + $this->language = $language; + $this->lang_helper = $lang_helper; + $this->navigation_provider = $nav; + $this->template = $template; + $this->path_helper = $path_helper; + $this->request = $request; + $this->router = $router; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param int $status_code The status code to be sent to the page header + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $status_code = 200) + { + $this->page_header($page_title); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + return new Response($this->template->assign_display('body'), $status_code); + } + + /** + * Set default template variables + * + * @param string $page_title + */ + protected function page_header($page_title) + { + $this->template->assign_vars(array( + 'L_CHANGE' => $this->language->lang('CHANGE'), + 'L_COLON' => $this->language->lang('COLON'), + 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), + 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), + 'L_SKIP' => $this->language->lang('SKIP'), + 'PAGE_TITLE' => $this->language->lang($page_title), + 'T_IMAGE_PATH' => htmlspecialchars($this->phpbb_admin_path) . 'images/', + 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . 'assets/javascript/jquery.min.js', + 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . 'adm/style', + 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . 'assets/', + + 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), + 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + + 'S_USER_LANG' => $this->language->lang('USER_LANG'), + ) + ); + + $this->render_navigation(); + } + + /** + * Render navigation + */ + protected function render_navigation() + { + // Get navigation items + $nav_array = $this->navigation_provider->get(); + + // @todo Sort navs by order + + $active_main_menu = $this->get_active_main_menu($nav_array); + + // Pass navigation to template + foreach ($nav_array as $key => $entry) + { + $this->template->assign_block_vars('t_block1', array( + 'L_TITLE' => $this->language->lang($entry['label']), + 'S_SELECTED' => ($active_main_menu === $key), + 'U_TITLE' => $this->route($entry['route']), + )); + + if (is_array($entry[0]) && $active_main_menu === $key) + { + // @todo Sort navs by order + + foreach ($entry[0] as $sub_entry) + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } + } + } + } + + /** + * Returns path from route name + * + * @param string $route_name + * + * @return string + */ + public function route($route_name) + { + $url = $this->router->generate($route_name); + + return $url; + } + + /** + * Render language select form + */ + protected function render_language_select() + { + $langs = $this->lang_helper->get_available_languages(); + } + + /** + * Returns the name of the active main menu item + * + * @param array $nav_array + * + * @return string|bool Returns the name of the active main menu element, if the element not found, returns false + */ + protected function get_active_main_menu($nav_array) + { + $active_route = $this->request->get('_route'); + + foreach ($nav_array as $nav_name => $nav_options) + { + $current_menu = $nav_name; + + if (isset($nav_options['route']) && $nav_options['route'] === $active_route) + { + return $nav_name; + } + + if (is_array($nav_options[0])) + { + foreach ($nav_options[0] as $sub_menus) + { + if (isset($sub_menus['route']) &&$sub_menus['route'] === $active_route) + { + return $current_menu; + } + } + } + } + + return false; + } +} diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php new file mode 100644 index 0000000000..1217107484 --- /dev/null +++ b/phpBB/install/controller/install.php @@ -0,0 +1,109 @@ + + * @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\controller; + +use Symfony\Component\HttpFoundation\StreamedResponse; + +/** + * Controller for installing phpBB + */ +class install +{ + /** + * @var \phpbb\install\controller\helper + */ + protected $controller_helper; + + /** + * @var \phpbb\install\helper\iohandler\factory + */ + protected $iohandler_factory; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\install\installer + */ + protected $installer; + + /** + * Constructor + * + * @param helper $helper + * @param \phpbb\install\helper\iohandler\factory $factory + * @param \phpbb\request\request_interface $request + * @param \phpbb\install\installer $installer + */ + public function __construct(helper $helper, \phpbb\install\helper\iohandler\factory $factory, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\install\installer $installer) + { + $this->controller_helper = $helper; + $this->iohandler_factory = $factory; + $this->template = $template; + $this->request = $request; + $this->installer = $installer; + } + + public function handle() + { + // @todo check that phpBB is not already installed + + $this->template->assign_vars(array( + 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), + )); + + // Set up input-output handler + if ($this->request->is_ajax()) + { + $this->iohandler_factory->set_environment('ajax'); + } + else + { + $this->iohandler_factory->set_environment('nojs'); + } + + if ($this->request->is_ajax()) + { + $installer = &$this->installer; + + $response = new StreamedResponse(); + $response->setCallback(function() use ($installer) { + $installer->run(); + }); + + return $response; + } + else + { + // Determine whether the installation was started or not + if (true) + { + // If not, let's render the welcome page + $this->template->assign_vars(array( + 'SHOW_INSTALL_START_FORM' => true, + )); + return $this->controller_helper->render('installer_install.html', 'INSTALL'); + } + + // @todo: implement no js controller logic + } + } +} diff --git a/phpBB/install/controller/install_index.php b/phpBB/install/controller/install_index.php new file mode 100644 index 0000000000..c61d68f7fb --- /dev/null +++ b/phpBB/install/controller/install_index.php @@ -0,0 +1,79 @@ + + * @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\controller; + +class install_index +{ + /** + * @var helper + */ + protected $helper; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param helper $helper + * @param \phpbb\language\language $language + * @param \phpbb\template\template $template + * @param string $phpbb_root_path + */ + public function __construct(helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $phpbb_root_path) + { + $this->helper = $helper; + $this->language = $language; + $this->template = $template; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function handle($mode) + { + switch ($mode) + { + case "intro": + $title = $this->language->lang('INTRODUCTION_TITLE'); + $body = $this->language->lang('INTRODUCTION_BODY'); + break; + case "support": + $title = $this->language->lang('SUPPORT_TITLE'); + $body = $this->language->lang('SUPPORT_BODY'); + break; + case "license": + $title = $this->language->lang('LICENSE_TITLE'); + $body = implode("
\n", file($this->phpbb_root_path . 'docs/LICENSE.txt')); + break; + } + + $this->template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + )); + + return $this->helper->render('install_main.html', $title); + } +} From 0b74e3b0dea723cf0e5a83dcd910bc29941d1456 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Sun, 19 Apr 2015 00:43:51 +0200 Subject: [PATCH 06/75] [ticket/13740] Installer's install tasks and modules [ci skip] PHPBB3-13740 --- phpBB/config/installer/config.yml | 2 + .../installer/container/environment.yml | 3 + .../config/installer/container/parameters.yml | 2 + phpBB/config/installer/container/services.yml | 70 +++ .../container/services_install_controller.yml | 29 ++ .../container/services_install_data.yml | 29 ++ .../container/services_install_database.yml | 36 ++ .../container/services_install_filesystem.yml | 16 + .../container/services_install_finish.yml | 20 + .../container/services_install_navigation.yml | 25 + .../services_install_obtain_data.yml | 43 ++ .../services_install_requirements.yml | 20 + .../container/services_installer.yml | 70 +++ .../install/exception/installer_exception.php | 22 + .../helper/navigation/main_navigation.php | 45 ++ phpBB/install/module/install_data/module.php | 22 + .../module/install_data/task/add_bots.php | 224 +++++++++ .../install_data/task/add_languages.php | 105 ++++ .../module/install_data/task/add_modules.php | 452 ++++++++++++++++++ .../module/install_database/module.php | 22 + .../task/add_config_settings.php | 325 +++++++++++++ .../task/add_default_data.php | 145 ++++++ .../install_database/task/create_schema.php | 198 ++++++++ .../module/install_filesystem/module.php | 22 + .../task/create_config_file.php | 219 +++++++++ .../install/module/install_finish/module.php | 22 + .../install_finish/task/notify_user.php | 113 +++++ .../task/populate_migrations.php | 54 +++ phpBB/install/module/obtain_data/module.php | 63 +++ .../obtain_data/task/obtain_admin_data.php | 207 ++++++++ .../obtain_data/task/obtain_board_data.php | 172 +++++++ .../obtain_data/task/obtain_database_data.php | 259 ++++++++++ .../obtain_data/task/obtain_email_data.php | 151 ++++++ .../obtain_data/task/obtain_imagick_path.php | 73 +++ .../obtain_data/task/obtain_server_data.php | 187 ++++++++ phpBB/install/module/requirements/module.php | 73 +++ .../requirements/task/check_filesystem.php | 258 ++++++++++ .../task/check_server_environment.php | 185 +++++++ 38 files changed, 3983 insertions(+) create mode 100644 phpBB/config/installer/config.yml create mode 100644 phpBB/config/installer/container/environment.yml create mode 100644 phpBB/config/installer/container/parameters.yml create mode 100644 phpBB/config/installer/container/services.yml create mode 100644 phpBB/config/installer/container/services_install_controller.yml create mode 100644 phpBB/config/installer/container/services_install_data.yml create mode 100644 phpBB/config/installer/container/services_install_database.yml create mode 100644 phpBB/config/installer/container/services_install_filesystem.yml create mode 100644 phpBB/config/installer/container/services_install_finish.yml create mode 100644 phpBB/config/installer/container/services_install_navigation.yml create mode 100644 phpBB/config/installer/container/services_install_obtain_data.yml create mode 100644 phpBB/config/installer/container/services_install_requirements.yml create mode 100644 phpBB/config/installer/container/services_installer.yml create mode 100644 phpBB/install/exception/installer_exception.php create mode 100644 phpBB/install/helper/navigation/main_navigation.php create mode 100644 phpBB/install/module/install_data/module.php create mode 100644 phpBB/install/module/install_data/task/add_bots.php create mode 100644 phpBB/install/module/install_data/task/add_languages.php create mode 100644 phpBB/install/module/install_data/task/add_modules.php create mode 100644 phpBB/install/module/install_database/module.php create mode 100644 phpBB/install/module/install_database/task/add_config_settings.php create mode 100644 phpBB/install/module/install_database/task/add_default_data.php create mode 100644 phpBB/install/module/install_database/task/create_schema.php create mode 100644 phpBB/install/module/install_filesystem/module.php create mode 100644 phpBB/install/module/install_filesystem/task/create_config_file.php create mode 100644 phpBB/install/module/install_finish/module.php create mode 100644 phpBB/install/module/install_finish/task/notify_user.php create mode 100644 phpBB/install/module/install_finish/task/populate_migrations.php create mode 100644 phpBB/install/module/obtain_data/module.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_admin_data.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_board_data.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_database_data.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_email_data.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_imagick_path.php create mode 100644 phpBB/install/module/obtain_data/task/obtain_server_data.php create mode 100644 phpBB/install/module/requirements/module.php create mode 100644 phpBB/install/module/requirements/task/check_filesystem.php create mode 100644 phpBB/install/module/requirements/task/check_server_environment.php diff --git a/phpBB/config/installer/config.yml b/phpBB/config/installer/config.yml new file mode 100644 index 0000000000..979dbbcdd9 --- /dev/null +++ b/phpBB/config/installer/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../default/config.yml } diff --git a/phpBB/config/installer/container/environment.yml b/phpBB/config/installer/container/environment.yml new file mode 100644 index 0000000000..40a3c7a683 --- /dev/null +++ b/phpBB/config/installer/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/phpBB/config/installer/container/parameters.yml b/phpBB/config/installer/container/parameters.yml new file mode 100644 index 0000000000..0447646806 --- /dev/null +++ b/phpBB/config/installer/container/parameters.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/parameters.yml } diff --git a/phpBB/config/installer/container/services.yml b/phpBB/config/installer/container/services.yml new file mode 100644 index 0000000000..8296bcc079 --- /dev/null +++ b/phpBB/config/installer/container/services.yml @@ -0,0 +1,70 @@ +imports: + - { resource: services_installer.yml } + - { resource: ../../default/container/services_files.yml } + - { resource: ../../default/container/services_http.yml } + - { resource: ../../default/container/services_language.yml } + - { resource: ../../default/container/services_php.yml } + - { resource: ../../default/container/services_routing.yml } + - { resource: ../../default/container/services_twig.yml } + +services: + config: + class: phpbb\config\config + arguments: + - [] + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - @service_container + - %core.root_path% + - @template + + dispatcher: + class: phpbb\event\dispatcher + arguments: + - @service_container + + language.loader: + parent: language.loader_abstract + + path_helper: + class: phpbb\path_helper + arguments: + - @symfony_request + - @filesystem + - @request + - %core.root_path% + - %core.php_ext% + + router: + class: phpbb\routing\router + arguments: + - @service_container + - @filesystem + - %core.root_path% + - %core.php_ext% + - %core.environment% + + template: + class: phpbb\template\twig\twig + arguments: + - @path_helper + - @config + - @template_context + - @template.twig.environment + - %core.template.cache_path% + - null + - @template.twig.extensions.collection + + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - @config + - @filesystem + - @path_helper + - @service_container + - %core.template.cache_path% + - null + - @template.twig.loader + - [] diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml new file mode 100644 index 0000000000..5eea133590 --- /dev/null +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -0,0 +1,29 @@ +services: + phpbb.installer.controller.welcome: + class: phpbb\install\controller\install_index + arguments: + - @phpbb.installer.controller.helper + - @language + - @template + - %core.root_path% + + phpbb.installer.controller.helper: + class: phpbb\install\controller\helper + arguments: + - @language + - @language.helper.language_file + - @installer.navigation.provider + - @template + - @path_helper + - @symfony_request + - @router + - %core.root_path% + + phpbb.installer.controller.install: + class: phpbb\install\controller\install + arguments: + - @phpbb.installer.controller.helper + - @installer.helper.iohandler_factory + - @template + - @request + - @installer.installer.install diff --git a/phpBB/config/installer/container/services_install_data.yml b/phpBB/config/installer/container/services_install_data.yml new file mode 100644 index 0000000000..5e01be2bce --- /dev/null +++ b/phpBB/config/installer/container/services_install_data.yml @@ -0,0 +1,29 @@ +services: + installer.install_data.add_bots: + class: phpbb\install\module\install_data\task\add_bots + arguments: + - @installer.helper.config + - @installer.helper.iohandler + - @installer.helper.container_factory + - @language + - %core.root_path% + - %core.php_ext% + + installer.install_data.add_languages: + class: phpbb\install\module\install_data\task\add_languages + arguments: + - @installer.helper.iohandler + - @installer.helper.container_factory + - @language.helper.language_file + + installer.install_data.add_modules: + class: phpbb\install\module\install_data\task\add_modules + arguments: + - @installer.helper.iohandler + - @installer.helper.container_factory + + installer.module.data_install: + class: phpbb\install\module\install_data\module + parent: installer.module_base + arguments: + - ["installer.install_data.add_languages", "installer.install_data.add_bots", "installer.install_data.add_modules"] diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml new file mode 100644 index 0000000000..865f2d8ab6 --- /dev/null +++ b/phpBB/config/installer/container/services_install_database.yml @@ -0,0 +1,36 @@ +services: + installer.install_database.create_schema: + class: phpbb\install\module\install_database\task\create_schema + arguments: + - @installer.helper.config + - @installer.helper.database + - @filesystem + - @installer.helper.iohandler + # - @installer.helper.container_factory + - %core.root_path% + - %core.php_ext% + + installer.install_database.add_default_data: + class: phpbb\install\module\install_database\task\add_default_data + arguments: + - @installer.helper.database + - @installer.helper.config + - @installer.helper.iohandler + - @installer.helper.container_factory + - @language + + installer.install_database.add_config_settings: + class: phpbb\install\module\install_database\task\add_config_settings + arguments: + - @filesystem + - @installer.helper.config + - @installer.helper.iohandler + - @installer.helper.container_factory + - @language + - %core.root_path% + + installer.module.database_install: + class: phpbb\install\module\install_database\module + parent: installer.module_base + arguments: + - ["installer.install_database.create_schema", "installer.install_database.add_default_data", "installer.install_database.add_config_settings"] diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml new file mode 100644 index 0000000000..24497d330a --- /dev/null +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -0,0 +1,16 @@ +services: + installer.filesystem.create_config: + class: phpbb\install\module\install_filesystem\task\create_config_file + arguments: + - @filesystem + - @installer.helper.config + - @installer.helper.database + - @installer.helper.iohandler + - %core.root_path% + - %core.php_ext% + + installer.module.filesystem_install: + class: phpbb\install\module\install_filesystem\module + parent: installer.module_base + arguments: + - ["installer.filesystem.create_config"] diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml new file mode 100644 index 0000000000..20cd60983b --- /dev/null +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -0,0 +1,20 @@ +services: + installer.finish.populate_migrations: + class: phpbb\install\module\install_finish\task\populate_migrations + arguments: + - @installer.helper.container_factory + + installer.finish.notify_user: + class: phpbb\install\module\install_finish\task\notify_user + arguments: + - @installer.helper.container_factory + - @installer.helper.config + - @installer.helper.iohandler + - %core.root_path% + - %core.php_ext% + + installer.module.finish_install: + class: phpbb\install\module\install_filesystem\module + parent: installer.module_base + arguments: + - ["installer.finish.populate_migrations", "installer.finish.notify_user"] diff --git a/phpBB/config/installer/container/services_install_navigation.yml b/phpBB/config/installer/container/services_install_navigation.yml new file mode 100644 index 0000000000..88c495825b --- /dev/null +++ b/phpBB/config/installer/container/services_install_navigation.yml @@ -0,0 +1,25 @@ +services: + installer.navigation.provider: + class: phpbb\install\helper\navigation\navigation_provider + arguments: + - @installer.navigation.service_collection + + installer.navigation.service_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: installer.navigation } + + installer.navigation.main_navigation: + class: phpbb\install\helper\navigation\main_navigation + scope: prototype + tags: + - { name: installer.navigation } + + installer.navigation.install_navigation: + class: phpbb\install\helper\navigation\install_navigation + scope: prototype + tags: + - { name: installer.navigation } + diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml new file mode 100644 index 0000000000..2800392c58 --- /dev/null +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -0,0 +1,43 @@ +services: + installer.obtain_data.admin: + class: phpbb\install\module\obtain_data\task\obtain_admin_data + arguments: + - @installer.helper.config + - @installer.helper.iohandler + + installer.obtain_data.board: + class: phpbb\install\module\obtain_data\task\obtain_board_data + arguments: + - @installer.helper.config + - @installer.helper.iohandler + - @language.helper.language_file + + installer.obtain_data.database: + class: phpbb\install\module\obtain_data\task\obtain_database_data + arguments: + - @installer.helper.database + - @installer.helper.config + - @installer.helper.iohandler + + installer.obtain_data.email: + class: phpbb\install\module\obtain_data\task\obtain_email_data + arguments: + - @installer.helper.config + - @installer.helper.iohandler + + installer.obtain_data.imagick: + class: phpbb\install\module\obtain_data\task\obtain_imagick_path + arguments: + - @installer.helper.config + + installer.obtain_data.server: + class: phpbb\install\module\obtain_data\task\obtain_server_data + arguments: + - @installer.helper.config + - @installer.helper.iohandler + + installer.module.obtain_data_install: + class: phpbb\install\module\obtain_data\module + parent: installer.module_base + arguments: + - ["installer.obtain_data.admin", "installer.obtain_data.database", "installer.obtain_data.server", "installer.obtain_data.email", "installer.obtain_data.board", "installer.obtain_data.imagick"] diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml new file mode 100644 index 0000000000..afbe341c06 --- /dev/null +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -0,0 +1,20 @@ +services: + installer.requirements.task.filesystem: + class: phpbb\install\module\requirements\task\check_filesystem + arguments: + - @filesystem + - @installer.helper.iohandler + - %core.root_path% + - %core.php_ext% + + installer.requirements.task.server: + class: phpbb\install\module\requirements\task\check_server_environment + arguments: + - @installer.helper.database + - @installer.helper.iohandler + + installer.module.requirements_install: + class: phpbb\install\module\requirements\module + parent: installer.module_base + arguments: + - ["installer.requirements.task.filesystem", "installer.requirements.task.server"] diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml new file mode 100644 index 0000000000..ce27ae8abd --- /dev/null +++ b/phpBB/config/installer/container/services_installer.yml @@ -0,0 +1,70 @@ +imports: + - { resource: services_install_controller.yml } + - { resource: services_install_data.yml } + - { resource: services_install_database.yml } + - { resource: services_install_filesystem.yml } + - { resource: services_install_finish.yml } + - { resource: services_install_navigation.yml } + - { resource: services_install_obtain_data.yml } + - { resource: services_install_requirements.yml } + +services: +# -------- Installer helpers ------------------------ + installer.helper.config: + class: phpbb\install\helper\config + arguments: + - @filesystem + - @php_ini + - %core.root_path% + + installer.helper.database: + class: phpbb\install\helper\database + arguments: + - @filesystem + - %core.root_path% + + installer.helper.iohandler_factory: + class: phpbb\install\helper\iohandler\factory + arguments: + - @service_container + + installer.helper.iohandler_abstract: + abstract: true + calls: + - [set_language, ["@language"]] + + installer.helper.iohandler_ajax: + class: phpbb\install\helper\iohandler\ajax_iohandler + parent: installer.helper.iohandler_abstract + arguments: + - @request + - @template + + installer.helper.iohandler: + class: phpbb\install\helper\iohandler\iohandler_interface + factory: ["@installer.helper.iohandler_factory", get] + + installer.helper.container_factory: + class: phpbb\install\helper\container_factory + arguments: + - @request + - %core.root_path% + - %core.php_ext% + +# -------- Installer -------------------------------- + installer.module_base: + abstract: true + calls: + - [setup, [@service_container, @installer.helper.config, @installer.helper.iohandler]] + + installer.installer.abstract: + class: phpbb\install\installer + abstract: true + arguments: + - @installer.helper.config + - @service_container + + installer.installer.install: + parent: installer.installer.abstract + calls: + - [set_modules, [["installer.module.requirements_install", "installer.module.obtain_data_install", "installer.module.filesystem_install", "installer.module.database_install", "installer.module.data_install", "installer.module.finish_install"]]] diff --git a/phpBB/install/exception/installer_exception.php b/phpBB/install/exception/installer_exception.php new file mode 100644 index 0000000000..c37950d05c --- /dev/null +++ b/phpBB/install/exception/installer_exception.php @@ -0,0 +1,22 @@ + + * @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\exception; + +/** + * Installer's base exception + */ +class installer_exception extends \Exception +{ + +} diff --git a/phpBB/install/helper/navigation/main_navigation.php b/phpBB/install/helper/navigation/main_navigation.php new file mode 100644 index 0000000000..ad67840424 --- /dev/null +++ b/phpBB/install/helper/navigation/main_navigation.php @@ -0,0 +1,45 @@ + + * @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\helper\navigation; + +class main_navigation implements navigation_interface +{ + public function get() + { + return array( + 'overview' => array( + 'label' => 'MENU_OVERVIEW', + 'route' => 'phpbb_installer_index', + 'order' => 0, + array( + 'introduction' => array( + 'label' => 'MENU_INTRO', + 'route' => 'phpbb_installer_index', + 'order' => 0, + ), + 'support' => array( + 'label' => 'MENU_SUPPORT', + 'route' => 'phpbb_installer_support', + 'order' => 1, + ), + 'license' => array( + 'label' => 'MENU_LICENSE', + 'route' => 'phpbb_installer_license', + 'order' => 2, + ), + ), + ), + ); + } +} diff --git a/phpBB/install/module/install_data/module.php b/phpBB/install/module/install_data/module.php new file mode 100644 index 0000000000..231bcb0866 --- /dev/null +++ b/phpBB/install/module/install_data/module.php @@ -0,0 +1,22 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data; + +/** + * Installer module for recovering and installing default data installation + */ +class module extends \phpbb\install\module_base +{ + +} diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php new file mode 100644 index 0000000000..8ce4ae765d --- /dev/null +++ b/phpBB/install/module/install_data/task/add_bots.php @@ -0,0 +1,224 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_bots extends \phpbb\install\task_base +{ + /** + * @var array + */ + protected $bot_list; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $install_config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language provider + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP extension + */ + public function __construct(\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, + $php_ext) + { + parent::__construct(true); + + $this->db = $container->get('dbal.conn'); + $this->install_config = $install_config; + $this->io_handler = $iohandler; + $this->language = $language; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + /** + * A list of the web-crawlers/bots we recognise by default + * + * Candidates but not included: + * 'Accoona [Bot]' 'Accoona-AI-Agent/' + * 'ASPseek [Crawler]' 'ASPseek/' + * 'Boitho [Crawler]' 'boitho.com-dc/' + * 'Bunnybot [Bot]' 'powered by www.buncat.de' + * 'Cosmix [Bot]' 'cfetch/' + * 'Crawler Search [Crawler]' '.Crawler-Search.de' + * 'Findexa [Crawler]' 'Findexa Crawler (' + * 'GBSpider [Spider]' 'GBSpider v' + * 'genie [Bot]' 'genieBot (' + * 'Hogsearch [Bot]' 'oegp v. 1.3.0' + * 'Insuranco [Bot]' 'InsurancoBot' + * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' + * 'ISC Systems [Bot]' 'ISC Systems iRc Search' + * 'Jyxobot [Bot]' 'Jyxobot/' + * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' + * 'LinkWalker' 'LinkWalker' + * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' + * 'Naver [Bot]' 'nhnbot@naver.com)' + * 'NetResearchServer' 'NetResearchServer/' + * 'Nimble [Crawler]' 'NimbleCrawler' + * 'Ocelli [Bot]' 'Ocelli/' + * 'Onsearch [Bot]' 'onCHECK-Robot' + * 'Orange [Spider]' 'OrangeSpider' + * 'Sproose [Bot]' 'http://www.sproose.com/bot' + * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' + * 'Tbot [Bot]' 'Tbot/' + * 'Thumbshots [Capture]' 'thumbshots-de-Bot' + * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' + * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' + * 'WissenOnline [Bot]' 'WissenOnline-Bot' + * 'WWWeasel [Bot]' 'WWWeasel Robot v' + * 'Xaldon [Spider]' 'Xaldon WebSpider' + */ + $this->bot_list = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $this->db->sql_query($sql); + $group_id = (int) $this->db->sql_fetchfield('group_id'); + $this->db->sql_freeresult($result); + + if (!$group_id) + { + // If we reach this point then something has gone very wrong + $this->io_handler->add_error_message('NO_GROUP'); + } + + foreach ($this->bot_list as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $this->install_config->get('default_lang'), + 'user_style' => 1, + 'user_timezone' => 'UTC', + 'user_dateformat' => $this->language->lang('default_dateformat'), + 'user_allow_massemail' => 0, + 'user_allow_pm' => 0, + ); + + $user_id = user_add($user_row); + + if (!$user_id) + { + // If we can't insert this user then continue to the next one to avoid inconsistent data + $this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT'); + + continue; + } + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_ary[0], + 'bot_ip' => (string) $bot_ary[1], + )); + + $this->db->sql_query($sql); + } + } +} diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php new file mode 100644 index 0000000000..9502a736f3 --- /dev/null +++ b/phpBB/install/module/install_data/task/add_languages.php @@ -0,0 +1,105 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_languages extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $language_helper; + + /** + * Constructor + * + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language_file_helper $language_helper Language file helper service + */ + public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language_file_helper $language_helper) + { + $this->db = $container->get('dbal.conn'); + $this->iohandler = $iohandler; + $this->language_helper = $language_helper; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $languages = $this->language_helper->get_available_languages(); + $installed_languages = array(); + + foreach ($languages as $lang_info) + { + $lang_pack = array( + 'lang_iso' => $lang_info['iso'], + 'lang_dir' => $lang_info['iso'], + 'lang_english_name' => htmlspecialchars($lang_info['name']), + 'lang_local_name' => htmlspecialchars($lang_info['local_name'], ENT_COMPAT, 'UTF-8'), + 'lang_author' => htmlspecialchars($lang_info['author'], ENT_COMPAT, 'UTF-8'), + ); + + $this->db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $this->db->sql_build_array('INSERT', $lang_pack)); + + $installed_languages[] = (int) $this->db->sql_nextid(); + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message($error['message']); + } + } + + $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + + $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE); + while ($row = $this->db->sql_fetchrow($result)) + { + foreach ($installed_languages as $lang_id) + { + $insert_buffer->insert(array( + 'field_id' => $row['field_id'], + 'lang_id' => $lang_id, + + // Remove phpbb_ from field name + 'lang_name' => strtoupper(substr($row['field_name'], 6)), + 'lang_explain' => '', + 'lang_default_value' => '', + )); + } + } + + $this->db->sql_freeresult($result); + + $insert_buffer->flush(); + } +} diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/install/module/install_data/task/add_modules.php new file mode 100644 index 0000000000..98b52d7494 --- /dev/null +++ b/phpBB/install/module/install_data/task/add_modules.php @@ -0,0 +1,452 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_data\task; + +class add_modules extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\module\module_manager + */ + protected $module_manager; + + /** + * Define the module structure so that we can populate the database without + * needing to hard-code module_id values + * + * @var array + */ + protected $module_categories; + + /** + * @var array + */ + protected $module_categories_basenames; + + /** + * @var array + */ + protected $module_extras; + + /** + * Constructor + * + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + */ + public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container) + { + $this->db = $container->get('dbal.conn'); + $this->extension_manager = $container->get('ext.manager'); + $this->iohandler = $iohandler; + $this->module_manager = $container->get('module.manager'); + + parent::__construct(true); + + $this->module_categories = array( + 'acp' => array( + 'ACP_CAT_GENERAL' => array( + 'ACP_QUICK_ACCESS', + 'ACP_BOARD_CONFIGURATION', + 'ACP_CLIENT_COMMUNICATION', + 'ACP_SERVER_CONFIGURATION', + ), + 'ACP_CAT_FORUMS' => array( + 'ACP_MANAGE_FORUMS', + 'ACP_FORUM_BASED_PERMISSIONS', + ), + 'ACP_CAT_POSTING' => array( + 'ACP_MESSAGES', + 'ACP_ATTACHMENTS', + ), + 'ACP_CAT_USERGROUP' => array( + 'ACP_CAT_USERS', + 'ACP_GROUPS', + 'ACP_USER_SECURITY', + ), + 'ACP_CAT_PERMISSIONS' => array( + 'ACP_GLOBAL_PERMISSIONS', + 'ACP_FORUM_BASED_PERMISSIONS', + 'ACP_PERMISSION_ROLES', + 'ACP_PERMISSION_MASKS', + ), + 'ACP_CAT_CUSTOMISE' => array( + 'ACP_STYLE_MANAGEMENT', + 'ACP_EXTENSION_MANAGEMENT', + 'ACP_LANGUAGE', + ), + 'ACP_CAT_MAINTENANCE' => array( + 'ACP_FORUM_LOGS', + 'ACP_CAT_DATABASE', + ), + 'ACP_CAT_SYSTEM' => array( + 'ACP_AUTOMATION', + 'ACP_GENERAL_TASKS', + 'ACP_MODULE_MANAGEMENT', + ), + 'ACP_CAT_DOT_MODS' => null, + ), + 'mcp' => array( + 'MCP_MAIN' => null, + 'MCP_QUEUE' => null, + 'MCP_REPORTS' => null, + 'MCP_NOTES' => null, + 'MCP_WARN' => null, + 'MCP_LOGS' => null, + 'MCP_BAN' => null, + ), + 'ucp' => array( + 'UCP_MAIN' => null, + 'UCP_PROFILE' => null, + 'UCP_PREFS' => null, + 'UCP_PM' => null, + 'UCP_USERGROUPS' => null, + 'UCP_ZEBRA' => null, + ), + ); + + $this->module_categories_basenames = array( + 'UCP_PM' => 'ucp_pm', + ); + + $this->module_extras = array( + 'acp' => array( + 'ACP_QUICK_ACCESS' => array( + 'ACP_MANAGE_USERS', + 'ACP_GROUPS_MANAGE', + 'ACP_MANAGE_FORUMS', + 'ACP_MOD_LOGS', + 'ACP_BOTS', + 'ACP_PHP_INFO', + ), + 'ACP_FORUM_BASED_PERMISSIONS' => array( + 'ACP_FORUM_PERMISSIONS', + 'ACP_FORUM_PERMISSIONS_COPY', + 'ACP_FORUM_MODERATORS', + 'ACP_USERS_FORUM_PERMISSIONS', + 'ACP_GROUPS_FORUM_PERMISSIONS', + ), + ), + ); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $module_classes = array('acp', 'mcp', 'ucp'); + foreach ($module_classes as $module_class) + { + $categories = array(); + + foreach ($this->module_categories[$module_class] as $cat_name => $subs) + { + // Check if this sub-category has a basename. If it has, use it. + $basename = (isset($this->module_categories_basenames[$cat_name])) ? $this->module_categories_basenames[$cat_name] : ''; + + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => $module_class, + 'module_langname' => $cat_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $categories[$cat_name]['id'] = (int)$module_data['module_id']; + $categories[$cat_name]['parent_id'] = 0; + + if (is_array($subs)) + { + foreach ($subs as $level2_name) + { + // Check if this sub-category has a basename. If it has, use it. + $basename = (isset($this->module_categories_basenames[$level2_name])) ? $this->module_categories_basenames[$level2_name] : ''; + + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => (int)$categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $level2_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $categories[$level2_name]['id'] = (int)$module_data['module_id']; + $categories[$level2_name]['parent_id'] = (int)$categories[$cat_name]['id']; + } + } + } + + // Get the modules we want to add... returned sorted by name + $module_info = $this->module_manager->get_module_infos($module_class); + + foreach ($module_info as $module_basename => $fileinfo) + { + foreach ($fileinfo['modes'] as $module_mode => $row) + { + foreach ($row['cat'] as $cat_name) + { + if (!isset($categories[$cat_name])) + { + continue; + } + + $module_data = array( + 'module_basename' => $module_basename, + 'module_enabled' => 1, + 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $row['title'], + 'module_mode' => $module_mode, + 'module_auth' => $row['auth'], + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + } + + // Move some of the modules around since the code above will put them in the wrong place + if ($module_class === 'acp') + { + // Move main module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_main' + AND module_class = 'acp' + AND module_mode = 'main'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 4); + + // Move permissions intro screen module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_permissions' + AND module_class = 'acp' + AND module_mode = 'intro'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 4); + + // Move manage users screen module 5 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_users' + AND module_class = 'acp' + AND module_mode = 'overview'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 5); + + // Move extension management module 1 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT' + AND module_class = 'acp' + AND module_mode = '' + AND module_basename = ''"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'acp', 'move_up', 1); + } + + if ($module_class == 'mcp') + { + // Move pm report details module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_report_details'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + + // Move closed pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports_closed'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + + // Move open pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'mcp', 'move_down', 3); + } + + if ($module_class == 'ucp') + { + // Move attachment module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_attachments' + AND module_class = 'ucp' + AND module_mode = 'attachments'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 4); + + // Move notification options module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_notifications' + AND module_class = 'ucp' + AND module_mode = 'notification_options'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 4); + + // Move OAuth module 5 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_auth_link' + AND module_class = 'ucp' + AND module_mode = 'auth_link'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $this->module_manager->move_module_by($row, 'ucp', 'move_down', 5); + } + + // And now for the special ones + // (these are modules which appear in multiple categories and thus get added manually + // to some for more control) + if (isset($this->module_extras[$module_class])) + { + foreach ($this->module_extras[$module_class] as $cat_name => $mods) + { + $sql = 'SELECT module_id, left_id, right_id + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($cat_name) . "' + AND module_class = '" . $this->db->sql_escape($module_class) . "'"; + $result = $this->db->sql_query_limit($sql, 1); + $row2 = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + foreach ($mods as $mod_name) + { + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($mod_name) . "' + AND module_class = '" . $this->db->sql_escape($module_class) . "' + AND module_basename <> ''"; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $module_data = array( + 'module_basename' => $row['module_basename'], + 'module_enabled' => (int) $row['module_enabled'], + 'module_display' => (int) $row['module_display'], + 'parent_id' => (int) $row2['module_id'], + 'module_class' => $row['module_class'], + 'module_langname' => $row['module_langname'], + 'module_mode' => $row['module_mode'], + 'module_auth' => $row['module_auth'], + ); + + $this->module_manager->update_module_data($module_data); + + // Check for last sql error happened + if ($this->db->get_sql_error_triggered()) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + } + } + + $this->module_manager->remove_cache_file($module_class); + } + } +} diff --git a/phpBB/install/module/install_database/module.php b/phpBB/install/module/install_database/module.php new file mode 100644 index 0000000000..d31c5573ec --- /dev/null +++ b/phpBB/install/module/install_database/module.php @@ -0,0 +1,22 @@ + + * @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 +{ + +} diff --git a/phpBB/install/module/install_database/task/add_config_settings.php b/phpBB/install/module/install_database/task/add_config_settings.php new file mode 100644 index 0000000000..38dcef1d7a --- /dev/null +++ b/phpBB/install/module/install_database/task/add_config_settings.php @@ -0,0 +1,325 @@ + + * @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']); + } + } + } +} diff --git a/phpBB/install/module/install_database/task/add_default_data.php b/phpBB/install/module/install_database/task/add_default_data.php new file mode 100644 index 0000000000..a5c2ffecd1 --- /dev/null +++ b/phpBB/install/module/install_database/task/add_default_data.php @@ -0,0 +1,145 @@ + + * @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 ''; + } +} diff --git a/phpBB/install/module/install_database/task/create_schema.php b/phpBB/install/module/install_database/task/create_schema.php new file mode 100644 index 0000000000..aac710d337 --- /dev/null +++ b/phpBB/install/module/install_database/task/create_schema.php @@ -0,0 +1,198 @@ + + * @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 + ); + } + } +} diff --git a/phpBB/install/module/install_filesystem/module.php b/phpBB/install/module/install_filesystem/module.php new file mode 100644 index 0000000000..9562c957fd --- /dev/null +++ b/phpBB/install/module/install_filesystem/module.php @@ -0,0 +1,22 @@ + + * @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_filesystem; + +/** + * Installer module for filesystem installation + */ +class module extends \phpbb\install\module_base +{ + +} diff --git a/phpBB/install/module/install_filesystem/task/create_config_file.php b/phpBB/install/module/install_filesystem/task/create_config_file.php new file mode 100644 index 0000000000..f1191f53d0 --- /dev/null +++ b/phpBB/install/module/install_filesystem/task/create_config_file.php @@ -0,0 +1,219 @@ + + * @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_filesystem\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * Dumps config file + */ +class create_config_file extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\database + */ + protected $db_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\database $db_helper, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext) + { + $this->install_config = $install_config; + $this->db_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $config_written = true; + + // Create config.php + $path_to_config = $this->phpbb_root_path . 'config.' . $this->php_ext; + + $fp = @fopen($path_to_config, 'w'); + if (!$fp) + { + $config_written = false; + } + + $config_content = $this->get_config_data(); + + if (!@fwrite($fp, $config_content)) + { + $config_written = false; + } + + @fclose($fp); + + // chmod config.php to be only readable + if ($config_written) + { + try + { + $this->filesystem->phpbb_chmod($path_to_config, \phpbb\filesystem\filesystem_interface::CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + else + { + $this->iohandler->add_error_message('UNABLE_TO_WRITE_CONFIG_FILE'); + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($this->phpbb_root_path . 'cache/install_lock', 'wb'); + if ($fp === false) + { + // We were unable to create the lock file - abort + $this->iohandler->add_error_message('UNABLE_TO_WRITE_LOCK'); + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + @fclose($fp); + + try + { + $this->filesystem->phpbb_chmod($this->phpbb_root_path . 'cache/install_lock', 0777); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + + /** + * Returns the content which should be dumped to config.php + * + * @param bool $debug If the debug constants should be enabled by default or not + * @param bool $debug_container If the container should be compiled on + * every page load or not + * @param bool $debug_test If the DEBUG_TEST constant should be added + * NOTE: Only for use within the testing framework + * + * @return string content to be written to the config file + */ + protected function get_config_data($debug = false, $debug_container = false, $debug_test = false) + { + $config_content = "install_config->get('dbms'); + $db_driver = $this->db_helper->get_available_dbms($dbms); + $db_driver = $db_driver[$dbms]['DRIVER']; + + $config_data_array = array( + 'dbms' => $db_driver, + 'dbhost' => $this->install_config->get('dbhost'), + 'dbport' => $this->install_config->get('dbport'), + 'dbname' => $this->install_config->get('dbname'), + 'dbuser' => $this->install_config->get('dbuser'), + 'dbpasswd' => $this->install_config->get('dbpasswd'), + 'table_prefix' => $this->install_config->get('table_prefix'), + + 'phpbb_adm_relative_path' => 'adm/', + + 'acm_type' => 'phpbb\cache\driver\file', + ); + + foreach ($config_data_array as $key => $value) + { + $config_content .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; + } + + $config_content .= "\n@define('PHPBB_INSTALLED', true);\n"; + $config_content .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n"; + + if ($debug_test) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'test');\n"; + } + else if ($debug) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'development');\n"; + } + else + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'production');\n"; + } + + if ($debug_container) + { + $config_content .= "@define('DEBUG_CONTAINER', true);\n"; + } + else + { + $config_content .= "// @define('DEBUG_CONTAINER', true);\n"; + } + + if ($debug_test) + { + $config_content .= "@define('DEBUG_TEST', true);\n"; + + // Mandatory for the functional tests, will be removed by PHPBB3-12623 + $config_content .= "@define('DEBUG', true);\n"; + } + + return $config_content; + } +} diff --git a/phpBB/install/module/install_finish/module.php b/phpBB/install/module/install_finish/module.php new file mode 100644 index 0000000000..98c99d7cff --- /dev/null +++ b/phpBB/install/module/install_finish/module.php @@ -0,0 +1,22 @@ + + * @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_finish; + +/** + * Installer module for filesystem installation + */ +class module extends \phpbb\install\module_base +{ + +} diff --git a/phpBB/install/module/install_finish/task/notify_user.php b/phpBB/install/module/install_finish/task/notify_user.php new file mode 100644 index 0000000000..d95303fcb5 --- /dev/null +++ b/phpBB/install/module/install_finish/task/notify_user.php @@ -0,0 +1,113 @@ + + * @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_finish\task; + +/** + * Logs installation and sends an email to the admin + */ +class notify_user extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * @var \phpbb\config\db + */ + protected $config; + + /** + * @var \phpbb\log\log_interface + */ + protected $log; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\container_factory $container + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path, $php_ext) + { + $this->install_config = $install_config; + $this->iohandler = $iohandler; + + $this->auth = $container->get('auth'); + $this->config = $container->get('config'); + $this->log = $container->get('log'); + $this->user = $container->get('user'); + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // @todo + //$this->user->setup('common'); + + //$this->user->session_begin(); + //$this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_pass1'), false, true, true); + + if ($this->config['email_enable']) + { + include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); + + $messenger = new \messenger(false); + $messenger->template('installed', $this->install_config->get('language')); + $messenger->to($this->config['board_email'], $this->install_config->get('admin_name')); + $messenger->anti_abuse_headers($this->config, $this->user); + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), + 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_pass1'))) + ); + $messenger->send(NOTIFY_EMAIL); + } + + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version'])); + + @unlink($this->phpbb_root_path . 'cache/install_lock'); + } +} diff --git a/phpBB/install/module/install_finish/task/populate_migrations.php b/phpBB/install/module/install_finish/task/populate_migrations.php new file mode 100644 index 0000000000..4f701b84ca --- /dev/null +++ b/phpBB/install/module/install_finish/task/populate_migrations.php @@ -0,0 +1,54 @@ + + * @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_finish\task; + +/** + * Populates migrations + */ +class populate_migrations extends \phpbb\install\task_base +{ + /** + * @var \phpbb\extension\manager + */ + protected $extension_manager; + + /** + * @var \phpbb\db\migrator + */ + protected $migrator; + + /** + * Constructor + * + * @param \phpbb\install\helper\container_factory $container phpBB's DI contianer + */ + public function __construct(\phpbb\install\helper\container_factory $container) + { + $this->extension_manager = $container->get('ext.manager'); + $this->migrator = $container->get('migrator'); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $finder = $this->extension_manager->get_finder(); + + $migrations = $finder + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $this->migrator->populate_migrations($migrations); + } +} diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php new file mode 100644 index 0000000000..9a3307cd6f --- /dev/null +++ b/phpBB/install/module/obtain_data/module.php @@ -0,0 +1,63 @@ + + * @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\obtain_data; + +class module extends \phpbb\install\module_base +{ + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_index = $this->recover_progress(); + + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if task exists + if (!isset($this->task_collection[$task_index])) + { + break; + } + + // Recover task to be executed + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + + // Iterate to the next task + $task_index++; + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + continue; + } + + $task->run(); + + // Log install progress + $current_task_index = $task_index - 1; + $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + } + } + + /** + * {@inheritdoc} + */ + public function get_task_count() + { + return 0; + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/install/module/obtain_data/task/obtain_admin_data.php new file mode 100644 index 0000000000..d820353880 --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php @@ -0,0 +1,207 @@ + + * @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\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and validates admin account data from the user + */ +class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $install_config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_admin', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + * + * @return null + */ + protected function process_form() + { + // Admin data + $admin_name = $this->io_handler->get_input('admin_name', '', true); + $admin_pass1 = $this->io_handler->get_input('admin_pass1', '', true); + $admin_pass2 = $this->io_handler->get_input('admin_pass2', '', true); + $board_email = $this->io_handler->get_input('board_email', ''); + + $admin_data_valid = $this->check_admin_data($admin_name, $admin_pass1, $admin_pass2, $board_email); + + if ($admin_data_valid) + { + $this->install_config->set('admin_name', $admin_name); + $this->install_config->set('admin_passwd', $admin_pass1); + $this->install_config->set('board_email', $board_email); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @return null + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $admin_username = $this->io_handler->get_input('admin_name', '', true); + $admin_email = $this->io_handler->get_input('board_email', '', true); + } + else + { + $admin_username = ''; + $admin_email = ''; + } + + $admin_form = array( + 'admin_name' => array( + 'label' => 'ADMIN_USERNAME', + 'description' => 'ADMIN_USERNAME_EXPLAIN', + 'type' => 'text', + 'default' => $admin_username, + ), + 'board_email' => array( + 'label' => 'CONTACT_EMAIL', + 'type' => 'email', + 'default' => $admin_email, + ), + 'admin_pass1' => array( + 'label' => 'ADMIN_PASSWORD', + 'description' => 'ADMIN_PASSWORD_EXPLAIN', + 'type' => 'password', + ), + 'admin_pass2' => array( + 'label' => 'ADMIN_PASSWORD_CONFIRM', + 'type' => 'password', + ), + 'submit_admin' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('ADMIN_CONFIG', $admin_form); + + // Require user interaction + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + + /** + * Check admin data + * + * @param string $username Admin username + * @param string $pass1 Admin password + * @param string $pass2 Admin password confirmation + * @param string $email Admin e-mail address + * + * @return bool True if data is valid, false otherwise + */ + protected function check_admin_data($username, $pass1, $pass2, $email) + { + $data_valid = true; + + // Check if none of admin data is empty + if (in_array('', array($username, $pass1, $pass2, $email))) + { + $this->io_handler->add_error_message('INST_ERR_MISSING_DATA'); + $data_valid = false; + } + + if (utf8_strlen($username) < 3) + { + $this->io_handler->add_error_message('INST_ERR_USER_TOO_SHORT'); + $data_valid = false; + } + + if (utf8_strlen($username) > 20) + { + $this->io_handler->add_error_message('INST_ERR_USER_TOO_LONG'); + $data_valid = false; + } + + if ($pass1 !== $pass2 && $pass1 !== '') + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_MISMATCH'); + $data_valid = false; + } + + // Test against the default password rules + if (utf8_strlen($pass1) < 6) + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_SHORT'); + $data_valid = false; + } + + if (utf8_strlen($pass1) > 30) + { + $this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_LONG'); + $data_valid = false; + } + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + $this->io_handler->add_error_message('INST_ERR_EMAIL_INVALID'); + $data_valid = false; + } + + return $data_valid; + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/install/module/obtain_data/task/obtain_board_data.php new file mode 100644 index 0000000000..e17ecd01c5 --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php @@ -0,0 +1,172 @@ + + * @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\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class obtains default data from the user related to board (Board name, Board descritpion, etc...) + */ +class obtain_board_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $language_helper; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\language\language_file_helper $lang_helper Language file helper + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\language\language_file_helper $lang_helper) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + $this->language_helper = $lang_helper; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_board', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + * + * @return null + */ + protected function process_form() + { + // Board data + $default_lang = $this->io_handler->get_input('default_lang', ''); + $board_name = $this->io_handler->get_input('board_name', ''); + $board_desc = $this->io_handler->get_input('board_description', ''); + + // Check default lang + $langs = $this->language_helper->get_available_languages(); + $lang_valid = false; + + foreach ($langs as $lang) + { + if ($lang['iso'] === $default_lang) + { + $lang_valid = true; + break; + } + } + + $this->install_config->set('board_name', $board_name); + $this->install_config->set('board_description', $board_desc); + + if ($lang_valid) + { + $this->install_config->set('default_lang', $default_lang); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $board_name = $this->io_handler->get_input('board_name', ''); + $board_desc = $this->io_handler->get_input('board_description', ''); + } + else + { + $board_name = '{L_CONFIG_SITENAME}'; + $board_desc = '{L_CONFIG_SITE_DESC}'; + } + + // Use language because we only check this to be valid + $default_lang = $this->install_config->get('language', ''); + + $langs = $this->language_helper->get_available_languages(); + $lang_options = array(); + + foreach ($langs as $lang) + { + $lang_options[] = array( + 'value' => $lang['iso'], + 'label' => $lang['local_name'], + 'selected' => ($default_lang === $lang['iso']), + ); + } + + $board_form = array( + 'default_lang' => array( + 'label' => 'DEFAULT_LANGUAGE', + 'type' => 'select', + 'options' => $lang_options, + ), + 'board_name' => array( + 'label' => 'BOARD_NAME', + 'type' => 'text', + 'default' => $board_name, + ), + 'board_description' => array( + 'label' => 'BOARD_DESCRIPTION', + 'type' => 'text', + 'default' => $board_desc, + ), + 'submit_board' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('BOARD_CONFIG', $board_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception; + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/install/module/obtain_data/task/obtain_database_data.php new file mode 100644 index 0000000000..4c71c4adea --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php @@ -0,0 +1,259 @@ + + * @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\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and validates database information from the user + */ +class obtain_database_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper Installer's database helper + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->database_helper = $database_helper; + $this->install_config = $install_config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Check if data is sent + if ($this->io_handler->get_input('submit_database', false)) + { + $this->process_form(); + } + else + { + $this->request_form_data(); + } + } + + /** + * Process form data + * + * @return null + */ + protected function process_form() + { + // Collect database data + $dbms = $this->io_handler->get_input('dbms', ''); + $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbport = $this->io_handler->get_input('dbport', ''); + $dbuser = $this->io_handler->get_input('dbuser', ''); + $dbpasswd = $this->io_handler->get_input('dbpasswd', '', true); + $dbname = $this->io_handler->get_input('dbname', ''); + $table_prefix = $this->io_handler->get_input('table_prefix', ''); + + // Check database data + $user_data_vaild = $this->check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpasswd, $dbname, $table_prefix); + + // Save database data if it is correct + if ($user_data_vaild) + { + $this->install_config->set('dbms', $dbms); + $this->install_config->set('dbhost', $dbhost); + $this->install_config->set('dbport', $dbport); + $this->install_config->set('dbuser', $dbuser); + $this->install_config->set('dbpasswd', $dbpasswd); + $this->install_config->set('dbname', $dbname); + $this->install_config->set('table_prefix', $table_prefix); + } + else + { + $this->request_form_data(true); + } + } + + /** + * Request data from the user + * + * @param bool $use_request_data Whether to use submited data + * + * @return null + * + * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + */ + protected function request_form_data($use_request_data = false) + { + if ($use_request_data) + { + $dbms = $this->io_handler->get_input('dbms', ''); + $dbhost = $this->io_handler->get_input('dbhost', ''); + $dbport = $this->io_handler->get_input('dbport', ''); + $dbuser = $this->io_handler->get_input('dbuser', ''); + $dbname = $this->io_handler->get_input('dbname', ''); + $table_prefix = $this->io_handler->get_input('table_prefix', 'phpbb_'); + } + else + { + $dbms = ''; + $dbhost = ''; + $dbport = ''; + $dbuser = ''; + $dbname = ''; + $table_prefix = 'phpbb_'; + } + + $dbms_select = array(); + foreach ($this->database_helper->get_available_dbms() as $dbms_key => $dbms_array) + { + $dbms_select[] = array( + 'value' => $dbms_key, + 'label' => 'DB_OPTION_' . strtoupper($dbms_key), + 'selected' => ($dbms_key === $dbms), + ); + } + + $database_form = array( + 'dbms' => array( + 'label' => 'DBMS', + 'type' => 'select', + 'options' => $dbms_select, + ), + 'dbhost' => array( + 'label' => 'DB_HOST', + 'description' => 'DB_HOST_EXPLAIN', + 'type' => 'text', + 'default' => $dbhost, + ), + 'dbport' => array( + 'label' => 'DB_PORT', + 'description' => 'DB_PORT_EXPLAIN', + 'type' => 'text', + 'default' => $dbport, + ), + 'dbuser' => array( + 'label' => 'DB_USERNAME', + 'type' => 'text', + 'default' => $dbuser, + ), + 'dbpasswd' => array( + 'label' => 'DB_PASSWORD', + 'type' => 'password', + ), + 'dbname' => array( + 'label' => 'DB_NAME', + 'type' => 'text', + 'default' => $dbname, + ), + 'table_prefix' => array( + 'label' => 'TABLE_PREFIX', + 'description' => 'TABLE_PREFIX_EXPLAIN', + 'type' => 'text', + 'default' => $table_prefix, + ), + 'submit_database' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('DB_CONFIG', $database_form); + + // Require user interaction + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + + /** + * Check database data + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return bool True if database data is correct, false otherwise + */ + protected function check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $available_dbms = $this->database_helper->get_available_dbms(); + $data_valid = true; + + // Check if PHP has the database extensions for the specified DBMS + if (!isset($available_dbms[$dbms])) + { + $this->io_handler->add_error_message('INST_ERR_NO_DB'); + $data_valid = false; + } + + // Validate table prefix + $prefix_valid = $this->database_helper->validate_table_prefix($dbms, $table_prefix); + if (is_array($prefix_valid)) + { + foreach ($prefix_valid as $error) + { + $this->io_handler->add_error_message( + $error['title'], + (isset($error['description'])) ? $error['description'] : false + ); + } + + $data_valid = false; + } + + // Try to connect to database if all provided data is valid + if ($data_valid) + { + $connect_test = $this->database_helper->check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix); + if (is_array($connect_test)) + { + foreach ($prefix_valid as $error) + { + $this->io_handler->add_error_message( + $error['title'], + (isset($error['description'])) ? $error['description'] : false + ); + } + + $data_valid = false; + } + } + + return $data_valid; + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_email_data.php b/phpBB/install/module/obtain_data/task/obtain_email_data.php new file mode 100644 index 0000000000..fbcef0a5c6 --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_email_data.php @@ -0,0 +1,151 @@ + + * @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\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +class obtain_email_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // E-mail data + $email_enable = $this->io_handler->get_input('email_enable', true); + $smtp_delivery = $this->io_handler->get_input('smtp_delivery', ''); + $smtp_host = $this->io_handler->get_input('smtp_host', ''); + $smtp_auth = $this->io_handler->get_input('smtp_auth', ''); + $smtp_user = $this->io_handler->get_input('smtp_user', ''); + $smtp_passwd = $this->io_handler->get_input('smtp_pass', ''); + + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + + // Check if data is sent + if ($this->io_handler->get_input('submit_email', false)) + { + $this->install_config->set('email_enable', $email_enable); + $this->install_config->set('smtp_delivery', $smtp_delivery); + $this->install_config->set('smtp_host', $smtp_host); + $this->install_config->set('smtp_auth', $smtp_auth); + $this->install_config->set('smtp_user', $smtp_user); + $this->install_config->set('smtp_pass', $smtp_passwd); + } + else + { + $auth_options = array(); + foreach ($auth_methods as $method) + { + $auth_options[] = array( + 'value' => $method, + 'label' => 'SMTP_' . str_replace('-', '_', $method), + 'selected' => false, + ); + } + + $email_form = array( + 'email_enable' => array( + 'label' => 'ENABLE_EMAIL', + 'description' => 'COOKIE_SECURE_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 1, + 'label' => 'ENABLE', + 'selected' => true, + ), + array( + 'value' => 0, + 'label' => 'DISABLE', + 'selected' => false, + ), + ), + ), + 'smtp_delivery' => array( + 'label' => 'USE_SMTP', + 'description' => 'USE_SMTP_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => true, + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => false, + ), + ), + ), + 'smtp_host' => array( + 'label' => 'SMTP_SERVER', + 'description' => 'SMTP_SERVER_EXPLAIN', + 'type' => 'text', + 'default' => $smtp_host, + ), + 'smtp_auth' => array( + 'label' => 'SMTP_AUTH_METHOD', + 'type' => 'select', + 'options' => $auth_options, + ), + 'smtp_user' => array( + 'label' => 'SMTP_USERNAME', + 'description' => 'SMTP_USERNAME_EXPLAIN', + 'type' => 'text', + 'default' => $smtp_user, + ), + 'smtp_pass' => array( + 'label' => 'SMTP_PASSWORD', + 'description' => 'SMTP_PASSWORD_EXPLAIN', + 'type' => 'password', + ), + 'submit_email' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ), + ); + + $this->io_handler->add_user_form_group('EMAIL_CONFIG', $email_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php new file mode 100644 index 0000000000..86af586e37 --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php @@ -0,0 +1,73 @@ + + * @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\obtain_data\task; + +class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + */ + public function __construct(\phpbb\install\helper\config $config) + { + $this->config = $config; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Can we find Imagemagick anywhere on the system? + $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; + + $magic_home = getenv('MAGICK_HOME'); + $img_imagick = ''; + if (empty($magic_home)) + { + $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); + $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); + + $locations = array_merge($path_locations, $locations); + foreach ($locations as $location) + { + // The path might not end properly, fudge it + if (substr($location, -1, 1) !== '/') + { + $location .= '/'; + } + + if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) + { + $img_imagick = str_replace('\\', '/', $location); + continue; + } + } + } + else + { + $img_imagick = str_replace('\\', '/', $magic_home); + } + + $this->config->set('img_imagick', $img_imagick); + } +} diff --git a/phpBB/install/module/obtain_data/task/obtain_server_data.php b/phpBB/install/module/obtain_data/task/obtain_server_data.php new file mode 100644 index 0000000000..39606f6281 --- /dev/null +++ b/phpBB/install/module/obtain_data/task/obtain_server_data.php @@ -0,0 +1,187 @@ + + * @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\obtain_data\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * This class requests and saves some information about the server + */ +class obtain_server_data extends \phpbb\install\task_base implements \phpbb\install\task_interface +{ + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $io_handler; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->io_handler = $iohandler; + + parent::__construct(true); + } + /** + * {@inheritdoc} + */ + public function run() + { + $cookie_secure = $this->io_handler->is_secure(); + $server_protocol = ($this->io_handler->is_secure()) ? 'https://' : 'http://'; + $server_port = $this->io_handler->get_server_variable('SERVER_PORT', 0); + + // HTTP_HOST is having the correct browser url in most cases... + $server_name = strtolower(htmlspecialchars_decode($this->io_handler->get_header_variable( + 'Host', + $this->io_handler->get_server_variable('SERVER_NAME') + ))); + + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') !== false) + { + $server_name = substr($server_name, 0, strpos($server_name, ':')); + } + + $script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('PHP_SELF')); + + if (!$script_path) + { + $script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('REQUEST_URI')); + } + + $script_path = str_replace(array('\\', '//'), '/', $script_path); + $script_path = trim(dirname(dirname($script_path))); + + // Server data + $cookie_secure = $this->io_handler->get_input('cookie_secure', $cookie_secure); + $server_protocol = $this->io_handler->get_input('server_protocol', $server_protocol); + $force_server_vars = $this->io_handler->get_input('force_server_vars', 0); + $server_name = $this->io_handler->get_input('server_name', $server_name); + $server_port = $this->io_handler->get_input('server_port', $server_port); + $script_path = $this->io_handler->get_input('script_path', $script_path); + + // Clean up script path + if ($script_path !== '/') + { + // Adjust destination path (no trailing slash) + if (substr($script_path, -1) === '/') + { + $script_path = substr($script_path, 0, -1); + } + + $script_path = str_replace(array('../', './'), '', $script_path); + + if ($script_path[0] !== '/') + { + $script_path = '/' . $script_path; + } + } + + // Check if data is sent + if ($this->io_handler->get_input('submit_server', false)) + { + $this->install_config->set('cookie_secure', $cookie_secure); + $this->install_config->set('server_protocol', $server_protocol); + $this->install_config->set('force_server_vars', $force_server_vars); + $this->install_config->set('server_name', $server_name); + $this->install_config->set('server_port', $server_port); + $this->install_config->set('script_path', $script_path); + } + else + { + // Render form + $server_form = array( + 'cookie_secure' => array( + 'label' => 'COOKIE_SECURE', + 'description' => 'COOKIE_SECURE_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => (!$cookie_secure), + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => ($cookie_secure), + ), + ), + ), + 'force_server_vars' => array( + 'label' => 'FORCE_SERVER_VARS', + 'description' => 'FORCE_SERVER_VARS_EXPLAIN', + 'type' => 'radio', + 'options' => array( + array( + 'value' => 0, + 'label' => 'NO', + 'selected' => true, + ), + array( + 'value' => 1, + 'label' => 'YES', + 'selected' => false, + ), + ), + ), + 'server_protocol' => array( + 'label' => 'SERVER_PROTOCOL', + 'description' => 'SERVER_PROTOCOL_EXPLAIN', + 'type' => 'text', + 'default' => $server_protocol, + ), + 'server_name' => array( + 'label' => 'SERVER_NAME', + 'description' => 'SERVER_NAME_EXPLAIN', + 'type' => 'text', + 'default' => $server_name, + ), + 'server_port' => array( + 'label' => 'SERVER_PORT', + 'description' => 'SERVER_PORT_EXPLAIN', + 'type' => 'text', + 'default' => $server_port, + ), + 'script_path' => array( + 'label' => 'SCRIPT_PATH', + 'description' => 'SCRIPT_PATH_EXPLAIN', + 'type' => 'text', + 'default' => $script_path, + ), + 'submit_server' => array( + 'label' => 'SUBMIT', + 'type' => 'submit', + ) + ); + + $this->io_handler->add_user_form_group('SERVER_CONFIG', $server_form); + + $this->io_handler->send_response(); + throw new user_interaction_required_exception(); + } + } +} diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php new file mode 100644 index 0000000000..aae8c75cbe --- /dev/null +++ b/phpBB/install/module/requirements/module.php @@ -0,0 +1,73 @@ + + * @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\requirements; + +use phpbb\install\exception\user_interaction_required_exception; + +class module extends \phpbb\install\module_base +{ + public function run() + { + $tests_passed = true; + + // Recover install progress + $task_index = 0; + + // Run until there are available resources + while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + { + // Check if task exists + if (!isset($this->task_collection[$task_index])) + { + break; + } + + // Recover task to be executed + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + + // Iterate to the next task + $task_index++; + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + continue; + } + + $test_result = $task->run(); + $tests_passed = ($tests_passed) ? $test_result : false; + } + + // Check if tests have failed + if (!$tests_passed) + { + // If requirements are not met, exit form installer + $this->iohandler->send_response(); + throw new user_interaction_required_exception(); + } + + // Log install progress + $current_task_index = $task_index - 1; + $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + } + + /** + * {@inheritdoc} + */ + public function get_task_count() + { + return 0; + } +} diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php new file mode 100644 index 0000000000..0314a988f1 --- /dev/null +++ b/phpBB/install/module/requirements/task/check_filesystem.php @@ -0,0 +1,258 @@ + + * @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\requirements\task; + +/** + * Checks filesystem requirements + */ +class check_filesystem extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var array + */ + protected $files_to_check; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem filesystem handler + * @parma \phpbb\install\helper\iohandler\iohandler_interface $response response helper + * @param string $phpbb_root_path relative path to phpBB's root + * @param string $php_ext extension of php files + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $response, + $phpbb_root_path, + $php_ext) + { + parent::__construct(true); + + $this->filesystem = $filesystem; + $this->response = $response; + $this->phpbb_root_path = $phpbb_root_path; + + $this->tests_passed = false; + + // Files/Directories to check + // All file/directory names must be relative to phpBB's root path + $this->files_to_check = array( + array( + 'path' => 'cache/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'store/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'files/', + 'failable' => false, + 'is_file' => false, + ), + array( + 'path' => 'images/avatars/upload/', + 'failable' => true, + 'is_file' => false, + ), + array( + 'path' => "config.$php_ext", + 'failable' => false, + 'is_file' => true, + ), + ); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->tests_passed = true; + + // Check files/directories to be writable + foreach ($this->files_to_check as $file) + { + if ($file['is_file']) + { + $this->check_file($file['path'], $file['failable']); + } + else + { + $this->check_dir($file['path'], $file['failable']); + } + } + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + * @return null + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if a file is readable and writable + * + * @param string $file Filename + * @param bool $failable Whether failing test should interrupt installation process + */ + protected function check_file($file, $failable = false) + { + $path = $this->phpbb_root_path . $file; + $exists = $writable = true; + + // Try to create file if it does not exists + if (!file_exists($path)) + { + $fp = @fopen($path, 'w'); + @fclose($fp); + try + { + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + $exists = true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + if (file_exists($path)) + { + if (!$this->filesystem->is_writable($path)) + { + $writable = false; + } + } + else + { + $exists = $writable = false; + } + + $this->set_test_passed(($exists && $writable) || $failable); + + if (!($exists && $writable)) + { + $title = ($exists) ? 'FILE_NOT_WRITABLE' : 'FILE_NOT_EXISTS'; + $description = array($title . '_EXPLAIN', $file); + + if ($failable) + { + $this->response->add_warning_message($title, $description); + } + else + { + $this->response->add_error_message($title, $description); + } + } + } + + /** + * Check if a directory is readable and writable + * + * @param string $dir Filename + * @param bool $failable Whether failing test should abort the installation process + */ + protected function check_dir($dir, $failable = false) + { + $path = $this->phpbb_root_path . $dir; + $exists = $writable = false; + + // Try to create the directory if it does not exist + if (!file_exists($path)) + { + try + { + $this->filesystem->mkdir($path, 0777); + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + $exists = true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + // Now really check + if (file_exists($path) && is_dir($path)) + { + try + { + $exists = true; + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + if ($this->filesystem->is_writable($path)) + { + $writable = true; + } + + $this->set_test_passed(($exists && $writable) || $failable); + + if (!($exists && $writable)) + { + $title = ($exists) ? 'DIRECTORY_NOT_WRITABLE' : 'DIRECTORY_NOT_EXISTS'; + $description = array($title . '_EXPLAIN', $dir); + + if ($failable) + { + $this->response->add_warning_message($title, $description); + } + else + { + $this->response->add_error_message($title, $description); + } + } + } +} diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/install/module/requirements/task/check_server_environment.php new file mode 100644 index 0000000000..797083d429 --- /dev/null +++ b/phpBB/install/module/requirements/task/check_server_environment.php @@ -0,0 +1,185 @@ + + * @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\requirements\task; + +/** + * Installer task that checks if the server meats phpBB requirements + */ +class check_server_environment extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response_helper; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $response + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\iohandler\iohandler_interface $response) + { + $this->database_helper = $database_helper; + $this->response_helper = $response; + $this->tests_passed = true; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // + // Check requirements + // The error messages should be set in the check_ functions + // + + // Check PHP version + $this->check_php_version(); + + // Check for getimagesize() + $this->check_image_size(); + + // Check for PCRE support + $this->check_pcre(); + + // Check for JSON support + $this->check_json(); + + // Check for dbms support + $this->check_available_dbms(); + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + * @return null + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if the requirements for PHP version is met + * + * @return null + */ + protected function check_php_version() + { + $php_version = PHP_VERSION; + + if (version_compare($php_version, '5.3.9') < 0) + { + $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP has getimagesize() available + * + * @return null + */ + protected function check_image_size() + { + if (!@function_exists('getimagesize')) + { + $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP supports PCRE + * + * @return null + */ + protected function check_pcre() + { + if (@preg_match('//u', '')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether PHP's JSON extension is available or not + * + * @return null + */ + protected function check_json() + { + if (@extension_loaded('json')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Check if any supported DBMS is available + * + * @return null + */ + protected function check_available_dbms() + { + $available_dbms = $this->database_helper->get_available_dbms(false, true); + + if ($available_dbms['ANY_DB_SUPPORT']) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN'); + + $this->set_test_passed(false); + } +} From 4df89d88486faa0c70473271c6ba757d5faab851 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 2 Jun 2015 20:41:26 +0200 Subject: [PATCH 07/75] [ticket/13740] Clean up docblocks PHPBB3-13740 --- phpBB/install/controller/install.php | 8 +++-- .../helper/iohandler/iohandler_base.php | 2 -- .../helper/iohandler/iohandler_interface.php | 31 ++++++++++++------- phpBB/install/installer.php | 2 -- .../obtain_data/task/obtain_admin_data.php | 4 --- .../obtain_data/task/obtain_board_data.php | 2 -- .../obtain_data/task/obtain_database_data.php | 4 --- .../requirements/task/check_filesystem.php | 1 - .../task/check_server_environment.php | 11 ------- phpBB/install/module_base.php | 2 -- 10 files changed, 25 insertions(+), 42 deletions(-) diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php index 1217107484..12bc575b83 100644 --- a/phpBB/install/controller/install.php +++ b/phpBB/install/controller/install.php @@ -62,6 +62,11 @@ class install $this->installer = $installer; } + /** + * Controller logic + * + * @return \Symfony\Component\HttpFoundation\Response|StreamedResponse + */ public function handle() { // @todo check that phpBB is not already installed @@ -82,8 +87,7 @@ class install if ($this->request->is_ajax()) { - $installer = &$this->installer; - + $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function() use ($installer) { $installer->run(); diff --git a/phpBB/install/helper/iohandler/iohandler_base.php b/phpBB/install/helper/iohandler/iohandler_base.php index 0d5467d202..c0e6921fb2 100644 --- a/phpBB/install/helper/iohandler/iohandler_base.php +++ b/phpBB/install/helper/iohandler/iohandler_base.php @@ -62,8 +62,6 @@ abstract class iohandler_base implements iohandler_interface * Set language service * * @param \phpbb\language\language $language - * - * @return null */ public function set_language(\phpbb\language\language $language) { diff --git a/phpBB/install/helper/iohandler/iohandler_interface.php b/phpBB/install/helper/iohandler/iohandler_interface.php index cea5610586..387a8617b9 100644 --- a/phpBB/install/helper/iohandler/iohandler_interface.php +++ b/phpBB/install/helper/iohandler/iohandler_interface.php @@ -74,8 +74,6 @@ interface iohandler_interface * @param string|array $error_title Title of the error message. * @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it), * or false if the error description is not available. - * - * @return null */ public function add_error_message($error_title, $error_description = false); @@ -85,11 +83,9 @@ interface iohandler_interface * Note: When an array is passed into the parameters below, it will be * resolved as printf($param[0], $param[1], ...). * - * @param string|array $warning_title Title of the error message - * @param string|bool|array $warning_description Description of the error (and possibly guidelines to resolve it), + * @param string|array $warning_title Title of the warning message + * @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it), * or false if the error description is not available - * - * @return null */ public function add_warning_message($warning_title, $warning_description = false); @@ -99,11 +95,9 @@ interface iohandler_interface * Note: When an array is passed into the parameters below, it will be * resolved as printf($param[0], $param[1], ...). * - * @param string|array $log_title Title of the error message - * @param string|bool|array $log_description Description of the error (and possibly guidelines to resolve it), + * @param string|array $log_title Title of the log message + * @param string|bool|array $log_description Description of the log (and possibly guidelines to resolve it), * or false if the error description is not available - * - * @return null */ public function add_log_message($log_title, $log_description = false); @@ -112,8 +106,21 @@ interface iohandler_interface * * @param string $title Language variable with the title of the form * @param array $form An array describing the required data (options etc) - * - * @return null */ public function add_user_form_group($title, $form); + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_count Number of tasks + */ + public function set_task_count($task_count); + + /** + * Sets the progress information + * + * @param string $task_lang_key Language key for the name of the task + * @param int $task_number Position of the current task in the task queue + */ + public function set_progress($task_lang_key, $task_number); } diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index 5a2fcc4d85..34bc4b23f7 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -60,8 +60,6 @@ class installer /** * Run phpBB installer - * - * @return null */ public function run() { diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/install/module/obtain_data/task/obtain_admin_data.php index d820353880..6745419eb2 100644 --- a/phpBB/install/module/obtain_data/task/obtain_admin_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php @@ -63,8 +63,6 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta /** * Process form data - * - * @return null */ protected function process_form() { @@ -93,8 +91,6 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta * * @param bool $use_request_data Whether to use submited data * - * @return null - * * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data */ protected function request_form_data($use_request_data = false) diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/install/module/obtain_data/task/obtain_board_data.php index e17ecd01c5..5415d152a7 100644 --- a/phpBB/install/module/obtain_data/task/obtain_board_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php @@ -71,8 +71,6 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta /** * Process form data - * - * @return null */ protected function process_form() { diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/install/module/obtain_data/task/obtain_database_data.php index 4c71c4adea..c8bdff4bf8 100644 --- a/phpBB/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php @@ -71,8 +71,6 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in /** * Process form data - * - * @return null */ protected function process_form() { @@ -110,8 +108,6 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in * * @param bool $use_request_data Whether to use submited data * - * @return null - * * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data */ protected function request_form_data($use_request_data = false) diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php index 0314a988f1..1c76ed146e 100644 --- a/phpBB/install/module/requirements/task/check_filesystem.php +++ b/phpBB/install/module/requirements/task/check_filesystem.php @@ -122,7 +122,6 @@ class check_filesystem extends \phpbb\install\task_base * Sets $this->tests_passed * * @param bool $is_passed - * @return null */ protected function set_test_passed($is_passed) { diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/install/module/requirements/task/check_server_environment.php index 797083d429..4bfea57b0e 100644 --- a/phpBB/install/module/requirements/task/check_server_environment.php +++ b/phpBB/install/module/requirements/task/check_server_environment.php @@ -81,7 +81,6 @@ class check_server_environment extends \phpbb\install\task_base * Sets $this->tests_passed * * @param bool $is_passed - * @return null */ protected function set_test_passed($is_passed) { @@ -91,8 +90,6 @@ class check_server_environment extends \phpbb\install\task_base /** * Check if the requirements for PHP version is met - * - * @return null */ protected function check_php_version() { @@ -111,8 +108,6 @@ class check_server_environment extends \phpbb\install\task_base /** * Checks if the installed PHP has getimagesize() available - * - * @return null */ protected function check_image_size() { @@ -129,8 +124,6 @@ class check_server_environment extends \phpbb\install\task_base /** * Checks if the installed PHP supports PCRE - * - * @return null */ protected function check_pcre() { @@ -147,8 +140,6 @@ class check_server_environment extends \phpbb\install\task_base /** * Checks whether PHP's JSON extension is available or not - * - * @return null */ protected function check_json() { @@ -165,8 +156,6 @@ class check_server_environment extends \phpbb\install\task_base /** * Check if any supported DBMS is available - * - * @return null */ protected function check_available_dbms() { diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index defccaefef..a34a103aca 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -63,8 +63,6 @@ abstract class module_base implements module_interface * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * @param \phpbb\install\helper\config $config * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler - * - * @return null */ public function setup(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\install\helper\config $config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler) { From 37b0134aa437e3e874464d3cf0d29c34a8da184a Mon Sep 17 00:00:00 2001 From: MateBartus Date: Tue, 2 Jun 2015 21:56:27 +0200 Subject: [PATCH 08/75] [ticket/13740] Add backend support for install progress tracking PHPBB3-13740 --- phpBB/install/controller/install.php | 6 ++ phpBB/install/helper/config.php | 62 +++++++++++++++---- .../helper/iohandler/iohandler_base.php | 39 ++++++++++++ phpBB/install/installer.php | 34 +++++++++- .../module/install_data/task/add_bots.php | 8 +++ .../install_data/task/add_languages.php | 8 +++ .../module/install_data/task/add_modules.php | 8 +++ .../task/add_config_settings.php | 8 +++ .../task/add_default_data.php | 8 +++ .../install_database/task/create_schema.php | 8 +++ .../task/create_config_file.php | 8 +++ .../install_finish/task/notify_user.php | 10 ++- .../task/populate_migrations.php | 8 +++ .../obtain_data/task/obtain_admin_data.php | 8 +++ .../obtain_data/task/obtain_board_data.php | 8 +++ .../obtain_data/task/obtain_database_data.php | 8 +++ .../obtain_data/task/obtain_email_data.php | 8 +++ .../obtain_data/task/obtain_imagick_path.php | 8 +++ .../obtain_data/task/obtain_server_data.php | 8 +++ .../requirements/task/check_filesystem.php | 8 +++ .../task/check_server_environment.php | 8 +++ phpBB/install/module_base.php | 17 +++-- phpBB/install/task_interface.php | 9 ++- phpBB/language/en/install.php | 23 +++++++ 24 files changed, 306 insertions(+), 22 deletions(-) diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php index 12bc575b83..4021c5625b 100644 --- a/phpBB/install/controller/install.php +++ b/phpBB/install/controller/install.php @@ -85,8 +85,14 @@ class install $this->iohandler_factory->set_environment('nojs'); } + // Set the appropriate input-output handler + //$this->installer->set_iohandler($this->iohandler_factory->get()); + if ($this->request->is_ajax()) { + // @todo: remove this line, and use the above + $this->installer->set_iohandler($this->iohandler_factory->get()); + $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function() use ($installer) { diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php index b759df737e..f39e92b622 100644 --- a/phpBB/install/helper/config.php +++ b/phpBB/install/helper/config.php @@ -81,6 +81,8 @@ class config 'last_task_module_name' => '', // Stores the service name of the latest finished module 'last_task_index' => 0, 'last_task_name' => '', // Stores the service name of the latest finished task + 'max_task_progress' => 0, + 'current_task_progress' => 0, ); $this->install_config_file = $this->phpbb_root_path . 'store/install_config.php'; @@ -108,8 +110,6 @@ class config * * @param string $param_name Name of the parameter * @param mixed $value Values to set the parameter - * - * @return null */ public function set($param_name, $value) { @@ -161,8 +161,6 @@ class config * * @param string $task_service_name Name of the installer task service * @param int $task_index Index of the task in the task list array - * - * @return null */ public function set_finished_task($task_service_name, $task_index) { @@ -175,8 +173,6 @@ class config * * @param string $module_service_name Name of the installer module service * @param int $module_index Index of the module in the module list array - * - * @return null */ public function set_active_module($module_service_name, $module_index) { @@ -196,8 +192,6 @@ class config /** * Recovers install configuration from file - * - * @return null */ public function load_config() { @@ -216,8 +210,6 @@ class config /** * Dumps install configuration to disk - * - * @return null */ public function save_config() { @@ -239,9 +231,55 @@ class config } /** - * Filling up system_data array + * Increments the task progress + */ + public function increment_current_task_progress() + { + $this->progress_data['current_task_progress']++; + } + + /** + * Sets the task progress to a specific number * - * @return null + * @param int $task_progress The task progress number to be set + */ + public function set_current_task_progress($task_progress) + { + $this->progress_data['current_task_progress'] = $task_progress; + } + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_progress_count Number of tasks + */ + public function set_task_progress_count($task_progress_count) + { + $this->progress_data['max_task_progress'] = $task_progress_count; + } + + /** + * Returns the number of the current task being executed + * + * @return int + */ + public function get_current_task_progress() + { + return $this->progress_data['current_task_progress']; + } + + /** + * Returns the number of tasks belonging to the installer in the current mode. + * + * @return int + */ + public function get_task_progress_count() + { + return $this->progress_data['max_task_progress']; + } + + /** + * Filling up system_data array */ protected function setup_system_data() { diff --git a/phpBB/install/helper/iohandler/iohandler_base.php b/phpBB/install/helper/iohandler/iohandler_base.php index c0e6921fb2..f767ecf4e9 100644 --- a/phpBB/install/helper/iohandler/iohandler_base.php +++ b/phpBB/install/helper/iohandler/iohandler_base.php @@ -48,6 +48,21 @@ abstract class iohandler_base implements iohandler_interface */ protected $language; + /** + * @var int + */ + protected $task_progress_count; + + /** + * @var int + */ + protected $current_task_progress; + + /** + * @var string + */ + protected $current_task_name; + /** * Constructor */ @@ -56,6 +71,10 @@ abstract class iohandler_base implements iohandler_interface $this->errors = array(); $this->warnings = array(); $this->logs = array(); + + $this->task_progress_count = 0; + $this->current_task_progress = 0; + $this->current_task_name = ''; } /** @@ -92,6 +111,26 @@ abstract class iohandler_base implements iohandler_interface $this->logs[] = $this->translate_message($log_title, $log_description); } + /** + * {@inheritdoc} + */ + public function set_task_count($task_count) + { + $this->task_progress_count = $task_count; + } + + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + if (!empty($task_lang_key)) + { + $this->current_task_name = $this->language->lang($task_lang_key); + $this->current_task_progress = $task_number; + } + } + /** * Localize message. * diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index 34bc4b23f7..4779bc43c4 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -30,6 +30,11 @@ class installer */ protected $installer_modules; + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + /** * Constructor * @@ -58,6 +63,16 @@ class installer $this->installer_modules = $modules; } + /** + * Sets input-output handler objects + * + * @param helper\iohandler\iohandler_interface $iohandler + */ + public function set_iohandler(\phpbb\install\helper\iohandler\iohandler_interface $iohandler) + { + $this->iohandler = $iohandler; + } + /** * Run phpBB installer */ @@ -69,6 +84,20 @@ class installer // Recover install progress $module_index = $this->recover_progress(); + // Count all tasks in the current installer modules + $task_count = 0; + foreach ($this->installer_modules as $name) + { + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($name); + + $task_count += $module->get_task_count(); + } + + // Set task count + $this->install_config->set_task_progress_count($task_count); + $this->iohandler->set_task_count($task_count); + $install_finished = false; try @@ -107,11 +136,12 @@ class installer if ($install_finished) { - die ("install finished"); + // Send install finished message + $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); } else { - die ("install memory or time limit reached"); + // @todo: Send refresh request } } catch (\phpbb\install\exception\user_interaction_required_exception $e) diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php index 8ce4ae765d..cba228bdba 100644 --- a/phpBB/install/module/install_data/task/add_bots.php +++ b/phpBB/install/module/install_data/task/add_bots.php @@ -221,4 +221,12 @@ class add_bots extends \phpbb\install\task_base $this->db->sql_query($sql); } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_BOTS'; + } } diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php index 9502a736f3..8418829ca6 100644 --- a/phpBB/install/module/install_data/task/add_languages.php +++ b/phpBB/install/module/install_data/task/add_languages.php @@ -102,4 +102,12 @@ class add_languages extends \phpbb\install\task_base $insert_buffer->flush(); } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_LANGUAGES'; + } } diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/install/module/install_data/task/add_modules.php index 98b52d7494..d47c2cd106 100644 --- a/phpBB/install/module/install_data/task/add_modules.php +++ b/phpBB/install/module/install_data/task/add_modules.php @@ -449,4 +449,12 @@ class add_modules extends \phpbb\install\task_base $this->module_manager->remove_cache_file($module_class); } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_MODULES'; + } } diff --git a/phpBB/install/module/install_database/task/add_config_settings.php b/phpBB/install/module/install_database/task/add_config_settings.php index 38dcef1d7a..be008da1d2 100644 --- a/phpBB/install/module/install_database/task/add_config_settings.php +++ b/phpBB/install/module/install_database/task/add_config_settings.php @@ -322,4 +322,12 @@ class add_config_settings extends \phpbb\install\task_base } } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_CONFIG_SETTINGS'; + } } diff --git a/phpBB/install/module/install_database/task/add_default_data.php b/phpBB/install/module/install_database/task/add_default_data.php index a5c2ffecd1..c6ca3b5c87 100644 --- a/phpBB/install/module/install_database/task/add_default_data.php +++ b/phpBB/install/module/install_database/task/add_default_data.php @@ -142,4 +142,12 @@ class add_default_data extends \phpbb\install\task_base return ''; } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_DEFAULT_DATA'; + } } diff --git a/phpBB/install/module/install_database/task/create_schema.php b/phpBB/install/module/install_database/task/create_schema.php index aac710d337..e17f0d08d9 100644 --- a/phpBB/install/module/install_database/task/create_schema.php +++ b/phpBB/install/module/install_database/task/create_schema.php @@ -195,4 +195,12 @@ class create_schema extends \phpbb\install\task_base ); } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_DATABASE_SCHEMA'; + } } diff --git a/phpBB/install/module/install_filesystem/task/create_config_file.php b/phpBB/install/module/install_filesystem/task/create_config_file.php index f1191f53d0..b0afa9a7fc 100644 --- a/phpBB/install/module/install_filesystem/task/create_config_file.php +++ b/phpBB/install/module/install_filesystem/task/create_config_file.php @@ -216,4 +216,12 @@ class create_config_file extends \phpbb\install\task_base return $config_content; } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_CONFIG_FILE'; + } } diff --git a/phpBB/install/module/install_finish/task/notify_user.php b/phpBB/install/module/install_finish/task/notify_user.php index d95303fcb5..c39e561c56 100644 --- a/phpBB/install/module/install_finish/task/notify_user.php +++ b/phpBB/install/module/install_finish/task/notify_user.php @@ -101,7 +101,7 @@ class notify_user extends \phpbb\install\task_base $messenger->anti_abuse_headers($this->config, $this->user); $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), - 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_pass1'))) + 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))) ); $messenger->send(NOTIFY_EMAIL); } @@ -110,4 +110,12 @@ class notify_user extends \phpbb\install\task_base @unlink($this->phpbb_root_path . 'cache/install_lock'); } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_NOTIFY_USER'; + } } diff --git a/phpBB/install/module/install_finish/task/populate_migrations.php b/phpBB/install/module/install_finish/task/populate_migrations.php index 4f701b84ca..1441351bf8 100644 --- a/phpBB/install/module/install_finish/task/populate_migrations.php +++ b/phpBB/install/module/install_finish/task/populate_migrations.php @@ -51,4 +51,12 @@ class populate_migrations extends \phpbb\install\task_base ->get_classes(); $this->migrator->populate_migrations($migrations); } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_POPULATE_MIGRATIONS'; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/install/module/obtain_data/task/obtain_admin_data.php index 6745419eb2..4b070aa19b 100644 --- a/phpBB/install/module/obtain_data/task/obtain_admin_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php @@ -200,4 +200,12 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta return $data_valid; } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/install/module/obtain_data/task/obtain_board_data.php index 5415d152a7..8a2507f073 100644 --- a/phpBB/install/module/obtain_data/task/obtain_board_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php @@ -167,4 +167,12 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta $this->io_handler->send_response(); throw new user_interaction_required_exception; } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/install/module/obtain_data/task/obtain_database_data.php index c8bdff4bf8..38a6dac0c2 100644 --- a/phpBB/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php @@ -252,4 +252,12 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in return $data_valid; } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_email_data.php b/phpBB/install/module/obtain_data/task/obtain_email_data.php index fbcef0a5c6..9a3edefd54 100644 --- a/phpBB/install/module/obtain_data/task/obtain_email_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_email_data.php @@ -148,4 +148,12 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta throw new user_interaction_required_exception(); } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php index 86af586e37..15570eac43 100644 --- a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php +++ b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php @@ -70,4 +70,12 @@ class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\ins $this->config->set('img_imagick', $img_imagick); } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/obtain_data/task/obtain_server_data.php b/phpBB/install/module/obtain_data/task/obtain_server_data.php index 39606f6281..3f5a1c769f 100644 --- a/phpBB/install/module/obtain_data/task/obtain_server_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_server_data.php @@ -184,4 +184,12 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst throw new user_interaction_required_exception(); } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php index 1c76ed146e..dea59d618e 100644 --- a/phpBB/install/module/requirements/task/check_filesystem.php +++ b/phpBB/install/module/requirements/task/check_filesystem.php @@ -254,4 +254,12 @@ class check_filesystem extends \phpbb\install\task_base } } } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/install/module/requirements/task/check_server_environment.php index 4bfea57b0e..f8dde51883 100644 --- a/phpBB/install/module/requirements/task/check_server_environment.php +++ b/phpBB/install/module/requirements/task/check_server_environment.php @@ -171,4 +171,12 @@ class check_server_environment extends \phpbb\install\task_base $this->set_test_passed(false); } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } } diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index a34a103aca..3629903747 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -110,8 +110,15 @@ abstract class module_base implements module_interface /** @var \phpbb\install\task_interface $task */ $task = $this->container->get($this->task_collection[$task_index]); + // Send progress information + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + // Iterate to the next task $task_index++; + $this->install_config->increment_current_task_progress(); // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) @@ -121,11 +128,11 @@ abstract class module_base implements module_interface $task->run(); - // Increment progress - if ($this->get_task_count() !== 0) - { - //$this->iohandler->increment_progress(); - } + // Send progress info + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); $this->iohandler->send_response(); diff --git a/phpBB/install/task_interface.php b/phpBB/install/task_interface.php index 9cfc4d19c2..6f0a01258f 100644 --- a/phpBB/install/task_interface.php +++ b/phpBB/install/task_interface.php @@ -40,8 +40,13 @@ interface task_interface /** * Executes the task - * - * @return null */ public function run(); + + /** + * Returns the language key of the name of the task + * + * @return string + */ + public function get_task_lang_name(); } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 59ad1b0d41..e3c4b859f0 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -226,3 +226,26 @@ $lang = array_merge($lang, array( 'MENU_LICENSE' => 'License', 'MENU_SUPPORT' => 'Support', )); + +// Task names +$lang = array_merge($lang, array( + // Install filesystem + 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', + + // Install database + 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', + 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', + 'TASK_CREATE_DATABASE_SCHEMA' => 'Creating database schema', + + // Install data + 'TASK_ADD_BOTS' => 'Registering bots', + 'TASK_ADD_LANGUAGES' => 'Installing available languages', + 'TASK_ADD_MODULES' => 'Installing modules', + + // Install finish tasks + 'TASK_NOTIFY_USER' => 'Sending notification e-mail', + 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', + + // Installer general progress messages + 'INSTALLER_FINISHED' => 'The installer has finished successfully', +)); From b7ef709549597f2fa4f9c8525bfd602f81644530 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Wed, 3 Jun 2015 01:31:48 +0200 Subject: [PATCH 09/75] [ticket/13740] Implement progress bar for AJAX UI PHPBB3-13740 --- phpBB/adm/style/admin.css | 27 ++++ phpBB/assets/javascript/installer.js | 135 +++++++++++++----- .../helper/iohandler/ajax_iohandler.php | 19 +++ 3 files changed, 146 insertions(+), 35 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index dd5878a976..ca5daf5bc5 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -2521,3 +2521,30 @@ fieldset.permissions .padding { clear: both; display: block; } + +#progress-bar { + position: relative; + width: 90%; + height: 25px; + margin: 20px auto; + border: 1px solid #cecece; +} + +#progress-bar #progress-bar-text { + position: absolute; + top: 0; + width: 100%; + text-align: center; + line-height: 25px; + font-weight: bold; +} + +#progress-bar #progress-bar-filler { + display: block; + position: relative; + top: 0; + left: 0; + background-color: #3c84ad; + width: 0; + height: 25px; +} diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 302d95e7c6..ea5ca638b8 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -3,9 +3,12 @@ */ (function($) { // Avoid conflicts with other libraries - // Global variables + // Installer variables var pollTimer = null; var nextReadPosition = 0; + var progressBarTriggered = false; + var progressTimer = null; + var currentProgress = 0; // Template related variables var $contentWrapper = $('.install-body').find('.main'); @@ -56,49 +59,112 @@ if (responseObject.hasOwnProperty('form')) { add_form(responseObject.form); } + + if (responseObject.hasOwnProperty('progress')) { + set_progress(responseObject.progress); + } } function add_message(type, messages) { // Get message containers - var errorContainer = $('#error-container'); - var warningContainer = $('#warning-container'); - var logContainer = $('#log-container'); + var $errorContainer = $('#error-container'); + var $warningContainer = $('#warning-container'); + var $logContainer = $('#log-container'); - var title, description, msgElement, arraySize = messages.length; + var $title, $description, $msgElement, arraySize = messages.length; for (var i = 0; i < arraySize; i++) { - msgElement = $('
'); - title = $(document.createElement('strong')); - title.text(messages[i].title); - msgElement.append(title); + $msgElement = $('
'); + $title = $(document.createElement('strong')); + $title.text(messages[i].title); + $msgElement.append($title); if (messages[i].hasOwnProperty('description')) { - description = $(document.createElement('p')); - description.text(messages[i].description); - msgElement.append(description); + $description = $(document.createElement('p')); + $description.text(messages[i].description); + $msgElement.append($description); } switch (type) { case 'error': - msgElement.addClass('errorbox'); - errorContainer.append(msgElement); + $msgElement.addClass('errorbox'); + $errorContainer.append($msgElement); break; case 'warning': - msgElement.addClass('warningbox'); - warningContainer.append(msgElement); + $msgElement.addClass('warningbox'); + $warningContainer.append($msgElement); break; case 'log': - msgElement.addClass('log'); - logContainer.append(msgElement); + $msgElement.addClass('log'); + $logContainer.append($msgElement); break; } } } function add_form(formHtml) { - var formContainer = $('#content-container'); - formContainer.html(formHtml); - var form = $('#install_install'); - intercept_form_submit(form); + var $formContainer = $('#content-container'); + $formContainer.html(formHtml); + var $form = $('#install_install'); + intercept_form_submit($form); + } + + function set_progress(progressObject) { + var $statusText, $progressBar, $progressText, $progressFiller; + + if (progressObject.task_name.length) { + if (!progressBarTriggered) { + // Create progress bar + var $contentContainer = $('#content-container'); + + // Create progress bar elements + $progressBar = $('
'); + $progressBar.attr('id', 'progress-bar'); + $progressText = $('

'); + $progressText.attr('id', 'progress-bar-text'); + $progressFiller = $(''); + $progressFiller.attr('id', 'progress-bar-filler'); + + $statusText = $('

'); + $statusText.attr('id', 'progress-status-text'); + + $progressBar.append($progressFiller); + $progressBar.append($progressText); + + $contentContainer.append($statusText); + $contentContainer.append($progressBar); + + progressBarTriggered = true; + } else { + $statusText = $('#progress-status-text'); + } + + // Update progress bar + $statusText.text(progressObject.task_name + '…'); + increment_progress_bar(Math.round(progressObject.task_num / progressObject.task_count * 100)); + } + } + + function increment_progress_bar(progressLimit) { + var $progressFiller = $('#progress-bar-filler'); + var $progressText = $('#progress-bar-text'); + var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; + currentProgress = Math.floor(progressStart); + + clearInterval(progressTimer); + progressTimer = setInterval(function() { + incrementFiller($progressText, $progressFiller, progressLimit); + }, 10); + } + + function incrementFiller($progressText, $progressFiller, progressLimit) { + currentProgress++; + $progressText.text(currentProgress + '%'); + $progressFiller.css('width', currentProgress + '%'); + + if (currentProgress >= progressLimit || currentProgress >= 100) { + console.log("In if; " + progressLimit + "; " + currentProgress); + clearInterval(progressTimer); + } } function start_polling(xhReq) { @@ -113,14 +179,14 @@ nextReadPosition = 0; } - function submit_form(form, submitBtn) { - form.css('display', 'none'); + function submit_form($form, $submitBtn) { + $form.css('display', 'none'); var xhReq = create_xhr_object(); - xhReq.open('POST', form.attr('action'), true); + xhReq.open('POST', $form.attr('action'), true); xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhReq.send(get_form_fields(form, submitBtn)); + xhReq.send(get_form_fields($form, $submitBtn)); // Clear content setup_ajax_layout(); @@ -130,23 +196,22 @@ } // Workaround for submit buttons - function get_form_fields(form, submitBtn) { - var formData = form.serialize(); - //var submitBtn = form.find(':submit'); - formData += ((formData.length) ? '&' : '') + encodeURIComponent(submitBtn.attr('name')) + '='; - formData += encodeURIComponent(submitBtn.attr('value')); + function get_form_fields($form, $submitBtn) { + var formData = $form.serialize(); + formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; + formData += encodeURIComponent($submitBtn.attr('value')); return formData; } - function intercept_form_submit(form) { - if (!form.length) { + function intercept_form_submit($form) { + if (!$form.length) { return; } - form.find(':submit').bind('click', function (event) { + $form.find(':submit').bind('click', function (event) { event.preventDefault(); - submit_form(form, $(this)); + submit_form($form, $(this)); }); } diff --git a/phpBB/install/helper/iohandler/ajax_iohandler.php b/phpBB/install/helper/iohandler/ajax_iohandler.php index 44a185139e..960dd615b5 100644 --- a/phpBB/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/install/helper/iohandler/ajax_iohandler.php @@ -177,6 +177,16 @@ class ajax_iohandler extends iohandler_base $this->form = ''; } + // If current task name is set, we push progress message to the client side + if (!empty($this->current_task_name)) + { + $json_array['progress'] = array( + 'task_name' => $this->current_task_name, + 'task_num' => $this->current_task_progress, + 'task_count' => $this->task_progress_count, + ); + } + $this->errors = array(); $this->warnings = array(); $this->logs = array(); @@ -184,6 +194,15 @@ class ajax_iohandler extends iohandler_base return $json_array; } + /** + * {@inheritdoc} + */ + public function set_progress($task_lang_key, $task_number) + { + parent::set_progress($task_lang_key, $task_number); + $this->send_response(); + } + /** * Callback function for language replacing * From 63c3500dacc8d272e85273a67f56faa51a9d5fba Mon Sep 17 00:00:00 2001 From: MateBartus Date: Wed, 3 Jun 2015 16:35:23 +0200 Subject: [PATCH 10/75] [ticket/13740] Clean up JS code some more PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 309 ++++++++++++++++----------- 1 file changed, 188 insertions(+), 121 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index ea5ca638b8..8afac0da78 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -3,6 +3,9 @@ */ (function($) { // Avoid conflicts with other libraries + + 'use strict'; + // Installer variables var pollTimer = null; var nextReadPosition = 0; @@ -14,58 +17,37 @@ var $contentWrapper = $('.install-body').find('.main'); // Intercept form submits - intercept_form_submit($('#install_install')); + interceptFormSubmit($('#install_install')); - function poll_content(xhReq) { - var messages = xhReq.responseText; + /** + * Creates an XHR object + * + * jQuery cannot be used as the response is streamed, and + * as of now, jQuery does not provide access to the response until + * the connection is not closed. + * + * @return XMLHttpRequest|ActiveXObject + */ + function createXhrObject() { + var xhReq; - do { - var unprocessed = messages.substring(nextReadPosition); - var messageEndIndex = unprocessed.indexOf('}\n\n'); - - if (messageEndIndex !== -1) { - var endOfMessageIndex = messageEndIndex + 3; // 3 is the length of "}\n\n" - var message = unprocessed.substring(0, endOfMessageIndex); - parse_message(message); - nextReadPosition += endOfMessageIndex; - } - } while (messageEndIndex !== -1); - - if (xhReq.readyState === 4) { - $('#loading_indicator').css('display', 'none'); - reset_polling(); + if (window.XMLHttpRequest) { + xhReq = new XMLHttpRequest(); } + else if (window.ActiveXObject) { + xhReq = new ActiveXObject("Msxml2.XMLHTTP"); + } + + return xhReq; } - function parse_message(messageJSON) { - $('#loading_indicator').css('display', 'none'); - - messageJSON = messageJSON.trim(); - var responseObject = JSON.parse(messageJSON); - - // Parse object - if (responseObject.hasOwnProperty('errors')) { - add_message('error', responseObject.errors) - } - - if (responseObject.hasOwnProperty('warnings')) { - add_message('warning', responseObject.warnings) - } - - if (responseObject.hasOwnProperty('logs')) { - add_message('log', responseObject.logs); - } - - if (responseObject.hasOwnProperty('form')) { - add_form(responseObject.form); - } - - if (responseObject.hasOwnProperty('progress')) { - set_progress(responseObject.progress); - } - } - - function add_message(type, messages) { + /** + * Displays error, warning and log messages + * + * @param type + * @param messages + */ + function addMessage(type, messages) { // Get message containers var $errorContainer = $('#error-container'); var $warningContainer = $('#warning-container'); @@ -101,14 +83,24 @@ } } - function add_form(formHtml) { + /** + * Displays a form from the response + * + * @param formHtml + */ + function addForm(formHtml) { var $formContainer = $('#content-container'); $formContainer.html(formHtml); var $form = $('#install_install'); - intercept_form_submit($form); + interceptFormSubmit($form); } - function set_progress(progressObject) { + /** + * Renders progress bar + * + * @param progressObject + */ + function setProgress(progressObject) { var $statusText, $progressBar, $progressText, $progressFiller; if (progressObject.task_name.length) { @@ -140,11 +132,93 @@ // Update progress bar $statusText.text(progressObject.task_name + '…'); - increment_progress_bar(Math.round(progressObject.task_num / progressObject.task_count * 100)); + incrementProgressBar(Math.round(progressObject.task_num / progressObject.task_count * 100)); } } - function increment_progress_bar(progressLimit) { + /** + * Parse messages from the response object + * + * @param messageJSON + */ + function parseMessage(messageJSON) { + $('#loading_indicator').css('display', 'none'); + + var responseObject = JSON.parse(messageJSON); + + // Parse object + if (responseObject.hasOwnProperty('errors')) { + addMessage('error', responseObject.errors); + } + + if (responseObject.hasOwnProperty('warnings')) { + addMessage('warning', responseObject.warnings); + } + + if (responseObject.hasOwnProperty('logs')) { + addMessage('log', responseObject.logs); + } + + if (responseObject.hasOwnProperty('form')) { + addForm(responseObject.form); + } + + if (responseObject.hasOwnProperty('progress')) { + setProgress(responseObject.progress); + } + } + + /** + * Process updates in streamed response + * + * @param xhReq XHR object + */ + function pollContent(xhReq) { + var messages = xhReq.responseText; + var msgSeparator = '}\n\n'; + var unprocessed, messageEndIndex, endOfMessageIndex, message; + + do { + unprocessed = messages.substring(nextReadPosition); + messageEndIndex = unprocessed.indexOf(msgSeparator); + + if (messageEndIndex !== -1) { + endOfMessageIndex = messageEndIndex + msgSeparator.length; + message = unprocessed.substring(0, endOfMessageIndex); + parseMessage(message); + nextReadPosition += endOfMessageIndex; + } + } while (messageEndIndex !== -1); + + if (xhReq.readyState === 4) { + $('#loading_indicator').css('display', 'none'); + resetPolling(); + } + } + + /** + * Animates the progress bar + * + * @param $progressText + * @param $progressFiller + * @param progressLimit + */ + function incrementFiller($progressText, $progressFiller, progressLimit) { + currentProgress++; + $progressText.text(currentProgress + '%'); + $progressFiller.css('width', currentProgress + '%'); + + if (currentProgress >= progressLimit || currentProgress >= 100) { + clearInterval(progressTimer); + } + } + + /** + * Wrapper function for progress bar rendering and animating + * + * @param progressLimit + */ + function incrementProgressBar(progressLimit) { var $progressFiller = $('#progress-bar-filler'); var $progressText = $('#progress-bar-text'); var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; @@ -156,85 +230,30 @@ }, 10); } - function incrementFiller($progressText, $progressFiller, progressLimit) { - currentProgress++; - $progressText.text(currentProgress + '%'); - $progressFiller.css('width', currentProgress + '%'); - - if (currentProgress >= progressLimit || currentProgress >= 100) { - console.log("In if; " + progressLimit + "; " + currentProgress); - clearInterval(progressTimer); - } - } - - function start_polling(xhReq) { - reset_polling(); + /** + * Sets up timer for processing the streamed HTTP response + * + * @param xhReq + */ + function startPolling(xhReq) { + resetPolling(); pollTimer = setInterval(function () { - poll_content(xhReq); + pollContent(xhReq); }, 500); } - function reset_polling() { + /** + * Resets the polling timer + */ + function resetPolling() { clearInterval(pollTimer); nextReadPosition = 0; } - function submit_form($form, $submitBtn) { - $form.css('display', 'none'); - - var xhReq = create_xhr_object(); - xhReq.open('POST', $form.attr('action'), true); - xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhReq.send(get_form_fields($form, $submitBtn)); - - // Clear content - setup_ajax_layout(); - $('#loading_indicator').css('display', 'block'); - - start_polling(xhReq); - } - - // Workaround for submit buttons - function get_form_fields($form, $submitBtn) { - var formData = $form.serialize(); - formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; - formData += encodeURIComponent($submitBtn.attr('value')); - - return formData; - } - - function intercept_form_submit($form) { - if (!$form.length) { - return; - } - - $form.find(':submit').bind('click', function (event) { - event.preventDefault(); - submit_form($form, $(this)); - }); - - } - /** - * jQuery cannot be used as the response is streamed, and - * as of now, jQuery does not provide access to the response until - * the connection is not closed. + * Renders the AJAX UI layout */ - function create_xhr_object() { - var xhReq; - - if (window.XMLHttpRequest) { - xhReq = new XMLHttpRequest(); - } - else if (window.ActiveXObject) { - xhReq = new ActiveXObject("Msxml2.XMLHTTP"); - } - - return xhReq; - } - - function setup_ajax_layout() { + function setupAjaxLayout() { // Clear content $contentWrapper.html(''); @@ -267,4 +286,52 @@ $spinner.html(' '); $contentWrapper.append($spinner); } + + function submitForm($form, $submitBtn) { + $form.css('display', 'none'); + + var xhReq = createXhrObject(); + xhReq.open('POST', $form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhReq.send(getFormFields($form, $submitBtn)); + + // Clear content + setupAjaxLayout(); + $('#loading_indicator').css('display', 'block'); + + startPolling(xhReq); + } + + /** + * Add submit button to the POST information + * + * @param $form + * @param $submitBtn + * + * @returns {*} + */ + function getFormFields($form, $submitBtn) { + var formData = $form.serialize(); + formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; + formData += encodeURIComponent($submitBtn.attr('value')); + + return formData; + } + + /** + * Intercept form submit events and determine the submit button used + * + * @param $form + */ + function interceptFormSubmit($form) { + if (!$form.length) { + return; + } + + $form.find(':submit').bind('click', function (event) { + event.preventDefault(); + submitForm($form, $(this)); + }); + } })(jQuery); // Avoid conflicts with other libraries From 0dc6029bfed10fac1a09a4fd8de7d1b31407693a Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 4 Jun 2015 00:43:08 +0200 Subject: [PATCH 11/75] [ticket/13740] Tasks can appear as multiple steps for the progress bar PHPBB3-13740 --- .../container/services_install_filesystem.yml | 4 ++-- .../container/services_install_finish.yml | 6 ++--- .../services_install_obtain_data.yml | 14 +++++------ .../services_install_requirements.yml | 6 ++--- phpBB/install/installer.php | 2 +- .../module/install_data/task/add_bots.php | 8 +++++++ .../install_data/task/add_languages.php | 8 +++++++ .../module/install_data/task/add_modules.php | 8 +++++++ .../task/add_config_settings.php | 8 +++++++ .../task/add_default_data.php | 8 +++++++ .../install_database/task/create_schema.php | 8 +++++++ .../task/create_config_file.php | 8 +++++++ .../install_finish/task/notify_user.php | 8 +++++++ .../task/populate_migrations.php | 8 +++++++ phpBB/install/module/obtain_data/module.php | 2 +- .../obtain_data/task/obtain_admin_data.php | 8 +++++++ .../obtain_data/task/obtain_board_data.php | 8 +++++++ .../obtain_data/task/obtain_database_data.php | 8 +++++++ .../obtain_data/task/obtain_email_data.php | 8 +++++++ .../obtain_data/task/obtain_imagick_path.php | 8 +++++++ .../obtain_data/task/obtain_server_data.php | 8 +++++++ phpBB/install/module/requirements/module.php | 2 +- .../requirements/task/check_filesystem.php | 8 +++++++ .../task/check_server_environment.php | 8 +++++++ phpBB/install/module_base.php | 24 +++++++++++++++++-- phpBB/install/module_interface.php | 2 +- phpBB/install/task_interface.php | 13 ++++++++++ 27 files changed, 190 insertions(+), 21 deletions(-) diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index 24497d330a..077b1ccb98 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -1,5 +1,5 @@ services: - installer.filesystem.create_config: + installer.install_filesystem.create_config_file: class: phpbb\install\module\install_filesystem\task\create_config_file arguments: - @filesystem @@ -13,4 +13,4 @@ services: class: phpbb\install\module\install_filesystem\module parent: installer.module_base arguments: - - ["installer.filesystem.create_config"] + - ["installer.install_filesystem.create_config_file"] diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index 20cd60983b..d2002f9fd7 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -1,10 +1,10 @@ services: - installer.finish.populate_migrations: + installer.install_finish.populate_migrations: class: phpbb\install\module\install_finish\task\populate_migrations arguments: - @installer.helper.container_factory - installer.finish.notify_user: + installer.install_finish.notify_user: class: phpbb\install\module\install_finish\task\notify_user arguments: - @installer.helper.container_factory @@ -17,4 +17,4 @@ services: class: phpbb\install\module\install_filesystem\module parent: installer.module_base arguments: - - ["installer.finish.populate_migrations", "installer.finish.notify_user"] + - ["installer.install_finish.populate_migrations", "installer.install_finish.notify_user"] diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index 2800392c58..2cfe210309 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -1,36 +1,36 @@ services: - installer.obtain_data.admin: + installer.obtain_data.obtain_admin_data: class: phpbb\install\module\obtain_data\task\obtain_admin_data arguments: - @installer.helper.config - @installer.helper.iohandler - installer.obtain_data.board: + installer.obtain_data.obtain_board_data: class: phpbb\install\module\obtain_data\task\obtain_board_data arguments: - @installer.helper.config - @installer.helper.iohandler - @language.helper.language_file - installer.obtain_data.database: + installer.obtain_data.obtain_database_data: class: phpbb\install\module\obtain_data\task\obtain_database_data arguments: - @installer.helper.database - @installer.helper.config - @installer.helper.iohandler - installer.obtain_data.email: + installer.obtain_data.obtain_email_data: class: phpbb\install\module\obtain_data\task\obtain_email_data arguments: - @installer.helper.config - @installer.helper.iohandler - installer.obtain_data.imagick: + installer.obtain_data.obtain_imagick_path: class: phpbb\install\module\obtain_data\task\obtain_imagick_path arguments: - @installer.helper.config - installer.obtain_data.server: + installer.obtain_data.obtain_server_data: class: phpbb\install\module\obtain_data\task\obtain_server_data arguments: - @installer.helper.config @@ -40,4 +40,4 @@ services: class: phpbb\install\module\obtain_data\module parent: installer.module_base arguments: - - ["installer.obtain_data.admin", "installer.obtain_data.database", "installer.obtain_data.server", "installer.obtain_data.email", "installer.obtain_data.board", "installer.obtain_data.imagick"] + - ["installer.obtain_data.obtain_admin_data", "installer.obtain_data.obtain_database_data", "installer.obtain_data.obtain_server_data", "installer.obtain_data.obtain_email_data", "installer.obtain_data.obtain_board_data", "installer.obtain_data.obtain_imagick_path"] diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index afbe341c06..89c517c0cd 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -1,5 +1,5 @@ services: - installer.requirements.task.filesystem: + installer.requirements.check_filesystem: class: phpbb\install\module\requirements\task\check_filesystem arguments: - @filesystem @@ -7,7 +7,7 @@ services: - %core.root_path% - %core.php_ext% - installer.requirements.task.server: + installer.requirements.check_server_environment: class: phpbb\install\module\requirements\task\check_server_environment arguments: - @installer.helper.database @@ -17,4 +17,4 @@ services: class: phpbb\install\module\requirements\module parent: installer.module_base arguments: - - ["installer.requirements.task.filesystem", "installer.requirements.task.server"] + - ["installer.requirements.check_filesystem", "installer.requirements.check_server_environment"] diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index 4779bc43c4..cb3dacfbe0 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -91,7 +91,7 @@ class installer /** @var \phpbb\install\module_interface $module */ $module = $this->container->get($name); - $task_count += $module->get_task_count(); + $task_count += $module->get_step_count(); } // Set task count diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php index cba228bdba..c31700e97f 100644 --- a/phpBB/install/module/install_data/task/add_bots.php +++ b/phpBB/install/module/install_data/task/add_bots.php @@ -222,6 +222,14 @@ class add_bots extends \phpbb\install\task_base } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php index 8418829ca6..7ffdf4f276 100644 --- a/phpBB/install/module/install_data/task/add_languages.php +++ b/phpBB/install/module/install_data/task/add_languages.php @@ -103,6 +103,14 @@ class add_languages extends \phpbb\install\task_base $insert_buffer->flush(); } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/install/module/install_data/task/add_modules.php index d47c2cd106..6a77f8973b 100644 --- a/phpBB/install/module/install_data/task/add_modules.php +++ b/phpBB/install/module/install_data/task/add_modules.php @@ -450,6 +450,14 @@ class add_modules extends \phpbb\install\task_base } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_database/task/add_config_settings.php b/phpBB/install/module/install_database/task/add_config_settings.php index be008da1d2..25da36e01d 100644 --- a/phpBB/install/module/install_database/task/add_config_settings.php +++ b/phpBB/install/module/install_database/task/add_config_settings.php @@ -323,6 +323,14 @@ class add_config_settings extends \phpbb\install\task_base } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_database/task/add_default_data.php b/phpBB/install/module/install_database/task/add_default_data.php index c6ca3b5c87..5dbfbb4478 100644 --- a/phpBB/install/module/install_database/task/add_default_data.php +++ b/phpBB/install/module/install_database/task/add_default_data.php @@ -143,6 +143,14 @@ class add_default_data extends \phpbb\install\task_base return ''; } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_database/task/create_schema.php b/phpBB/install/module/install_database/task/create_schema.php index e17f0d08d9..7cc521eee8 100644 --- a/phpBB/install/module/install_database/task/create_schema.php +++ b/phpBB/install/module/install_database/task/create_schema.php @@ -196,6 +196,14 @@ class create_schema extends \phpbb\install\task_base } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_filesystem/task/create_config_file.php b/phpBB/install/module/install_filesystem/task/create_config_file.php index b0afa9a7fc..337d401216 100644 --- a/phpBB/install/module/install_filesystem/task/create_config_file.php +++ b/phpBB/install/module/install_filesystem/task/create_config_file.php @@ -217,6 +217,14 @@ class create_config_file extends \phpbb\install\task_base return $config_content; } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_finish/task/notify_user.php b/phpBB/install/module/install_finish/task/notify_user.php index c39e561c56..4ab6ec56c6 100644 --- a/phpBB/install/module/install_finish/task/notify_user.php +++ b/phpBB/install/module/install_finish/task/notify_user.php @@ -111,6 +111,14 @@ class notify_user extends \phpbb\install\task_base @unlink($this->phpbb_root_path . 'cache/install_lock'); } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/install_finish/task/populate_migrations.php b/phpBB/install/module/install_finish/task/populate_migrations.php index 1441351bf8..b2a4800f86 100644 --- a/phpBB/install/module/install_finish/task/populate_migrations.php +++ b/phpBB/install/module/install_finish/task/populate_migrations.php @@ -52,6 +52,14 @@ class populate_migrations extends \phpbb\install\task_base $this->migrator->populate_migrations($migrations); } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php index 9a3307cd6f..d846593315 100644 --- a/phpBB/install/module/obtain_data/module.php +++ b/phpBB/install/module/obtain_data/module.php @@ -56,7 +56,7 @@ class module extends \phpbb\install\module_base /** * {@inheritdoc} */ - public function get_task_count() + public function get_step_count() { return 0; } diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/install/module/obtain_data/task/obtain_admin_data.php index 4b070aa19b..b2250e524b 100644 --- a/phpBB/install/module/obtain_data/task/obtain_admin_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_admin_data.php @@ -201,6 +201,14 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta return $data_valid; } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/install/module/obtain_data/task/obtain_board_data.php index 8a2507f073..821c221123 100644 --- a/phpBB/install/module/obtain_data/task/obtain_board_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_board_data.php @@ -168,6 +168,14 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta throw new user_interaction_required_exception; } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/install/module/obtain_data/task/obtain_database_data.php index 38a6dac0c2..0c1146d9f5 100644 --- a/phpBB/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_database_data.php @@ -253,6 +253,14 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in return $data_valid; } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/task/obtain_email_data.php b/phpBB/install/module/obtain_data/task/obtain_email_data.php index 9a3edefd54..ae7526a9e3 100644 --- a/phpBB/install/module/obtain_data/task/obtain_email_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_email_data.php @@ -149,6 +149,14 @@ class obtain_email_data extends \phpbb\install\task_base implements \phpbb\insta } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php index 15570eac43..9f74b61770 100644 --- a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php +++ b/phpBB/install/module/obtain_data/task/obtain_imagick_path.php @@ -71,6 +71,14 @@ class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\ins $this->config->set('img_imagick', $img_imagick); } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/obtain_data/task/obtain_server_data.php b/phpBB/install/module/obtain_data/task/obtain_server_data.php index 3f5a1c769f..2d1e37b10e 100644 --- a/phpBB/install/module/obtain_data/task/obtain_server_data.php +++ b/phpBB/install/module/obtain_data/task/obtain_server_data.php @@ -185,6 +185,14 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php index aae8c75cbe..f3d1cc71ec 100644 --- a/phpBB/install/module/requirements/module.php +++ b/phpBB/install/module/requirements/module.php @@ -66,7 +66,7 @@ class module extends \phpbb\install\module_base /** * {@inheritdoc} */ - public function get_task_count() + public function get_step_count() { return 0; } diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/install/module/requirements/task/check_filesystem.php index dea59d618e..5b944b8415 100644 --- a/phpBB/install/module/requirements/task/check_filesystem.php +++ b/phpBB/install/module/requirements/task/check_filesystem.php @@ -255,6 +255,14 @@ class check_filesystem extends \phpbb\install\task_base } } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/install/module/requirements/task/check_server_environment.php index f8dde51883..50efdc55a2 100644 --- a/phpBB/install/module/requirements/task/check_server_environment.php +++ b/phpBB/install/module/requirements/task/check_server_environment.php @@ -172,6 +172,14 @@ class check_server_environment extends \phpbb\install\task_base $this->set_test_passed(false); } + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index 3629903747..179884c039 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -173,8 +173,28 @@ abstract class module_base implements module_interface /** * {@inheritdoc} */ - public function get_task_count() + public function get_step_count() { - return sizeof($this->task_collection); + $step_count = 0; + + foreach ($this->task_collection as $task_service_name) + { + $task_service_name_parts = explode('.', $task_service_name); + + if ($task_service_name_parts[0] !== 'installer') + { + // @todo throw an exception + } + + $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; + if (!class_exists($class_name)) + { + // @todo throw an exception + } + + $step_count += $class_name::get_step_count(); + } + + return $step_count; } } diff --git a/phpBB/install/module_interface.php b/phpBB/install/module_interface.php index e0ec4e4347..29918f0c34 100644 --- a/phpBB/install/module_interface.php +++ b/phpBB/install/module_interface.php @@ -52,5 +52,5 @@ interface module_interface * * @return int */ - public function get_task_count(); + public function get_step_count(); } diff --git a/phpBB/install/task_interface.php b/phpBB/install/task_interface.php index 6f0a01258f..14cde23a56 100644 --- a/phpBB/install/task_interface.php +++ b/phpBB/install/task_interface.php @@ -15,9 +15,22 @@ namespace phpbb\install; /** * Interface for installer tasks + * + * Note: The task service ID must match up with the namespace and class name. + * For example: if your task is located at \phpbb\install\module\module_name\task\task_name + * then the service ID must be installer.module_name.task_name. */ interface task_interface { + /** + * Returns the number of steps the task contains + * + * This is a helper method to provide a better progress bar for the front-end. + * + * @return int The number of steps that the task contains + */ + static public function get_step_count(); + /** * Checks if the task is essential to install phpBB or it can be skipped * From 1b81bf5b2370c045a6369705d2a11a2b35fe2281 Mon Sep 17 00:00:00 2001 From: CHItA Date: Fri, 5 Jun 2015 17:43:30 +0200 Subject: [PATCH 12/75] [ticket/13740] Add better progress handling, also add log messages PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 9 +- .../services_install_obtain_data.yml | 2 + .../services_install_requirements.yml | 2 + .../invalid_service_name_exception.php | 69 +++++++++ .../exception/module_not_found_exception.php | 42 ++++++ .../exception/task_not_found_exception.php | 42 ++++++ phpBB/install/helper/config.php | 11 +- phpBB/install/installer.php | 134 ++++++++++++++---- phpBB/install/module/obtain_data/module.php | 38 ----- phpBB/install/module/requirements/module.php | 11 +- phpBB/install/module_base.php | 126 +++++++++++----- phpBB/language/en/install.php | 15 ++ 12 files changed, 393 insertions(+), 108 deletions(-) create mode 100644 phpBB/install/exception/invalid_service_name_exception.php create mode 100644 phpBB/install/exception/module_not_found_exception.php create mode 100644 phpBB/install/exception/task_not_found_exception.php diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 8afac0da78..a9a315c0d5 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -204,13 +204,14 @@ * @param progressLimit */ function incrementFiller($progressText, $progressFiller, progressLimit) { + if (currentProgress >= progressLimit || currentProgress >= 100) { + clearInterval(progressTimer); + return; + } + currentProgress++; $progressText.text(currentProgress + '%'); $progressFiller.css('width', currentProgress + '%'); - - if (currentProgress >= progressLimit || currentProgress >= 100) { - clearInterval(progressTimer); - } } /** diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index 2cfe210309..ecbd3d6d37 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -41,3 +41,5 @@ services: parent: installer.module_base arguments: - ["installer.obtain_data.obtain_admin_data", "installer.obtain_data.obtain_database_data", "installer.obtain_data.obtain_server_data", "installer.obtain_data.obtain_email_data", "installer.obtain_data.obtain_board_data", "installer.obtain_data.obtain_imagick_path"] + - true + - false diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index 89c517c0cd..b1f38713e4 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -18,3 +18,5 @@ services: parent: installer.module_base arguments: - ["installer.requirements.check_filesystem", "installer.requirements.check_server_environment"] + - true + - false diff --git a/phpBB/install/exception/invalid_service_name_exception.php b/phpBB/install/exception/invalid_service_name_exception.php new file mode 100644 index 0000000000..e64cd2026f --- /dev/null +++ b/phpBB/install/exception/invalid_service_name_exception.php @@ -0,0 +1,69 @@ + + * @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\exception; + +class invalid_service_name_exception extends installer_exception +{ + /** + * @var string + */ + private $params; + + /** + * @var string + */ + private $error; + + /** + * Constructor + * + * @param string $error The name of the missing installer module + * @param array $params Additional values for message translation + */ + public function __construct($error, $params = array()) + { + $this->error = $error; + $this->params = $params; + } + + /** + * Returns the language entry's name for the error + * + * @return string + */ + public function get_error() + { + return $this->error; + } + + /** + * Returns parameters for the language entry, if there is any + * + * @return array + */ + public function get_params() + { + return $this->params; + } + + /** + * Returns true, if there are any parameters set + * + * @return bool + */ + public function has_params() + { + return (sizeof($this->params) !== 0); + } +} diff --git a/phpBB/install/exception/module_not_found_exception.php b/phpBB/install/exception/module_not_found_exception.php new file mode 100644 index 0000000000..9fa03fad6e --- /dev/null +++ b/phpBB/install/exception/module_not_found_exception.php @@ -0,0 +1,42 @@ + + * @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\exception; + +class module_not_found_exception extends installer_exception +{ + /** + * @var string + */ + private $module_service_name; + + /** + * Constructor + * + * @param string $module_service_name The name of the missing installer module + */ + public function __construct($module_service_name) + { + $this->module_service_name = $module_service_name; + } + + /** + * Returns the missing installer module's service name + * + * @return string + */ + public function get_module_service_name() + { + return $this->module_service_name; + } +} diff --git a/phpBB/install/exception/task_not_found_exception.php b/phpBB/install/exception/task_not_found_exception.php new file mode 100644 index 0000000000..11486cc6b0 --- /dev/null +++ b/phpBB/install/exception/task_not_found_exception.php @@ -0,0 +1,42 @@ + + * @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\exception; + +class task_not_found_exception extends installer_exception +{ + /** + * @var string + */ + private $task_service_name; + + /** + * Constructor + * + * @param string $task_service_name The name of the missing installer module + */ + public function __construct($task_service_name) + { + $this->task_service_name = $task_service_name; + } + + /** + * Returns the missing installer task's service name + * + * @return string + */ + public function get_task_service_name() + { + return $this->task_service_name; + } +} diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php index f39e92b622..0c04b5e950 100644 --- a/phpBB/install/helper/config.php +++ b/phpBB/install/helper/config.php @@ -232,10 +232,17 @@ class config /** * Increments the task progress + * + * @param int $increment_by The amount to increment by */ - public function increment_current_task_progress() + public function increment_current_task_progress($increment_by = 1) { - $this->progress_data['current_task_progress']++; + $this->progress_data['current_task_progress'] += $increment_by; + + if ($this->progress_data['current_task_progress'] > $this->progress_data['max_task_progress']) + { + $this->progress_data['current_task_progress'] = $this->progress_data['max_task_progress']; + } } /** diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index cb3dacfbe0..1c7c9c8a92 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -13,15 +13,24 @@ namespace phpbb\install; +use phpbb\install\exception\invalid_service_name_exception; +use phpbb\install\exception\module_not_found_exception; +use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\user_interaction_required_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; + class installer { /** - * @var \Symfony\Component\DependencyInjection\ContainerInterface + * @var ContainerInterface */ protected $container; /** - * @var \phpbb\install\helper\config + * @var config */ protected $install_config; @@ -31,17 +40,24 @@ class installer protected $installer_modules; /** - * @var \phpbb\install\helper\iohandler\iohandler_interface + * @var iohandler_interface */ protected $iohandler; + /** + * Stores the number of steps that a given module has + * + * @var array + */ + protected $module_step_count; + /** * Constructor * - * @param \phpbb\install\helper\config $config Installer config handler - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container + * @param config $config Installer config handler + * @param ContainerInterface $container Dependency injection container */ - public function __construct(\phpbb\install\helper\config $config, \Symfony\Component\DependencyInjection\ContainerInterface $container) + public function __construct(config $config, ContainerInterface $container) { $this->install_config = $config; $this->container = $container; @@ -66,9 +82,9 @@ class installer /** * Sets input-output handler objects * - * @param helper\iohandler\iohandler_interface $iohandler + * @param iohandler_interface $iohandler */ - public function set_iohandler(\phpbb\install\helper\iohandler\iohandler_interface $iohandler) + public function set_iohandler(iohandler_interface $iohandler) { $this->iohandler = $iohandler; } @@ -84,24 +100,44 @@ class installer // Recover install progress $module_index = $this->recover_progress(); - // Count all tasks in the current installer modules - $task_count = 0; - foreach ($this->installer_modules as $name) - { - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($name); - - $task_count += $module->get_step_count(); - } - - // Set task count - $this->install_config->set_task_progress_count($task_count); - $this->iohandler->set_task_count($task_count); - + // Variable used to check if the install process have been finished $install_finished = false; + // Flag used by exception handling, whether or not we need to flush output buffer once again + $flush_messages = false; + try { + if ($this->install_config->get_task_progress_count() === 0) + { + // Count all tasks in the current installer modules + $step_count = 0; + foreach ($this->installer_modules as $index => $name) + { + try + { + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($name); + } + catch (InvalidArgumentException $e) + { + throw new module_not_found_exception($name); + } + + $module_step_count = $module->get_step_count(); + $step_count += $module_step_count; + $this->module_step_count[$index] = $module_step_count; + } + + // Set task count + $this->install_config->set_task_progress_count($step_count); + } + + // Set up progress information + $this->iohandler->set_task_count( + $this->install_config->get_task_progress_count() + ); + // Run until there are available resources while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) { @@ -117,14 +153,26 @@ class installer $this->install_config->set_active_module($module_service_name, $module_index); // Get module from container - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($module_service_name); + try + { + /** @var \phpbb\install\module_interface $module */ + $module = $this->container->get($module_service_name); + } + catch (InvalidArgumentException $e) + { + throw new module_not_found_exception($module_service_name); + } $module_index++; // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) { + $this->iohandler->add_log_message(array( + 'SKIP_MODULE', + $module_service_name, + )); + $this->install_config->increment_current_task_progress($this->module_step_count[$module_index - 1]); continue; } @@ -144,10 +192,46 @@ class installer // @todo: Send refresh request } } - catch (\phpbb\install\exception\user_interaction_required_exception $e) + catch (user_interaction_required_exception $e) { // @todo handle exception } + catch (module_not_found_exception $e) + { + $this->iohandler->add_error_message('MODULE_NOT_FOUND', array( + 'MODULE_NOT_FOUND_DESCRIPTION', + $e->get_module_service_name(), + )); + $flush_messages = true; + } + catch (task_not_found_exception $e) + { + $this->iohandler->add_error_message('TASK_NOT_FOUND', array( + 'TASK_NOT_FOUND_DESCRIPTION', + $e->get_task_service_name(), + )); + $flush_messages = true; + } + catch (invalid_service_name_exception $e) + { + if ($e->has_params()) + { + $msg = $e->get_params(); + array_unshift($msg, $e->get_error()); + } + else + { + $msg = $e->get_error(); + } + + $this->iohandler->add_error_message($msg); + $flush_messages = true; + } + + if ($flush_messages) + { + $this->iohandler->send_response(); + } // Save install progress $this->install_config->save_config(); diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php index d846593315..a181c5231a 100644 --- a/phpBB/install/module/obtain_data/module.php +++ b/phpBB/install/module/obtain_data/module.php @@ -15,44 +15,6 @@ namespace phpbb\install\module\obtain_data; class module extends \phpbb\install\module_base { - /** - * {@inheritdoc} - */ - public function run() - { - // Recover install progress - $task_index = $this->recover_progress(); - - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) - { - // Check if task exists - if (!isset($this->task_collection[$task_index])) - { - break; - } - - // Recover task to be executed - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); - - // Iterate to the next task - $task_index++; - - // Check if we can run the task - if (!$task->is_essential() && !$task->check_requirements()) - { - continue; - } - - $task->run(); - - // Log install progress - $current_task_index = $task_index - 1; - $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); - } - } - /** * {@inheritdoc} */ diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php index f3d1cc71ec..5de6bd70b9 100644 --- a/phpBB/install/module/requirements/module.php +++ b/phpBB/install/module/requirements/module.php @@ -34,8 +34,15 @@ class module extends \phpbb\install\module_base } // Recover task to be executed - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); + try + { + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + } + catch (InvalidArgumentException $e) + { + throw new task_not_found_exception($this->task_collection[$task_index]); + } // Iterate to the next task $task_index++; diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index 179884c039..ac7ce7583a 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -13,23 +13,30 @@ namespace phpbb\install; +use phpbb\install\exception\invalid_service_name_exception; +use phpbb\install\exception\task_not_found_exception; +use phpbb\install\helper\iohandler\iohandler_interface; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use phpbb\install\helper\config; + /** * Base class for installer module */ abstract class module_base implements module_interface { /** - * @var \Symfony\Component\DependencyInjection\ContainerInterface + * @var ContainerInterface */ protected $container; /** - * @var \phpbb\install\helper\config + * @var config */ protected $install_config; /** - * @var \phpbb\install\helper\iohandler\iohandler_interface + * @var iohandler_interface */ protected $iohandler; @@ -45,26 +52,33 @@ abstract class module_base implements module_interface */ protected $task_collection; + /** + * @var bool + */ + protected $allow_progress_bar; + /** * Installer module constructor * - * @param array $tasks array of installer tasks for installer module - * @param bool $essential flag that indicates if module is essential or not + * @param array $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module */ - public function __construct(array $tasks, $essential = true) + public function __construct(array $tasks, $essential = true, $allow_progress_bar = true) { - $this->task_collection = $tasks; - $this->is_essential = $essential; + $this->task_collection = $tasks; + $this->is_essential = $essential; + $this->allow_progress_bar = $allow_progress_bar; } /** * Dependency getter * - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container - * @param \phpbb\install\helper\config $config - * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param ContainerInterface $container + * @param config $config + * @param iohandler_interface $iohandler */ - public function setup(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\install\helper\config $config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler) + public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler) { $this->container = $container; $this->install_config = $config; @@ -107,32 +121,55 @@ abstract class module_base implements module_interface } // Recover task to be executed - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); + try + { + /** @var \phpbb\install\task_interface $task */ + $task = $this->container->get($this->task_collection[$task_index]); + } + catch (InvalidArgumentException $e) + { + throw new task_not_found_exception($this->task_collection[$task_index]); + } // Send progress information - $this->iohandler->set_progress( - $task->get_task_lang_name(), - $this->install_config->get_current_task_progress() - ); + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } // Iterate to the next task $task_index++; - $this->install_config->increment_current_task_progress(); // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) { + $this->iohandler->add_log_message(array( + 'SKIP_TASK', + $this->task_collection[$task_index], + )); + $class_name = $this->get_class_from_service_name($this->task_collection[$task_index - 1]); + $this->install_config->increment_current_task_progress($class_name::get_step_count()); continue; } + if ($this->allow_progress_bar) + { + $this->install_config->increment_current_task_progress(); + } + $task->run(); - // Send progress info - $this->iohandler->set_progress( - $task->get_task_lang_name(), - $this->install_config->get_current_task_progress() - ); + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } $this->iohandler->send_response(); @@ -179,22 +216,37 @@ abstract class module_base implements module_interface foreach ($this->task_collection as $task_service_name) { - $task_service_name_parts = explode('.', $task_service_name); - - if ($task_service_name_parts[0] !== 'installer') - { - // @todo throw an exception - } - - $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; - if (!class_exists($class_name)) - { - // @todo throw an exception - } - + $class_name = $this->get_class_from_service_name($task_service_name); $step_count += $class_name::get_step_count(); } return $step_count; } + + /** + * Returns the name of the class form the service name + * + * @param string $task_service_name Name of the service + * + * @return string Name of the class + * + * @throws invalid_service_name_exception When the service name does not meet the requirements described in task_interface + */ + protected function get_class_from_service_name($task_service_name) + { + $task_service_name_parts = explode('.', $task_service_name); + + if ($task_service_name_parts[0] !== 'installer') + { + throw new invalid_service_name_exception('TASK_SERVICE_INSTALLER_MISSING'); + } + + $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; + if (!class_exists($class_name)) + { + throw new invalid_service_name_exception('TASK_CLASS_NOT_FOUND', array($task_service_name, $class_name)); + } + + return $class_name; + } } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index e3c4b859f0..92251a4992 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -249,3 +249,18 @@ $lang = array_merge($lang, array( // Installer general progress messages 'INSTALLER_FINISHED' => 'The installer has finished successfully', )); + +// Installer's general messages +$lang = array_merge($lang, array( + 'MODULE_NOT_FOUND' => 'Module not found', + 'MODULE_NOT_FOUND_DESCRIPTION' => 'No module is found under the service definition “%s” is not defined.', + + 'TASK_NOT_FOUND' => 'Task not found', + 'TASK_NOT_FOUND_DESCRIPTION' => 'No task is found under the service definition “%s” is not defined.', + + 'SKIP_MODULE' => 'Skip “%s” module', + 'SKIP_TASK' => 'Skip “%s” task', + + 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', + 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', +)); From db4cfa7df62d5911bc5a0edcdc59236c39aede08 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 11 Jun 2015 19:32:11 +0200 Subject: [PATCH 13/75] [ticket/13740] Add navigation bar support for the installer Also added various UI elements and texts. [ci skip] PHPBB3-13740 --- phpBB/adm/style/install_header.html | 2 +- phpBB/adm/style/installer_form.html | 4 + phpBB/adm/style/installer_install.html | 6 +- phpBB/assets/javascript/installer.js | 61 ++++++++-- .../container/services_install_controller.yml | 3 + .../services_install_requirements.yml | 1 + phpBB/install/controller/helper.php | 24 +++- phpBB/install/controller/install.php | 108 ++++++++++++++---- ...{install_index.php => installer_index.php} | 2 +- ...nstaller_config_not_writable_exception.php | 22 ++++ .../user_interaction_required_exception.php | 3 + phpBB/install/helper/config.php | 49 +++++++- .../helper/iohandler/ajax_iohandler.php | 51 +++++++++ phpBB/install/helper/iohandler/factory.php | 4 + .../helper/iohandler/iohandler_interface.php | 19 +++ .../helper/navigation/install_navigation.php | 24 +++- .../helper/navigation/navigation_provider.php | 27 ++++- phpBB/install/installer.php | 34 +++++- phpBB/install/module/install_data/module.php | 8 +- .../module/install_database/module.php | 8 +- .../module/install_filesystem/module.php | 8 +- .../install/module/install_finish/module.php | 8 +- phpBB/install/module/obtain_data/module.php | 8 ++ phpBB/install/module/requirements/module.php | 17 +++ phpBB/install/module_base.php | 4 +- phpBB/install/module_interface.php | 7 ++ phpBB/language/en/install.php | 37 ++++++ 27 files changed, 495 insertions(+), 54 deletions(-) rename phpBB/install/controller/{install_index.php => installer_index.php} (98%) create mode 100644 phpBB/install/exception/installer_config_not_writable_exception.php diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index 6f7f129d39..b162fa3e89 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -43,7 +43,7 @@ id="activemenu">{l_block1.L_TITLE} - id="activemenu"> class="completed">{l_block2.L_TITLE} + id="activemenu"> class="completed" id="installer-stage-{l_block2.STAGE_NAME}">{l_block2.L_TITLE}

diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html index dbcf3c19f8..3cb4185bc6 100644 --- a/phpBB/adm/style/installer_form.html +++ b/phpBB/adm/style/installer_form.html @@ -1,6 +1,8 @@
+
+ @@ -40,7 +42,9 @@ +
+
{L_SUBMIT} diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html index 7d62075c62..7700c79036 100644 --- a/phpBB/adm/style/installer_install.html +++ b/phpBB/adm/style/installer_install.html @@ -1,11 +1,11 @@ -

{L_INSTALL}

-{CONTENT} +

{TITLE}

+

{CONTENT}

{L_SUBMIT} - +
diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index a9a315c0d5..eafcd78f47 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -95,6 +95,45 @@ interceptFormSubmit($form); } + /** + * Handles navigation status updates + * + * @param navObj + */ + function updateNavbarStatus(navObj) { + var navID, $stage, $stageListItem, $active; + $active = $('#activemenu'); + + if (navObj.hasOwnProperty('finished')) { + // This should be an Array + var navItems = navObj.finished; + + for (var i = 0; i < navItems.length; i++) { + navID = 'installer-stage-' + navItems[i]; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && $active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stage.addClass('completed'); + } + } + + if (navObj.hasOwnProperty('active')) { + navID = 'installer-stage-' + navObj.active; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && !$active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stageListItem.attr('id', 'activemenu'); + } + } + /** * Renders progress bar * @@ -166,6 +205,10 @@ if (responseObject.hasOwnProperty('progress')) { setProgress(responseObject.progress); } + + if (responseObject.hasOwnProperty('nav')) { + updateNavbarStatus(responseObject.nav); + } } /** @@ -231,6 +274,14 @@ }, 10); } + /** + * Resets the polling timer + */ + function resetPolling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } + /** * Sets up timer for processing the streamed HTTP response * @@ -240,15 +291,7 @@ resetPolling(); pollTimer = setInterval(function () { pollContent(xhReq); - }, 500); - } - - /** - * Resets the polling timer - */ - function resetPolling() { - clearInterval(pollTimer); - nextReadPosition = 0; + }, 250); } /** diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml index 5eea133590..6e6ef4acea 100644 --- a/phpBB/config/installer/container/services_install_controller.yml +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -23,7 +23,10 @@ services: class: phpbb\install\controller\install arguments: - @phpbb.installer.controller.helper + - @installer.helper.config - @installer.helper.iohandler_factory + - @installer.navigation.provider + - @language - @template - @request - @installer.installer.install diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index b1f38713e4..c93856837d 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -13,6 +13,7 @@ services: - @installer.helper.database - @installer.helper.iohandler +# Please note, that the name of this module is hard coded in the installer service installer.module.requirements_install: class: phpbb\install\module\requirements\module parent: installer.module_base diff --git a/phpBB/install/controller/helper.php b/phpBB/install/controller/helper.php index 7a5e20406d..0df1ae71a4 100644 --- a/phpBB/install/controller/helper.php +++ b/phpBB/install/controller/helper.php @@ -157,13 +157,25 @@ class helper { // @todo Sort navs by order - foreach ($entry[0] as $sub_entry) + foreach ($entry[0] as $name => $sub_entry) { - $this->template->assign_block_vars('l_block1', array( - 'L_TITLE' => $this->language->lang($sub_entry['label']), - 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), - 'U_TITLE' => $this->route($sub_entry['route']), - )); + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } + else + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } } } } diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php index 4021c5625b..c1329b6456 100644 --- a/phpBB/install/controller/install.php +++ b/phpBB/install/controller/install.php @@ -13,7 +13,16 @@ namespace phpbb\install\controller; +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpFoundation\Response; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\controller\helper; +use phpbb\template\template; +use phpbb\request\request_interface; +use phpbb\install\installer; +use phpbb\language\language; /** * Controller for installing phpBB @@ -21,51 +30,72 @@ use Symfony\Component\HttpFoundation\StreamedResponse; class install { /** - * @var \phpbb\install\controller\helper + * @var helper */ protected $controller_helper; /** - * @var \phpbb\install\helper\iohandler\factory + * @var config + */ + protected $installer_config; + + /** + * @var factory */ protected $iohandler_factory; /** - * @var \phpbb\template\template + * @var navigation_provider + */ + protected $menu_provider; + + /** + * @var language + */ + protected $language; + + /** + * @var template */ protected $template; /** - * @var \phpbb\request\request_interface + * @var request_interface */ protected $request; /** - * @var \phpbb\install\installer + * @var installer */ protected $installer; /** * Constructor * - * @param helper $helper - * @param \phpbb\install\helper\iohandler\factory $factory - * @param \phpbb\request\request_interface $request - * @param \phpbb\install\installer $installer + * @param helper $helper + * @param config $install_config + * @param factory $factory + * @param navigation_provider $nav_provider + * @param language $language + * @param request_interface $request + * @param installer $installer */ - public function __construct(helper $helper, \phpbb\install\helper\iohandler\factory $factory, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\install\installer $installer) + public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer) { - $this->controller_helper = $helper; - $this->iohandler_factory = $factory; - $this->template = $template; - $this->request = $request; - $this->installer = $installer; + $this->controller_helper = $helper; + $this->installer_config = $install_config; + $this->iohandler_factory = $factory; + $this->menu_provider = $nav_provider; + $this->language = $language; + $this->template = $template; + $this->request = $request; + $this->installer = $installer; } /** * Controller logic * - * @return \Symfony\Component\HttpFoundation\Response|StreamedResponse + * @return Response|StreamedResponse */ public function handle() { @@ -86,13 +116,38 @@ class install } // Set the appropriate input-output handler - //$this->installer->set_iohandler($this->iohandler_factory->get()); + $this->installer->set_iohandler($this->iohandler_factory->get()); + + // Set up navigation + $nav_data = $this->installer_config->get_navigation_data(); + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) + { + $iohandler->set_active_stage_menu($nav_data['active']); + $this->menu_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + $iohandler->set_finished_stage_menu($finished_stage); + $this->menu_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } if ($this->request->is_ajax()) { - // @todo: remove this line, and use the above - $this->installer->set_iohandler($this->iohandler_factory->get()); - $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function() use ($installer) { @@ -106,9 +161,20 @@ class install // Determine whether the installation was started or not if (true) { + // Set active stage + $this->menu_provider->set_nav_property( + array('install', 0, 'introduction'), + array( + 'selected' => true, + 'completed' => false, + ) + ); + // If not, let's render the welcome page $this->template->assign_vars(array( - 'SHOW_INSTALL_START_FORM' => true, + 'SHOW_INSTALL_START_FORM' => true, + 'TITLE' => $this->language->lang('INSTALL_INTRO'), + 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), )); return $this->controller_helper->render('installer_install.html', 'INSTALL'); } diff --git a/phpBB/install/controller/install_index.php b/phpBB/install/controller/installer_index.php similarity index 98% rename from phpBB/install/controller/install_index.php rename to phpBB/install/controller/installer_index.php index c61d68f7fb..3d5224f1be 100644 --- a/phpBB/install/controller/install_index.php +++ b/phpBB/install/controller/installer_index.php @@ -13,7 +13,7 @@ namespace phpbb\install\controller; -class install_index +class installer_index { /** * @var helper diff --git a/phpBB/install/exception/installer_config_not_writable_exception.php b/phpBB/install/exception/installer_config_not_writable_exception.php new file mode 100644 index 0000000000..3f3b03f178 --- /dev/null +++ b/phpBB/install/exception/installer_config_not_writable_exception.php @@ -0,0 +1,22 @@ + + * @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\exception; + +/** + * Exception for the event when installer config is not writable to disk + */ +class installer_config_not_writable_exception extends installer_exception +{ + +} diff --git a/phpBB/install/exception/user_interaction_required_exception.php b/phpBB/install/exception/user_interaction_required_exception.php index 0aaae648cf..d65a448841 100644 --- a/phpBB/install/exception/user_interaction_required_exception.php +++ b/phpBB/install/exception/user_interaction_required_exception.php @@ -15,6 +15,9 @@ namespace phpbb\install\exception; /** * This exception should be thrown when user interaction is inevitable + * + * Note: Please note that the output should already be setup for the user + * when you use throw this exception */ class user_interaction_required_exception extends installer_exception { diff --git a/phpBB/install/helper/config.php b/phpBB/install/helper/config.php index 0c04b5e950..5c1348c06d 100644 --- a/phpBB/install/helper/config.php +++ b/phpBB/install/helper/config.php @@ -13,6 +13,8 @@ namespace phpbb\install\helper; +use phpbb\install\exception\installer_config_not_writable_exception; + /** * Stores common settings and installation status */ @@ -64,6 +66,13 @@ class config */ protected $system_data; + /** + * Array containing navigation bar information + * + * @var array + */ + protected $navigation_data; + /** * Constructor */ @@ -74,6 +83,7 @@ class config $this->phpbb_root_path = $phpbb_root_path; // Set up data arrays + $this->navigation_data = array(); $this->installer_config = array(); $this->system_data = array(); $this->progress_data = array( @@ -206,6 +216,7 @@ class config $this->installer_config = $unserialized_data['installer_config']; $this->progress_data = $unserialized_data['progress_data']; + $this->navigation_data = $unserialized_data['navigation_data']; } /** @@ -217,6 +228,7 @@ class config $save_array = array( 'installer_config' => $this->installer_config, 'progress_data' => $this->progress_data, + 'navigation_data' => $this->navigation_data, ); // Create file content @@ -225,7 +237,12 @@ class config $file_content .= "\n"; // Dump file_content to disk - $fp = fopen($this->install_config_file, 'w'); + $fp = @fopen($this->install_config_file, 'w'); + if (!$fp) + { + throw new installer_config_not_writable_exception(); + } + fwrite($fp, $file_content); fclose($fp); } @@ -285,6 +302,36 @@ class config return $this->progress_data['max_task_progress']; } + /** + * Marks stage as completed in the navigation bar + * + * @param array $nav_path Array to the navigation elem + */ + public function set_finished_navigation_stage($nav_path) + { + $this->navigation_data['finished'][] = $nav_path; + } + + /** + * Marks stage as active in the navigation bar + * + * @param array $nav_path Array to the navigation elem + */ + public function set_active_navigation_stage($nav_path) + { + $this->navigation_data['active'] = $nav_path; + } + + /** + * Returns navigation data + * + * @return array + */ + public function get_navigation_data() + { + return $this->navigation_data; + } + /** * Filling up system_data array */ diff --git a/phpBB/install/helper/iohandler/ajax_iohandler.php b/phpBB/install/helper/iohandler/ajax_iohandler.php index 960dd615b5..71571fecba 100644 --- a/phpBB/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/install/helper/iohandler/ajax_iohandler.php @@ -33,6 +33,16 @@ class ajax_iohandler extends iohandler_base */ protected $form; + /** + * @var bool + */ + protected $request_client_refresh; + + /** + * @var array + */ + protected $nav_data; + /** * Constructor * @@ -44,6 +54,7 @@ class ajax_iohandler extends iohandler_base $this->request = $request; $this->template = $template; $this->form = ''; + $this->nav_data = array(); parent::__construct(); } @@ -89,6 +100,8 @@ class ajax_iohandler extends iohandler_base // This code is pretty ugly... but works // + $this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form)); + $this->template->assign_block_vars('options', array( 'LEGEND' => $this->language->lang($title), 'S_LEGEND' => true, @@ -187,9 +200,21 @@ class ajax_iohandler extends iohandler_base ); } + if (!empty($this->nav_data)) + { + $json_array['nav'] = $this->nav_data; + } + $this->errors = array(); $this->warnings = array(); $this->logs = array(); + $this->nav_data = array(); + + if ($this->request_client_refresh) + { + $json_array['refresh'] = true; + $this->request_client_refresh = false; + } return $json_array; } @@ -203,6 +228,32 @@ class ajax_iohandler extends iohandler_base $this->send_response(); } + /** + * {@inheritdoc} + */ + public function request_refresh() + { + $this->request_client_refresh = true; + } + + /** + * {@inheritdoc} + */ + public function set_active_stage_menu($menu_path) + { + $this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1]; + $this->send_response(); + } + + /** + * {@inheritdoc} + */ + public function set_finished_stage_menu($menu_path) + { + $this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1]; + $this->send_response(); + } + /** * Callback function for language replacing * diff --git a/phpBB/install/helper/iohandler/factory.php b/phpBB/install/helper/iohandler/factory.php index 0b59e5ec63..0af75b78ae 100644 --- a/phpBB/install/helper/iohandler/factory.php +++ b/phpBB/install/helper/iohandler/factory.php @@ -64,6 +64,10 @@ class factory case 'ajax': return $this->container->get('installer.helper.iohandler_ajax'); break; + case 'nojs': + // @todo replace this + return $this->container->get('installer.helper.iohandler_ajax'); + break; default: throw new iohandler_not_implemented_exception(); break; diff --git a/phpBB/install/helper/iohandler/iohandler_interface.php b/phpBB/install/helper/iohandler/iohandler_interface.php index 387a8617b9..c40fea24ce 100644 --- a/phpBB/install/helper/iohandler/iohandler_interface.php +++ b/phpBB/install/helper/iohandler/iohandler_interface.php @@ -123,4 +123,23 @@ interface iohandler_interface * @param int $task_number Position of the current task in the task queue */ public function set_progress($task_lang_key, $task_number); + + /** + * Sends refresh request to the client + */ + public function request_refresh(); + + /** + * Marks stage as active in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_active_stage_menu($menu_path); + + /** + * Marks stage as completed in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_finished_stage_menu($menu_path); } diff --git a/phpBB/install/helper/navigation/install_navigation.php b/phpBB/install/helper/navigation/install_navigation.php index 3e29e55038..1389f11fa0 100644 --- a/phpBB/install/helper/navigation/install_navigation.php +++ b/phpBB/install/helper/navigation/install_navigation.php @@ -21,7 +21,29 @@ class install_navigation implements navigation_interface 'install' => array( 'label' => 'INSTALL', 'route' => 'phpbb_installer_install', - 'order' => 0, + 'order' => 1, + array( + 'introduction' => array( + 'label' => 'INTRODUCTION_TITLE', + 'stage' => true, + 'order' => 0, + ), + 'requirements' => array( + 'label' => 'STAGE_REQUIREMENTS', + 'stage' => true, + 'order' => 1, + ), + 'obtain_data' => array( + 'label' => 'STAGE_OBTAIN_DATA', + 'stage' => true, + 'order' => 2, + ), + 'install' => array( + 'label' => 'STAGE_INSTALL', + 'stage' => true, + 'order' => 3, + ), + ), ), ); } diff --git a/phpBB/install/helper/navigation/navigation_provider.php b/phpBB/install/helper/navigation/navigation_provider.php index ddb2509348..1f58cbea83 100644 --- a/phpBB/install/helper/navigation/navigation_provider.php +++ b/phpBB/install/helper/navigation/navigation_provider.php @@ -13,6 +13,8 @@ namespace phpbb\install\helper\navigation; +use phpbb\di\service_collection; + /** * Installers navigation provider */ @@ -26,9 +28,9 @@ class navigation_provider /** * Constructor * - * @param \phpbb\di\service_collection $plugins + * @param service_collection $plugins */ - public function __construct(\phpbb\di\service_collection $plugins) + public function __construct(service_collection $plugins) { $this->menu_collection = array(); @@ -59,6 +61,27 @@ class navigation_provider $this->merge($nav_arry, $this->menu_collection); } + /** + * Set a property in the navigation array + * + * @param array $nav_element Array to the navigation elem + * @param array $property_array Array with the properties to set + */ + public function set_nav_property($nav_element, $property_array) + { + $array_pointer = array(); + $array_root_pointer = &$array_pointer; + foreach ($nav_element as $array_path) + { + $array_pointer[$array_path] = array(); + $array_pointer = &$array_pointer[$array_path]; + } + + $array_pointer = $property_array; + + $this->merge($array_root_pointer, $this->menu_collection); + } + /** * Recursive array merge * diff --git a/phpBB/install/installer.php b/phpBB/install/installer.php index 1c7c9c8a92..f5da898a00 100644 --- a/phpBB/install/installer.php +++ b/phpBB/install/installer.php @@ -13,6 +13,7 @@ namespace phpbb\install; +use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\module_not_found_exception; use phpbb\install\exception\task_not_found_exception; @@ -106,6 +107,10 @@ class installer // Flag used by exception handling, whether or not we need to flush output buffer once again $flush_messages = false; + // We are installing something, so the introduction stage can go now... + $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); + $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); + try { if ($this->install_config->get_task_progress_count() === 0) @@ -168,6 +173,9 @@ class installer // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) { + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + $this->iohandler->add_log_message(array( 'SKIP_MODULE', $module_service_name, @@ -176,8 +184,15 @@ class installer continue; } + // Set the correct stage in the navigation bar + $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); + $module->run(); + $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); + $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); + // Clear task progress $this->install_config->set_finished_task('', 0); } @@ -189,12 +204,12 @@ class installer } else { - // @todo: Send refresh request + $this->iohandler->request_refresh(); } } catch (user_interaction_required_exception $e) { - // @todo handle exception + // Do nothing } catch (module_not_found_exception $e) { @@ -234,7 +249,20 @@ class installer } // Save install progress - $this->install_config->save_config(); + try + { + $this->install_config->save_config(); + } + catch (installer_config_not_writable_exception $e) + { + // It is allowed to fail this test during requirements testing + $progress_data = $this->install_config->get_progress_data(); + + if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') + { + $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); + } + } } /** diff --git a/phpBB/install/module/install_data/module.php b/phpBB/install/module/install_data/module.php index 231bcb0866..77f1f73f1f 100644 --- a/phpBB/install/module/install_data/module.php +++ b/phpBB/install/module/install_data/module.php @@ -18,5 +18,11 @@ namespace phpbb\install\module\install_data; */ class module extends \phpbb\install\module_base { - + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } } diff --git a/phpBB/install/module/install_database/module.php b/phpBB/install/module/install_database/module.php index d31c5573ec..0d8b33087f 100644 --- a/phpBB/install/module/install_database/module.php +++ b/phpBB/install/module/install_database/module.php @@ -18,5 +18,11 @@ namespace phpbb\install\module\install_database; */ class module extends \phpbb\install\module_base { - + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } } diff --git a/phpBB/install/module/install_filesystem/module.php b/phpBB/install/module/install_filesystem/module.php index 9562c957fd..7215449664 100644 --- a/phpBB/install/module/install_filesystem/module.php +++ b/phpBB/install/module/install_filesystem/module.php @@ -18,5 +18,11 @@ namespace phpbb\install\module\install_filesystem; */ class module extends \phpbb\install\module_base { - + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } } diff --git a/phpBB/install/module/install_finish/module.php b/phpBB/install/module/install_finish/module.php index 98c99d7cff..3a7544b84f 100644 --- a/phpBB/install/module/install_finish/module.php +++ b/phpBB/install/module/install_finish/module.php @@ -18,5 +18,11 @@ namespace phpbb\install\module\install_finish; */ class module extends \phpbb\install\module_base { - + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'install'); + } } diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/install/module/obtain_data/module.php index a181c5231a..0e008796c5 100644 --- a/phpBB/install/module/obtain_data/module.php +++ b/phpBB/install/module/obtain_data/module.php @@ -15,6 +15,14 @@ namespace phpbb\install\module\obtain_data; class module extends \phpbb\install\module_base { + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'obtain_data'); + } + /** * {@inheritdoc} */ diff --git a/phpBB/install/module/requirements/module.php b/phpBB/install/module/requirements/module.php index 5de6bd70b9..d87ca15128 100644 --- a/phpBB/install/module/requirements/module.php +++ b/phpBB/install/module/requirements/module.php @@ -61,6 +61,15 @@ class module extends \phpbb\install\module_base if (!$tests_passed) { // If requirements are not met, exit form installer + // Set up UI for retesting + $this->iohandler->add_user_form_group('', array( + 'install' => array( + 'label' => 'RETEST_REQUIREMENTS', + 'type' => 'submit', + ), + )); + + // Send the response and quit $this->iohandler->send_response(); throw new user_interaction_required_exception(); } @@ -77,4 +86,12 @@ class module extends \phpbb\install\module_base { return 0; } + + /** + * {@inheritdoc} + */ + public function get_navigation_stage_path() + { + return array('install', 0, 'requirements'); + } } diff --git a/phpBB/install/module_base.php b/phpBB/install/module_base.php index ac7ce7583a..6c0c0e0c30 100644 --- a/phpBB/install/module_base.php +++ b/phpBB/install/module_base.php @@ -75,8 +75,8 @@ abstract class module_base implements module_interface * Dependency getter * * @param ContainerInterface $container - * @param config $config - * @param iohandler_interface $iohandler + * @param config $config + * @param iohandler_interface $iohandler */ public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler) { diff --git a/phpBB/install/module_interface.php b/phpBB/install/module_interface.php index 29918f0c34..a2d61e3958 100644 --- a/phpBB/install/module_interface.php +++ b/phpBB/install/module_interface.php @@ -53,4 +53,11 @@ interface module_interface * @return int */ public function get_step_count(); + + /** + * Returns an array to the correct navigation stage + * + * @return array + */ + public function get_navigation_stage_path(); } diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 92251a4992..f050d49ebd 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -40,6 +40,8 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'INSTALL_PANEL' => 'Installation Panel', + 'STAGE_INSTALL' => 'Installing phpBB', + // Introduction page 'INTRODUCTION_TITLE' => 'Introduction', 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', @@ -50,6 +52,33 @@ $lang = array_merge($lang, array( // License 'LICENSE_TITLE' => 'General Public License', + + // Install page + 'INSTALL_INTRO' => 'Welcome to Installation', + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ +
    +
  • The Database Type - the database you will be using.
  • +
  • The Database server hostname or DSN - the address of the database server.
  • +
  • The Database server port - the port of the database server (most of the time this is not needed).
  • +
  • The Database name - the name of the database on the server.
  • +
  • The Database username and Database password - the login data to access the database.
  • +
+ +

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

+ +

phpBB3 supports the following databases:

+
    +
  • MySQL 3.23 or above (MySQLi supported)
  • +
  • PostgreSQL 8.3+
  • +
  • SQLite 2.8.2+
  • +
  • SQLite 3.6.15+
  • +
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • +
  • Oracle
  • +
+ +

Only those databases supported on your server will be displayed.', )); // Requirements translation @@ -76,6 +105,10 @@ $lang = array_merge($lang, array( 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', 'PHP_SUPPORTED_DB' => 'Supported databases', 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + + 'RETEST_REQUIREMENTS' => 'Retest requirements', + + 'STAGE_REQUIREMENTS' => 'Check requirements' )); // General error messages @@ -85,6 +118,8 @@ $lang = array_merge($lang, array( // Data obtaining translations $lang = array_merge($lang, array( + 'STAGE_OBTAIN_DATA' => 'Set installation data', + // // Admin data // @@ -263,4 +298,6 @@ $lang = array_merge($lang, array( 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', + + 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', )); From 3dcaa48850bf823b238391fbf9c3f085092010bc Mon Sep 17 00:00:00 2001 From: CHItA Date: Sat, 13 Jun 2015 15:35:19 +0200 Subject: [PATCH 14/75] [ticket/13740] Move installer files to phpbb/install directory PHPBB3-13740 --- phpBB/install/app.php | 3 --- phpBB/{ => phpbb}/install/controller/helper.php | 0 phpBB/{ => phpbb}/install/controller/install.php | 0 phpBB/{ => phpbb}/install/controller/installer_index.php | 0 .../install/exception/cannot_build_container_exception.php | 0 .../exception/installer_config_not_writable_exception.php | 0 phpBB/{ => phpbb}/install/exception/installer_exception.php | 0 phpBB/{ => phpbb}/install/exception/invalid_dbms_exception.php | 0 .../install/exception/invalid_service_name_exception.php | 0 .../install/exception/module_not_found_exception.php | 0 .../{ => phpbb}/install/exception/task_not_found_exception.php | 0 .../install/exception/user_interaction_required_exception.php | 0 phpBB/{ => phpbb}/install/helper/config.php | 0 phpBB/{ => phpbb}/install/helper/container_factory.php | 0 phpBB/{ => phpbb}/install/helper/database.php | 0 phpBB/{ => phpbb}/install/helper/iohandler/ajax_iohandler.php | 0 .../exception/iohandler_not_implemented_exception.php | 0 phpBB/{ => phpbb}/install/helper/iohandler/factory.php | 0 phpBB/{ => phpbb}/install/helper/iohandler/iohandler_base.php | 0 .../install/helper/iohandler/iohandler_interface.php | 0 .../install/helper/navigation/install_navigation.php | 0 .../{ => phpbb}/install/helper/navigation/main_navigation.php | 0 .../install/helper/navigation/navigation_interface.php | 0 .../install/helper/navigation/navigation_provider.php | 0 phpBB/{ => phpbb}/install/installer.php | 0 phpBB/{ => phpbb}/install/module/install_data/module.php | 0 .../{ => phpbb}/install/module/install_data/task/add_bots.php | 0 .../install/module/install_data/task/add_languages.php | 0 .../install/module/install_data/task/add_modules.php | 0 phpBB/{ => phpbb}/install/module/install_database/module.php | 0 .../module/install_database/task/add_config_settings.php | 0 .../install/module/install_database/task/add_default_data.php | 0 .../install/module/install_database/task/create_schema.php | 0 phpBB/{ => phpbb}/install/module/install_filesystem/module.php | 0 .../module/install_filesystem/task/create_config_file.php | 0 phpBB/{ => phpbb}/install/module/install_finish/module.php | 0 .../install/module/install_finish/task/notify_user.php | 0 .../install/module/install_finish/task/populate_migrations.php | 0 phpBB/{ => phpbb}/install/module/obtain_data/module.php | 0 .../install/module/obtain_data/task/obtain_admin_data.php | 0 .../install/module/obtain_data/task/obtain_board_data.php | 0 .../install/module/obtain_data/task/obtain_database_data.php | 0 .../install/module/obtain_data/task/obtain_email_data.php | 0 .../install/module/obtain_data/task/obtain_imagick_path.php | 0 .../install/module/obtain_data/task/obtain_server_data.php | 0 phpBB/{ => phpbb}/install/module/requirements/module.php | 0 .../install/module/requirements/task/check_filesystem.php | 0 .../module/requirements/task/check_server_environment.php | 0 phpBB/{ => phpbb}/install/module_base.php | 0 phpBB/{ => phpbb}/install/module_interface.php | 0 phpBB/{ => phpbb}/install/schemas/index.htm | 0 phpBB/{ => phpbb}/install/schemas/oracle_schema.sql | 0 phpBB/{ => phpbb}/install/schemas/postgres_schema.sql | 0 phpBB/{ => phpbb}/install/schemas/schema_data.sql | 0 phpBB/{ => phpbb}/install/task_base.php | 0 phpBB/{ => phpbb}/install/task_interface.php | 0 56 files changed, 3 deletions(-) rename phpBB/{ => phpbb}/install/controller/helper.php (100%) rename phpBB/{ => phpbb}/install/controller/install.php (100%) rename phpBB/{ => phpbb}/install/controller/installer_index.php (100%) rename phpBB/{ => phpbb}/install/exception/cannot_build_container_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/installer_config_not_writable_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/installer_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/invalid_dbms_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/invalid_service_name_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/module_not_found_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/task_not_found_exception.php (100%) rename phpBB/{ => phpbb}/install/exception/user_interaction_required_exception.php (100%) rename phpBB/{ => phpbb}/install/helper/config.php (100%) rename phpBB/{ => phpbb}/install/helper/container_factory.php (100%) rename phpBB/{ => phpbb}/install/helper/database.php (100%) rename phpBB/{ => phpbb}/install/helper/iohandler/ajax_iohandler.php (100%) rename phpBB/{ => phpbb}/install/helper/iohandler/exception/iohandler_not_implemented_exception.php (100%) rename phpBB/{ => phpbb}/install/helper/iohandler/factory.php (100%) rename phpBB/{ => phpbb}/install/helper/iohandler/iohandler_base.php (100%) rename phpBB/{ => phpbb}/install/helper/iohandler/iohandler_interface.php (100%) rename phpBB/{ => phpbb}/install/helper/navigation/install_navigation.php (100%) rename phpBB/{ => phpbb}/install/helper/navigation/main_navigation.php (100%) rename phpBB/{ => phpbb}/install/helper/navigation/navigation_interface.php (100%) rename phpBB/{ => phpbb}/install/helper/navigation/navigation_provider.php (100%) rename phpBB/{ => phpbb}/install/installer.php (100%) rename phpBB/{ => phpbb}/install/module/install_data/module.php (100%) rename phpBB/{ => phpbb}/install/module/install_data/task/add_bots.php (100%) rename phpBB/{ => phpbb}/install/module/install_data/task/add_languages.php (100%) rename phpBB/{ => phpbb}/install/module/install_data/task/add_modules.php (100%) rename phpBB/{ => phpbb}/install/module/install_database/module.php (100%) rename phpBB/{ => phpbb}/install/module/install_database/task/add_config_settings.php (100%) rename phpBB/{ => phpbb}/install/module/install_database/task/add_default_data.php (100%) rename phpBB/{ => phpbb}/install/module/install_database/task/create_schema.php (100%) rename phpBB/{ => phpbb}/install/module/install_filesystem/module.php (100%) rename phpBB/{ => phpbb}/install/module/install_filesystem/task/create_config_file.php (100%) rename phpBB/{ => phpbb}/install/module/install_finish/module.php (100%) rename phpBB/{ => phpbb}/install/module/install_finish/task/notify_user.php (100%) rename phpBB/{ => phpbb}/install/module/install_finish/task/populate_migrations.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/module.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_admin_data.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_board_data.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_database_data.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_email_data.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_imagick_path.php (100%) rename phpBB/{ => phpbb}/install/module/obtain_data/task/obtain_server_data.php (100%) rename phpBB/{ => phpbb}/install/module/requirements/module.php (100%) rename phpBB/{ => phpbb}/install/module/requirements/task/check_filesystem.php (100%) rename phpBB/{ => phpbb}/install/module/requirements/task/check_server_environment.php (100%) rename phpBB/{ => phpbb}/install/module_base.php (100%) rename phpBB/{ => phpbb}/install/module_interface.php (100%) rename phpBB/{ => phpbb}/install/schemas/index.htm (100%) rename phpBB/{ => phpbb}/install/schemas/oracle_schema.sql (100%) rename phpBB/{ => phpbb}/install/schemas/postgres_schema.sql (100%) rename phpBB/{ => phpbb}/install/schemas/schema_data.sql (100%) rename phpBB/{ => phpbb}/install/task_base.php (100%) rename phpBB/{ => phpbb}/install/task_interface.php (100%) diff --git a/phpBB/install/app.php b/phpBB/install/app.php index 58ca141af7..09a8faf592 100644 --- a/phpBB/install/app.php +++ b/phpBB/install/app.php @@ -26,9 +26,6 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1); require($phpbb_root_path . 'includes/startup.' . $phpEx); require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); -$phpbb_class_loader = new \phpbb\class_loader('phpbb\\install\\', "{$phpbb_root_path}install/", $phpEx); -$phpbb_class_loader->register(); - $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); $phpbb_class_loader->register(); diff --git a/phpBB/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php similarity index 100% rename from phpBB/install/controller/helper.php rename to phpBB/phpbb/install/controller/helper.php diff --git a/phpBB/install/controller/install.php b/phpBB/phpbb/install/controller/install.php similarity index 100% rename from phpBB/install/controller/install.php rename to phpBB/phpbb/install/controller/install.php diff --git a/phpBB/install/controller/installer_index.php b/phpBB/phpbb/install/controller/installer_index.php similarity index 100% rename from phpBB/install/controller/installer_index.php rename to phpBB/phpbb/install/controller/installer_index.php diff --git a/phpBB/install/exception/cannot_build_container_exception.php b/phpBB/phpbb/install/exception/cannot_build_container_exception.php similarity index 100% rename from phpBB/install/exception/cannot_build_container_exception.php rename to phpBB/phpbb/install/exception/cannot_build_container_exception.php diff --git a/phpBB/install/exception/installer_config_not_writable_exception.php b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php similarity index 100% rename from phpBB/install/exception/installer_config_not_writable_exception.php rename to phpBB/phpbb/install/exception/installer_config_not_writable_exception.php diff --git a/phpBB/install/exception/installer_exception.php b/phpBB/phpbb/install/exception/installer_exception.php similarity index 100% rename from phpBB/install/exception/installer_exception.php rename to phpBB/phpbb/install/exception/installer_exception.php diff --git a/phpBB/install/exception/invalid_dbms_exception.php b/phpBB/phpbb/install/exception/invalid_dbms_exception.php similarity index 100% rename from phpBB/install/exception/invalid_dbms_exception.php rename to phpBB/phpbb/install/exception/invalid_dbms_exception.php diff --git a/phpBB/install/exception/invalid_service_name_exception.php b/phpBB/phpbb/install/exception/invalid_service_name_exception.php similarity index 100% rename from phpBB/install/exception/invalid_service_name_exception.php rename to phpBB/phpbb/install/exception/invalid_service_name_exception.php diff --git a/phpBB/install/exception/module_not_found_exception.php b/phpBB/phpbb/install/exception/module_not_found_exception.php similarity index 100% rename from phpBB/install/exception/module_not_found_exception.php rename to phpBB/phpbb/install/exception/module_not_found_exception.php diff --git a/phpBB/install/exception/task_not_found_exception.php b/phpBB/phpbb/install/exception/task_not_found_exception.php similarity index 100% rename from phpBB/install/exception/task_not_found_exception.php rename to phpBB/phpbb/install/exception/task_not_found_exception.php diff --git a/phpBB/install/exception/user_interaction_required_exception.php b/phpBB/phpbb/install/exception/user_interaction_required_exception.php similarity index 100% rename from phpBB/install/exception/user_interaction_required_exception.php rename to phpBB/phpbb/install/exception/user_interaction_required_exception.php diff --git a/phpBB/install/helper/config.php b/phpBB/phpbb/install/helper/config.php similarity index 100% rename from phpBB/install/helper/config.php rename to phpBB/phpbb/install/helper/config.php diff --git a/phpBB/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php similarity index 100% rename from phpBB/install/helper/container_factory.php rename to phpBB/phpbb/install/helper/container_factory.php diff --git a/phpBB/install/helper/database.php b/phpBB/phpbb/install/helper/database.php similarity index 100% rename from phpBB/install/helper/database.php rename to phpBB/phpbb/install/helper/database.php diff --git a/phpBB/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php similarity index 100% rename from phpBB/install/helper/iohandler/ajax_iohandler.php rename to phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php diff --git a/phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php b/phpBB/phpbb/install/helper/iohandler/exception/iohandler_not_implemented_exception.php similarity index 100% rename from phpBB/install/helper/iohandler/exception/iohandler_not_implemented_exception.php rename to phpBB/phpbb/install/helper/iohandler/exception/iohandler_not_implemented_exception.php diff --git a/phpBB/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php similarity index 100% rename from phpBB/install/helper/iohandler/factory.php rename to phpBB/phpbb/install/helper/iohandler/factory.php diff --git a/phpBB/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php similarity index 100% rename from phpBB/install/helper/iohandler/iohandler_base.php rename to phpBB/phpbb/install/helper/iohandler/iohandler_base.php diff --git a/phpBB/install/helper/iohandler/iohandler_interface.php b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php similarity index 100% rename from phpBB/install/helper/iohandler/iohandler_interface.php rename to phpBB/phpbb/install/helper/iohandler/iohandler_interface.php diff --git a/phpBB/install/helper/navigation/install_navigation.php b/phpBB/phpbb/install/helper/navigation/install_navigation.php similarity index 100% rename from phpBB/install/helper/navigation/install_navigation.php rename to phpBB/phpbb/install/helper/navigation/install_navigation.php diff --git a/phpBB/install/helper/navigation/main_navigation.php b/phpBB/phpbb/install/helper/navigation/main_navigation.php similarity index 100% rename from phpBB/install/helper/navigation/main_navigation.php rename to phpBB/phpbb/install/helper/navigation/main_navigation.php diff --git a/phpBB/install/helper/navigation/navigation_interface.php b/phpBB/phpbb/install/helper/navigation/navigation_interface.php similarity index 100% rename from phpBB/install/helper/navigation/navigation_interface.php rename to phpBB/phpbb/install/helper/navigation/navigation_interface.php diff --git a/phpBB/install/helper/navigation/navigation_provider.php b/phpBB/phpbb/install/helper/navigation/navigation_provider.php similarity index 100% rename from phpBB/install/helper/navigation/navigation_provider.php rename to phpBB/phpbb/install/helper/navigation/navigation_provider.php diff --git a/phpBB/install/installer.php b/phpBB/phpbb/install/installer.php similarity index 100% rename from phpBB/install/installer.php rename to phpBB/phpbb/install/installer.php diff --git a/phpBB/install/module/install_data/module.php b/phpBB/phpbb/install/module/install_data/module.php similarity index 100% rename from phpBB/install/module/install_data/module.php rename to phpBB/phpbb/install/module/install_data/module.php diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php similarity index 100% rename from phpBB/install/module/install_data/task/add_bots.php rename to phpBB/phpbb/install/module/install_data/task/add_bots.php diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/phpbb/install/module/install_data/task/add_languages.php similarity index 100% rename from phpBB/install/module/install_data/task/add_languages.php rename to phpBB/phpbb/install/module/install_data/task/add_languages.php diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php similarity index 100% rename from phpBB/install/module/install_data/task/add_modules.php rename to phpBB/phpbb/install/module/install_data/task/add_modules.php diff --git a/phpBB/install/module/install_database/module.php b/phpBB/phpbb/install/module/install_database/module.php similarity index 100% rename from phpBB/install/module/install_database/module.php rename to phpBB/phpbb/install/module/install_database/module.php diff --git a/phpBB/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php similarity index 100% rename from phpBB/install/module/install_database/task/add_config_settings.php rename to phpBB/phpbb/install/module/install_database/task/add_config_settings.php diff --git a/phpBB/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php similarity index 100% rename from phpBB/install/module/install_database/task/add_default_data.php rename to phpBB/phpbb/install/module/install_database/task/add_default_data.php diff --git a/phpBB/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php similarity index 100% rename from phpBB/install/module/install_database/task/create_schema.php rename to phpBB/phpbb/install/module/install_database/task/create_schema.php diff --git a/phpBB/install/module/install_filesystem/module.php b/phpBB/phpbb/install/module/install_filesystem/module.php similarity index 100% rename from phpBB/install/module/install_filesystem/module.php rename to phpBB/phpbb/install/module/install_filesystem/module.php diff --git a/phpBB/install/module/install_filesystem/task/create_config_file.php b/phpBB/phpbb/install/module/install_filesystem/task/create_config_file.php similarity index 100% rename from phpBB/install/module/install_filesystem/task/create_config_file.php rename to phpBB/phpbb/install/module/install_filesystem/task/create_config_file.php diff --git a/phpBB/install/module/install_finish/module.php b/phpBB/phpbb/install/module/install_finish/module.php similarity index 100% rename from phpBB/install/module/install_finish/module.php rename to phpBB/phpbb/install/module/install_finish/module.php diff --git a/phpBB/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php similarity index 100% rename from phpBB/install/module/install_finish/task/notify_user.php rename to phpBB/phpbb/install/module/install_finish/task/notify_user.php diff --git a/phpBB/install/module/install_finish/task/populate_migrations.php b/phpBB/phpbb/install/module/install_finish/task/populate_migrations.php similarity index 100% rename from phpBB/install/module/install_finish/task/populate_migrations.php rename to phpBB/phpbb/install/module/install_finish/task/populate_migrations.php diff --git a/phpBB/install/module/obtain_data/module.php b/phpBB/phpbb/install/module/obtain_data/module.php similarity index 100% rename from phpBB/install/module/obtain_data/module.php rename to phpBB/phpbb/install/module/obtain_data/module.php diff --git a/phpBB/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_admin_data.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php diff --git a/phpBB/install/module/obtain_data/task/obtain_board_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_board_data.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php diff --git a/phpBB/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_database_data.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php diff --git a/phpBB/install/module/obtain_data/task/obtain_email_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_email_data.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_email_data.php diff --git a/phpBB/install/module/obtain_data/task/obtain_imagick_path.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_imagick_path.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_imagick_path.php diff --git a/phpBB/install/module/obtain_data/task/obtain_server_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php similarity index 100% rename from phpBB/install/module/obtain_data/task/obtain_server_data.php rename to phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php diff --git a/phpBB/install/module/requirements/module.php b/phpBB/phpbb/install/module/requirements/module.php similarity index 100% rename from phpBB/install/module/requirements/module.php rename to phpBB/phpbb/install/module/requirements/module.php diff --git a/phpBB/install/module/requirements/task/check_filesystem.php b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php similarity index 100% rename from phpBB/install/module/requirements/task/check_filesystem.php rename to phpBB/phpbb/install/module/requirements/task/check_filesystem.php diff --git a/phpBB/install/module/requirements/task/check_server_environment.php b/phpBB/phpbb/install/module/requirements/task/check_server_environment.php similarity index 100% rename from phpBB/install/module/requirements/task/check_server_environment.php rename to phpBB/phpbb/install/module/requirements/task/check_server_environment.php diff --git a/phpBB/install/module_base.php b/phpBB/phpbb/install/module_base.php similarity index 100% rename from phpBB/install/module_base.php rename to phpBB/phpbb/install/module_base.php diff --git a/phpBB/install/module_interface.php b/phpBB/phpbb/install/module_interface.php similarity index 100% rename from phpBB/install/module_interface.php rename to phpBB/phpbb/install/module_interface.php diff --git a/phpBB/install/schemas/index.htm b/phpBB/phpbb/install/schemas/index.htm similarity index 100% rename from phpBB/install/schemas/index.htm rename to phpBB/phpbb/install/schemas/index.htm diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/phpbb/install/schemas/oracle_schema.sql similarity index 100% rename from phpBB/install/schemas/oracle_schema.sql rename to phpBB/phpbb/install/schemas/oracle_schema.sql diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/phpbb/install/schemas/postgres_schema.sql similarity index 100% rename from phpBB/install/schemas/postgres_schema.sql rename to phpBB/phpbb/install/schemas/postgres_schema.sql diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/phpbb/install/schemas/schema_data.sql similarity index 100% rename from phpBB/install/schemas/schema_data.sql rename to phpBB/phpbb/install/schemas/schema_data.sql diff --git a/phpBB/install/task_base.php b/phpBB/phpbb/install/task_base.php similarity index 100% rename from phpBB/install/task_base.php rename to phpBB/phpbb/install/task_base.php diff --git a/phpBB/install/task_interface.php b/phpBB/phpbb/install/task_interface.php similarity index 100% rename from phpBB/install/task_interface.php rename to phpBB/phpbb/install/task_interface.php From aa6a1c5939e4ae98d28e593ed2e09319c1341bba Mon Sep 17 00:00:00 2001 From: CHItA Date: Sat, 13 Jun 2015 15:38:51 +0200 Subject: [PATCH 15/75] [ticket/13740] Fix CS PHPBB3-13740 --- .../install/module/install_data/task/add_modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php index 6a77f8973b..8ca2b6b215 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_modules.php +++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php @@ -193,7 +193,7 @@ class add_modules extends \phpbb\install\task_base $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); } - $categories[$cat_name]['id'] = (int)$module_data['module_id']; + $categories[$cat_name]['id'] = (int) $module_data['module_id']; $categories[$cat_name]['parent_id'] = 0; if (is_array($subs)) @@ -207,7 +207,7 @@ class add_modules extends \phpbb\install\task_base 'module_basename' => $basename, 'module_enabled' => 1, 'module_display' => 1, - 'parent_id' => (int)$categories[$cat_name]['id'], + 'parent_id' => (int) $categories[$cat_name]['id'], 'module_class' => $module_class, 'module_langname' => $level2_name, 'module_mode' => '', @@ -223,8 +223,8 @@ class add_modules extends \phpbb\install\task_base $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); } - $categories[$level2_name]['id'] = (int)$module_data['module_id']; - $categories[$level2_name]['parent_id'] = (int)$categories[$cat_name]['id']; + $categories[$level2_name]['id'] = (int) $module_data['module_id']; + $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; } } } From 5ce170dcc3f798627d95876ce6777882ffb8b83e Mon Sep 17 00:00:00 2001 From: CHItA Date: Sun, 14 Jun 2015 13:36:45 +0200 Subject: [PATCH 16/75] [ticket/13740] Remove ActiveXObject as it is supported by IE versions >= 8 PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index eafcd78f47..68a4eb499b 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -3,7 +3,6 @@ */ (function($) { // Avoid conflicts with other libraries - 'use strict'; // Installer variables @@ -26,18 +25,11 @@ * as of now, jQuery does not provide access to the response until * the connection is not closed. * - * @return XMLHttpRequest|ActiveXObject + * @return XMLHttpRequest */ function createXhrObject() { - var xhReq; - - if (window.XMLHttpRequest) { - xhReq = new XMLHttpRequest(); - } - else if (window.ActiveXObject) { - xhReq = new ActiveXObject("Msxml2.XMLHTTP"); - } - + var xhReq = new XMLHttpRequest(); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); return xhReq; } @@ -336,7 +328,6 @@ var xhReq = createXhrObject(); xhReq.open('POST', $form.attr('action'), true); - xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhReq.send(getFormFields($form, $submitBtn)); From c53ce3d5fbfcdc9924426aee74fb1097138a8a42 Mon Sep 17 00:00:00 2001 From: CHItA Date: Wed, 17 Jun 2015 11:00:07 +0200 Subject: [PATCH 17/75] [ticket/13740] Fix CS and extend phpbb extensions [ci skip] PHPBB3-13740 --- .../default/container/services_http.yml | 14 +++--- phpBB/includes/compatibility_globals.php | 20 ++++---- phpBB/phpbb/install/controller/helper.php | 21 +++++++- .../install/exception/installer_exception.php | 4 +- .../invalid_service_name_exception.php | 50 ------------------- phpBB/phpbb/install/installer.php | 11 ++-- 6 files changed, 46 insertions(+), 74 deletions(-) diff --git a/phpBB/config/default/container/services_http.yml b/phpBB/config/default/container/services_http.yml index 9c2bdd2337..1285fd1d88 100644 --- a/phpBB/config/default/container/services_http.yml +++ b/phpBB/config/default/container/services_http.yml @@ -1,4 +1,11 @@ services: + http_kernel: + class: Symfony\Component\HttpKernel\HttpKernel + arguments: + - @dispatcher + - @controller.resolver + - @request_stack + # WARNING: The Symfony request does not escape the input and should be used very carefully # prefer the phpbb request (service @request) as possible symfony_request: @@ -14,10 +21,3 @@ services: arguments: - null - %core.disable_super_globals% - - http_kernel: - class: Symfony\Component\HttpKernel\HttpKernel - arguments: - - @dispatcher - - @controller.resolver - - @request_stack diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php index cb4087d09b..fadc879640 100644 --- a/phpBB/includes/compatibility_globals.php +++ b/phpBB/includes/compatibility_globals.php @@ -1,15 +1,15 @@ - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ /** */ diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 0df1ae71a4..8445d80a41 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -13,6 +13,13 @@ namespace phpbb\install\controller; +use phpbb\install\helper\navigation\navigation_provider; +use phpbb\language\language; +use phpbb\language\language_file_helper; +use phpbb\path_helper; +use phpbb\routing\router; +use phpbb\symfony_request; +use phpbb\template\template; use Symfony\Component\HttpFoundation\Response; /** @@ -68,7 +75,19 @@ class helper */ protected $phpbb_root_path; - public function __construct(\phpbb\language\language $language, \phpbb\language\language_file_helper $lang_helper, \phpbb\install\helper\navigation\navigation_provider $nav, \phpbb\template\template $template, \phpbb\path_helper $path_helper, \phpbb\symfony_request $request, \phpbb\routing\router $router, $phpbb_root_path) + /** + * Constructor + * + * @param language $language + * @param language_file_helper $lang_helper + * @param navigation_provider $nav + * @param template $template + * @param path_helper $path_helper + * @param symfony_request $request + * @param router $router + * @param string $phpbb_root_path + */ + public function __construct(language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, symfony_request $request, router $router, $phpbb_root_path) { $this->language = $language; $this->lang_helper = $lang_helper; diff --git a/phpBB/phpbb/install/exception/installer_exception.php b/phpBB/phpbb/install/exception/installer_exception.php index c37950d05c..f17dca8f17 100644 --- a/phpBB/phpbb/install/exception/installer_exception.php +++ b/phpBB/phpbb/install/exception/installer_exception.php @@ -13,10 +13,12 @@ namespace phpbb\install\exception; +use phpbb\exception\runtime_exception; + /** * Installer's base exception */ -class installer_exception extends \Exception +class installer_exception extends runtime_exception { } diff --git a/phpBB/phpbb/install/exception/invalid_service_name_exception.php b/phpBB/phpbb/install/exception/invalid_service_name_exception.php index e64cd2026f..dff4873f3c 100644 --- a/phpBB/phpbb/install/exception/invalid_service_name_exception.php +++ b/phpBB/phpbb/install/exception/invalid_service_name_exception.php @@ -15,55 +15,5 @@ namespace phpbb\install\exception; class invalid_service_name_exception extends installer_exception { - /** - * @var string - */ - private $params; - /** - * @var string - */ - private $error; - - /** - * Constructor - * - * @param string $error The name of the missing installer module - * @param array $params Additional values for message translation - */ - public function __construct($error, $params = array()) - { - $this->error = $error; - $this->params = $params; - } - - /** - * Returns the language entry's name for the error - * - * @return string - */ - public function get_error() - { - return $this->error; - } - - /** - * Returns parameters for the language entry, if there is any - * - * @return array - */ - public function get_params() - { - return $this->params; - } - - /** - * Returns true, if there are any parameters set - * - * @return bool - */ - public function has_params() - { - return (sizeof($this->params) !== 0); - } } diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index f5da898a00..d64713e6a3 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -229,17 +229,18 @@ class installer } catch (invalid_service_name_exception $e) { - if ($e->has_params()) + $params = $e->get_parameters(); + + if (!empty($params)) { - $msg = $e->get_params(); - array_unshift($msg, $e->get_error()); + array_unshift($params, $e->getMessage()); } else { - $msg = $e->get_error(); + $params = $e->getMessage(); } - $this->iohandler->add_error_message($msg); + $this->iohandler->add_error_message($params); $flush_messages = true; } From 609eb7a4d3e2b763f3e69e8bb61adc3ee3ced328 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 18 Jun 2015 01:41:50 +0200 Subject: [PATCH 18/75] [ticket/13740] Fix AJAX HTTP header setting PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 68a4eb499b..105818f82b 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -28,9 +28,7 @@ * @return XMLHttpRequest */ function createXhrObject() { - var xhReq = new XMLHttpRequest(); - xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - return xhReq; + return new XMLHttpRequest(); } /** @@ -328,6 +326,7 @@ var xhReq = createXhrObject(); xhReq.open('POST', $form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhReq.send(getFormFields($form, $submitBtn)); From 69a19e48fab4cfd6243bf7ac7e0c7373651b6f41 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 18 Jun 2015 02:11:51 +0200 Subject: [PATCH 19/75] [ticket/13740] Cache installer container PHPBB3-13740 --- phpBB/install/app.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/install/app.php b/phpBB/install/app.php index 09a8faf592..75b28fa092 100644 --- a/phpBB/install/app.php +++ b/phpBB/install/app.php @@ -47,7 +47,6 @@ $phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root $phpbb_installer_container = $phpbb_installer_container_builder ->with_environment('installer') ->without_extensions() - ->without_cache() ->get_container(); // Path to templates From 0f5f62f8db4fe5816329abaca7ad6ff10c8cf749 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 18 Jun 2015 02:12:49 +0200 Subject: [PATCH 20/75] [ticket/13740] Load schema_data.sql from the correct location [ci skip] PHPBB3-13740 --- .../container/services_install_database.yml | 1 + .../install_database/task/add_default_data.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml index 865f2d8ab6..061d3f6c42 100644 --- a/phpBB/config/installer/container/services_install_database.yml +++ b/phpBB/config/installer/container/services_install_database.yml @@ -18,6 +18,7 @@ services: - @installer.helper.iohandler - @installer.helper.container_factory - @language + - %core.root_path% installer.install_database.add_config_settings: class: phpbb\install\module\install_database\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 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); From 02029fe1610e5aa1792f24a4d748c6ed08bfc5fc Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 18 Jun 2015 14:12:56 +0200 Subject: [PATCH 21/75] [ticket/13740] Use DBAL for retrieving DB version PHPBB3-13740 --- phpBB/phpbb/install/helper/database.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index d728c8b93b..38823c1231 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -394,7 +394,7 @@ class database switch ($dbms) { case 'mysqli': - if (version_compare(mysqli_get_server_info($db->get_db_connect_id()), '4.1.3', '<')) + if (version_compare($db->sql_server_info(), '4.1.3', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_MYSQLI', @@ -402,7 +402,7 @@ class database } break; case 'sqlite': - if (version_compare(sqlite_libversion(), '2.8.2', '<')) + if (version_compare($db->sql_server_info(), '2.8.2', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_SQLITE', @@ -410,8 +410,7 @@ class database } break; case 'sqlite3': - $version = \SQLite3::version(); - if (version_compare($version['versionString'], '3.6.15', '<')) + if (version_compare($db->sql_server_info(), '3.6.15', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_SQLITE3', From 08d9d567ca9fb52b18be5d8f709ba7b1699fd34f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 19 Jun 2015 01:26:15 +0200 Subject: [PATCH 22/75] [ticket/13740] Fix database installation PHPBB3-13740 --- .../module/install_database/task/add_default_data.php | 5 +---- .../install/module/install_database/task/create_schema.php | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) 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; } From 524b98e7bd19bff7b12c7ba4c771d6d60d4300a6 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 19 Jun 2015 01:26:42 +0200 Subject: [PATCH 23/75] [ticket/13740] Fix controller class name in service definition PHPBB3-13740 --- .../config/installer/container/services_install_controller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml index 6e6ef4acea..c8d140aa5f 100644 --- a/phpBB/config/installer/container/services_install_controller.yml +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -1,6 +1,6 @@ services: phpbb.installer.controller.welcome: - class: phpbb\install\controller\install_index + class: phpbb\install\controller\installer_index arguments: - @phpbb.installer.controller.helper - @language From 06f4ebce1b1cc8ecd5ddd84f7d2705007a685de3 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 31 May 2015 17:19:42 +0200 Subject: [PATCH 24/75] [ticket/13740] CLI installer and fixes [ci skip] PHPBB3-13740 --- .../container/services_install_console.yml | 44 ++++ .../container/services_installer.yml | 5 + phpBB/install-config.yml | 35 +++ phpBB/install/phpbbcli.php | 68 +++++ phpBB/phpbb/console/application.php | 2 +- .../command/install/config/default_config.php | 103 ++++++++ .../console/command/install/config/show.php | 131 ++++++++++ .../command/install/config/validate.php | 132 ++++++++++ .../console/command/install/install.php | 194 +++++++++++++++ phpBB/phpbb/install/helper/config.php | 10 + .../helper/iohandler/ajax_iohandler.php | 2 + .../helper/iohandler/cli_iohandler.php | 235 ++++++++++++++++++ .../install/helper/iohandler/factory.php | 7 +- .../helper/iohandler/iohandler_base.php | 34 ++- .../helper/iohandler/iohandler_interface.php | 27 +- .../phpbb/install/installer_configuration.php | 140 +++++++++++ .../obtain_data/task/obtain_database_data.php | 2 +- .../install/module/requirements/module.php | 1 + 18 files changed, 1165 insertions(+), 7 deletions(-) create mode 100644 phpBB/config/installer/container/services_install_console.yml create mode 100644 phpBB/install-config.yml create mode 100755 phpBB/install/phpbbcli.php create mode 100644 phpBB/phpbb/install/console/command/install/config/default_config.php create mode 100644 phpBB/phpbb/install/console/command/install/config/show.php create mode 100644 phpBB/phpbb/install/console/command/install/config/validate.php create mode 100644 phpBB/phpbb/install/console/command/install/install.php create mode 100644 phpBB/phpbb/install/helper/iohandler/cli_iohandler.php create mode 100644 phpBB/phpbb/install/installer_configuration.php diff --git a/phpBB/config/installer/container/services_install_console.yml b/phpBB/config/installer/container/services_install_console.yml new file mode 100644 index 0000000000..9a4808b6aa --- /dev/null +++ b/phpBB/config/installer/container/services_install_console.yml @@ -0,0 +1,44 @@ +services: + console.installer.command_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: console.installer.command } + + console.installer.command.install: + class: phpbb\install\console\command\install\install + arguments: + - @language + - @installer.helper.iohandler_factory + - @installer.installer.install + tags: + - { name: console.installer.command } + + console.installer.command.config.default: + class: phpbb\install\console\command\install\config\default_config + arguments: + - @language + - @installer.helper.iohandler_factory + - @installer.installer.install + tags: + - { name: console.installer.command } + + console.installer.command.config.show: + class: phpbb\install\console\command\install\config\show + arguments: + - @language + - @installer.helper.iohandler_factory + - @installer.installer.install + tags: + - { name: console.installer.command } + + + console.installer.command.config.validate: + class: phpbb\install\console\command\install\config\validate + arguments: + - @language + - @installer.helper.iohandler_factory + - @installer.installer.install + tags: + - { name: console.installer.command } diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index ce27ae8abd..4c171f3fe7 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -1,4 +1,5 @@ imports: + - { resource: services_install_console.yml } - { resource: services_install_controller.yml } - { resource: services_install_data.yml } - { resource: services_install_database.yml } @@ -40,6 +41,10 @@ services: - @request - @template + installer.helper.iohandler_cli: + class: phpbb\install\helper\iohandler\cli_iohandler + parent: installer.helper.iohandler_abstract + installer.helper.iohandler: class: phpbb\install\helper\iohandler\iohandler_interface factory: ["@installer.helper.iohandler_factory", get] diff --git a/phpBB/install-config.yml b/phpBB/install-config.yml new file mode 100644 index 0000000000..d49e322a1f --- /dev/null +++ b/phpBB/install-config.yml @@ -0,0 +1,35 @@ +installer: + admin: + name: admin + password: adminadmin + email: admin@example.org + + board: + lang: en + name: My Board + description: My amazing new phpBB board + + database: + dbms: sqlite3 + dbhost: /tmp/phpbb.sqlite3 + dbport: ~ + dbuser: ~ + dbpasswd: ~ + dbname: ~ + table_prefix: phpbb_ + + email: + enabled: false + smtp_delivery : ~ + smtp_host: ~ + smtp_auth: ~ + smtp_user: ~ + smtp_pass: ~ + + server: + cookie_secure: false + server_protocol: http:// + force_server_vars: false + server_name: localhost + server_port: 80 + script_path: / diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php new file mode 100755 index 0000000000..20a202f584 --- /dev/null +++ b/phpBB/install/phpbbcli.php @@ -0,0 +1,68 @@ +#!/usr/bin/env php + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Input\ArgvInput; + +if (php_sapi_name() !== 'cli') +{ + echo 'This program must be run from the command line.' . PHP_EOL; + exit(1); +} + +define('IN_PHPBB', true); +define('IN_INSTALL', true); +define('PHPBB_ENVIRONMENT', 'production'); +$phpbb_root_path = __DIR__ . '/../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +// +// Let's do the common.php logic +// +require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); +require($phpbb_root_path . 'includes/functions_user.' . $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'); + +$phpbb_installer_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); +$phpbb_installer_container = $phpbb_installer_container_builder + ->with_environment('installer') + ->without_extensions() + ->without_cache() + ->get_container(); + +/** @var \phpbb\filesystem\filesystem $phpbb_filesystem */ +$phpbb_filesystem = $phpbb_installer_container->get('filesystem'); + +/** @var \phpbb\language\language $language */ +$language = $phpbb_installer_container->get('language'); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting', 'cli')); + +$application = new \phpbb\console\application('phpBB Installer', PHPBB_VERSION, $language); +$application->register_container_commands($phpbb_installer_container->get('console.installer.command_collection')); +$application->run($input); diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index bc4897af18..0943e8a4b8 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -35,7 +35,7 @@ class application extends \Symfony\Component\Console\Application * @param string $version The version of the application * @param \phpbb\user $user The user which runs the application (used for translation) */ - public function __construct($name, $version, \phpbb\user $user) + public function __construct($name, $version, $user) { $this->user = $user; diff --git a/phpBB/phpbb/install/console/command/install/config/default_config.php b/phpBB/phpbb/install/console/command/install/config/default_config.php new file mode 100644 index 0000000000..75c9f94901 --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/config/default_config.php @@ -0,0 +1,103 @@ + +* @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\console\command\install\config; + +use phpbb\language\language; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Yaml\Yaml; + +class default_config extends \phpbb\console\command\command +{ + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + */ + public function __construct(language $language) + { + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install:config:default') + ; + } + + /** + * Display the default configuration + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $default_config = <<writeln($default_config); + } +} diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php new file mode 100644 index 0000000000..4155440fc3 --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/config/show.php @@ -0,0 +1,131 @@ + +* @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\console\command\install\config; + +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class show extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + */ + public function __construct(language $language, factory $factory, installer $installer) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install:config:show') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_SHOW_CONFIG')) + ; + } + + /** + * Show the validated configuration + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $config_file = $input->getArgument('config-file'); + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + + return; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message('INVALID_YAML_FILE'); + + return; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $config = $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return; + } + + $iohandler->add_log_message(Yaml::dump(array('installer' => $config), 10, 4, true, false)); + } +} diff --git a/phpBB/phpbb/install/console/command/install/config/validate.php b/phpBB/phpbb/install/console/command/install/config/validate.php new file mode 100644 index 0000000000..19b6f99a8b --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/config/validate.php @@ -0,0 +1,132 @@ + +* @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\console\command\install\config; + +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class validate extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + */ + public function __construct(language $language, factory $factory, installer $installer) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install:config:validate') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_VALIDATE_CONFIG')) + ; + } + + /** + * Validate the configuration file + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $config_file = $input->getArgument('config-file'); + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + + return 1; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message('INVALID_YAML_FILE'); + + return 1; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $config = $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return 1; + } + + $iohandler->add_success_message('CONFIGURATION_VALID'); + return 0; + } +} diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php new file mode 100644 index 0000000000..d3f6d363f8 --- /dev/null +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -0,0 +1,194 @@ + +* @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\console\command\install; + +use phpbb\install\exception\installer_exception; +use phpbb\install\helper\iohandler\cli_iohandler; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\installer; +use phpbb\install\installer_configuration; +use phpbb\language\language; +use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +class install extends \phpbb\console\command\command +{ + /** + * @var factory + */ + protected $iohandler_factory; + + /** + * @var installer + */ + protected $installer; + + /** + * @var language + */ + protected $language; + + /** + * Constructor + * + * @param language $language + * @param factory $factory + * @param installer $installer + */ + public function __construct(language $language, factory $factory, installer $installer) + { + $this->iohandler_factory = $factory; + $this->installer = $installer; + $this->language = $language; + + parent::__construct(new \phpbb\user($language, 'datetime')); + } + + /** + * + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('install') + ->addArgument( + 'config-file', + InputArgument::REQUIRED, + $this->language->lang('CLI_CONFIG_FILE')) + ->setDescription($this->language->lang('CLI_INSTALL_BOARD')) + ; + } + + /** + * Executes the command install. + * + * Install the board + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // @todo check that phpBB is not already installed + + $this->iohandler_factory->set_environment('cli'); + + /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + $iohandler = $this->iohandler_factory->get(); + $style = new SymfonyStyle($input, $output); + $iohandler->set_style($style, $output); + + $this->installer->set_iohandler($iohandler); + + $config_file = $input->getArgument('config-file'); + + if (!is_file($config_file)) + { + $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + + return; + } + + try + { + $config = Yaml::parse(file_get_contents($config_file), true, false); + } + catch (ParseException $e) + { + $iohandler->add_error_message('INVALID_YAML_FILE'); + + return; + } + + $processor = new Processor(); + $configuration = new installer_configuration(); + + try + { + $config = $processor->processConfiguration($configuration, $config); + } + catch (Exception $e) + { + $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); + + return; + } + + $this->register_configuration($iohandler, $config); + + try + { + $this->installer->run(); + } + catch (installer_exception $e) + { + $iohandler->add_error_message($e->getMessage()); + return; + } + } + + /** + * Register the configuration to simulate the forms. + * + * @param cli_iohandler $iohandler + * @param array $config + */ + private function register_configuration(cli_iohandler $iohandler, $config) + { + $iohandler->set_input('admin_name', $config['admin']['name']); + $iohandler->set_input('admin_pass1', $config['admin']['password']); + $iohandler->set_input('admin_pass2', $config['admin']['password']); + $iohandler->set_input('board_email', $config['admin']['email']); + $iohandler->set_input('submit_admin', 'submit'); + + $iohandler->set_input('default_lang', $config['board']['lang']); + $iohandler->set_input('board_name', $config['board']['name']); + $iohandler->set_input('board_description', $config['board']['description']); + $iohandler->set_input('submit_board', 'submit'); + + $iohandler->set_input('dbms', $config['database']['dbms']); + $iohandler->set_input('dbhost', $config['database']['dbhost']); + $iohandler->set_input('dbport', $config['database']['dbport']); + $iohandler->set_input('dbuser', $config['database']['dbuser']); + $iohandler->set_input('dbpasswd', $config['database']['dbpasswd']); + $iohandler->set_input('dbname', $config['database']['dbname']); + $iohandler->set_input('table_prefix', $config['database']['table_prefix']); + $iohandler->set_input('submit_database', 'submit'); + + $iohandler->set_input('email_enable', $config['email']['enabled']); + $iohandler->set_input('smtp_delivery', $config['email']['smtp_delivery']); + $iohandler->set_input('smtp_host', $config['email']['smtp_host']); + $iohandler->set_input('smtp_auth', $config['email']['smtp_auth']); + $iohandler->set_input('smtp_user', $config['email']['smtp_user']); + $iohandler->set_input('smtp_pass', $config['email']['smtp_pass']); + $iohandler->set_input('submit_email', 'submit'); + + $iohandler->set_input('cookie_secure', $config['server']['cookie_secure']); + $iohandler->set_input('server_protocol', $config['server']['server_protocol']); + $iohandler->set_input('force_server_vars', $config['server']['force_server_vars']); + $iohandler->set_input('server_name', $config['server']['server_name']); + $iohandler->set_input('server_port', $config['server']['server_port']); + $iohandler->set_input('script_path', $config['server']['script_path']); + $iohandler->set_input('submit_server', 'submit'); + } +} diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index 5c1348c06d..cf51432332 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -147,6 +147,11 @@ class config */ public function get_time_remaining() { + if ($this->system_data['max_execution_time'] <= 0) + { + return 1; + } + return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time(); } @@ -157,6 +162,11 @@ class config */ public function get_memory_remaining() { + if ($this->system_data['memory_limit'] <= 0) + { + return 1; + } + if (function_exists('memory_get_usage')) { return ($this->system_data['memory_limit'] - memory_get_usage()); diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index 71571fecba..85cb2ca753 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -182,6 +182,7 @@ class ajax_iohandler extends iohandler_base 'errors' => $this->errors, 'warnings' => $this->warnings, 'logs' => $this->logs, + 'success' => $this->success, ); if (!empty($this->form)) @@ -208,6 +209,7 @@ class ajax_iohandler extends iohandler_base $this->errors = array(); $this->warnings = array(); $this->logs = array(); + $this->success = array(); $this->nav_data = array(); if ($this->request_client_refresh) diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php new file mode 100644 index 0000000000..d990f48925 --- /dev/null +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -0,0 +1,235 @@ + + * @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\helper\iohandler; + +use phpbb\install\exception\installer_exception; +use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\OutputStyle; + +/** + * Input-Output handler for the CLI frontend + */ +class cli_iohandler extends iohandler_base +{ + /** + * @var OutputInterface + */ + protected $output; + + /** + * @var OutputStyle + */ + protected $io; + + /** + * @var array + */ + protected $input_values = array(); + + /** + * @var ProgressBar + */ + protected $progress_bar; + + /** + * Set the style and output used to display feedback; + * + * @param OutputStyle $style + */ + public function set_style(OutputStyle $style, OutputInterface $output) + { + $this->io = $style; + $this->output = $output; + } + + /** + * {@inheritdoc} + */ + public function get_input($name, $default, $multibyte = false) + { + $result = $default; + + if (isset($this->input_values[$name])) + { + $result = $this->input_values[$name]; + } + + + if ($multibyte) + { + return utf8_normalize_nfc($result); + } + + return $result; + } + + public function set_input($name, $value) + { + $this->input_values[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function get_server_variable($name, $default = '') + { + return $default; + } + + /** + * {@inheritdoc} + */ + public function get_header_variable($name, $default = '') + { + return $default; + } + + /** + * {@inheritdoc} + */ + public function is_secure() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function add_user_form_group($title, $form) + { + throw new installer_exception('MISSING_DATA'); + } + + /** + * {@inheritdoc} + */ + public function send_response() + { + } + + /** + * {@inheritdoc + */ + public function add_error_message($error_title, $error_description = false) + { + $this->io->newLine(); + + $message = $this->translate_message($error_title, $error_description); + $this->io->error($message['title'] . "\n" . $message['description']); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + /** + * {@inheritdoc + */ + public function add_warning_message($warning_title, $warning_description = false) + { + $this->io->newLine(); + + $message = $this->translate_message($warning_title, $warning_description); + $this->io->warning($message['title'] . "\n" . $message['description']); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + /** + * {@inheritdoc + */ + public function add_log_message($log_title, $log_description = false) + { + if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) + { + $this->output->writeln(sprintf('[%3d/%-3d] ---- %s', $this->current_task_progress, $this->task_progress_count, $this->translate_message($log_title, $log_description)['title'])); + } + } + + /** + * {@inheritdoc + */ + public function add_success_message($error_title, $error_description = false) + { + $this->io->newLine(); + + $message = $this->translate_message($error_title, $error_description); + $this->io->success($message['title'] . "\n" . $message['description']); + + if ($this->progress_bar !== null) + { + $this->io->newLine(2); + $this->progress_bar->display(); + } + } + + public function set_task_count($task_count) + { + parent::set_task_count($task_count); + + if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) + { + $this->progress_bar = $this->io->createProgressBar($task_count); + $this->progress_bar->setFormat( + " %current:3s%/%max:-3s% %bar% %percent:3s%%\n" . + " %message%\n"); + $this->progress_bar->setBarWidth(60); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->progress_bar->setEmptyBarCharacter('░'); // light shade character \u2591 + $this->progress_bar->setProgressCharacter(''); + $this->progress_bar->setBarCharacter('▓'); // dark shade character \u2593 + } + $this->progress_bar->setMessage(''); + $this->io->newLine(2); + $this->progress_bar->start(); + } + } + + public function set_progress($task_lang_key, $task_number) + { + parent::set_progress($task_lang_key, $task_number); + + if ($this->progress_bar !== null) + { + $this->progress_bar->setProgress($this->current_task_progress); + $this->progress_bar->setMessage($this->current_task_name); + } + else + { + $this->output->writeln(sprintf('[%3d/%-3d] %s', $this->current_task_progress, $this->task_progress_count, $this->current_task_name)); + } + } + + /** + * {@inheritdoc} + */ + public function finish_progress($message_lang_key) + { + parent::finish_progress($message_lang_key); + + if ($this->progress_bar !== null) + { + $this->progress_bar->finish(); + $this->progress_bar = null; + } + } +} diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php index 0af75b78ae..7081af06a5 100644 --- a/phpBB/phpbb/install/helper/iohandler/factory.php +++ b/phpBB/phpbb/install/helper/iohandler/factory.php @@ -59,7 +59,7 @@ class factory */ public function get() { - switch ($this->environment) + if ($this->container->has('installer.helper.iohandler_' . $this->environment)) { case 'ajax': return $this->container->get('installer.helper.iohandler_ajax'); @@ -68,9 +68,14 @@ class factory // @todo replace this return $this->container->get('installer.helper.iohandler_ajax'); break; + case 'cli': + return $this->container->get('installer.helper.iohandler_cli'); + break; default: throw new iohandler_not_implemented_exception(); break; } + + throw new iohandler_not_implemented_exception(); } } diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php index f767ecf4e9..006411f1e3 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php @@ -43,6 +43,13 @@ abstract class iohandler_base implements iohandler_interface */ protected $logs; + /** + * Array of success messages + * + * @var array + */ + protected $success; + /** * @var \phpbb\language\language */ @@ -71,6 +78,7 @@ abstract class iohandler_base implements iohandler_interface $this->errors = array(); $this->warnings = array(); $this->logs = array(); + $this->success = array(); $this->task_progress_count = 0; $this->current_task_progress = 0; @@ -111,6 +119,14 @@ abstract class iohandler_base implements iohandler_interface $this->logs[] = $this->translate_message($log_title, $log_description); } + /** + * {@inheritdoc} + */ + public function add_success_message($success_title, $success_description = false) + { + $this->success[] = $this->translate_message($success_title, $success_description); + } + /** * {@inheritdoc} */ @@ -124,11 +140,27 @@ abstract class iohandler_base implements iohandler_interface */ public function set_progress($task_lang_key, $task_number) { + $this->current_task_name = ''; + if (!empty($task_lang_key)) { $this->current_task_name = $this->language->lang($task_lang_key); - $this->current_task_progress = $task_number; } + + $this->current_task_progress = $task_number; + } + + /** + * {@inheritdoc} + */ + public function finish_progress($message_lang_key) + { + if (!empty($message_lang_key)) + { + $this->current_task_name = $this->language->lang($message_lang_key); + } + + $this->current_task_progress = $this->task_progress_count; } /** diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php index c40fea24ce..44b409bb0a 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php @@ -85,7 +85,7 @@ interface iohandler_interface * * @param string|array $warning_title Title of the warning message * @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it), - * or false if the error description is not available + * or false if the warning description is not available */ public function add_warning_message($warning_title, $warning_description = false); @@ -96,11 +96,25 @@ interface iohandler_interface * resolved as printf($param[0], $param[1], ...). * * @param string|array $log_title Title of the log message - * @param string|bool|array $log_description Description of the log (and possibly guidelines to resolve it), - * or false if the error description is not available + * @param string|bool|array $log_description Description of the log, + * or false if the log description is not available */ public function add_log_message($log_title, $log_description = false); + /** + * Adds a success message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $success_title Title of the success message + * @param string|bool|array $success_description Description of the success, + * or false if the success description is not available + * + * @return null + */ + public function add_success_message($success_title, $success_description = false); + /** * Adds a requested data group to the rendering queue * @@ -142,4 +156,11 @@ interface iohandler_interface * @param array $menu_path Array to the navigation elem */ public function set_finished_stage_menu($menu_path); + + /** + * Finish the progress bar + * + * @param string $message_lang_key Language key for the message + */ + public function finish_progress($message_lang_key); } diff --git a/phpBB/phpbb/install/installer_configuration.php b/phpBB/phpbb/install/installer_configuration.php new file mode 100644 index 0000000000..ab02da8686 --- /dev/null +++ b/phpBB/phpbb/install/installer_configuration.php @@ -0,0 +1,140 @@ + +* @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; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class installer_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('installer'); + $rootNode + ->children() + ->arrayNode('admin') + ->children() + ->scalarNode('name')->defaultValue('admin')->cannotBeEmpty()->end() + ->scalarNode('password')->defaultValue('adminadmin')->cannotBeEmpty()->end() + ->scalarNode('email')->defaultValue('admin@example.org')->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('board') + ->children() + ->scalarNode('lang') + ->defaultValue('en') + ->cannotBeEmpty() + ->end() + ->scalarNode('name') + ->defaultValue('My Board') + ->cannotBeEmpty() + ->end() + ->scalarNode('description') + ->defaultValue('My amazing new phpBB board') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('database') + ->children() + ->scalarNode('dbms') + ->defaultValue('sqlite3') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->scalarNode('dbhost') + ->defaultValue(null) + ->end() + ->scalarNode('dbport') + ->defaultValue(null) + ->end() + ->scalarNode('dbuser') + ->defaultValue(null) + ->end() + ->scalarNode('dbpasswd') + ->defaultValue(null) + ->end() + ->scalarNode('dbname') + ->defaultValue(null) + ->end() + ->scalarNode('table_prefix') + ->defaultValue('phpbb_') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->end() + ->end() + ->arrayNode('email') + ->canBeEnabled() + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('smtp_delivery') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('smtp_host') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_auth') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_user') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_pass') + ->defaultValue(null) + ->end() + ->end() + ->end() + ->arrayNode('server') + ->children() + ->booleanNode('cookie_secure') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_protocol') + ->defaultValue('http://') + ->cannotBeEmpty() + ->end() + ->booleanNode('force_server_vars') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_name') + ->defaultValue('localhost') + ->cannotBeEmpty() + ->end() + ->integerNode('server_port') + ->defaultValue(80) + ->min(1) + ->cannotBeEmpty() + ->end() + ->scalarNode('script_path') + ->defaultValue('/') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php index 0c1146d9f5..f0e7f1f686 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php @@ -238,7 +238,7 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in $connect_test = $this->database_helper->check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix); if (is_array($connect_test)) { - foreach ($prefix_valid as $error) + foreach ($connect_test as $error) { $this->io_handler->add_error_message( $error['title'], diff --git a/phpBB/phpbb/install/module/requirements/module.php b/phpBB/phpbb/install/module/requirements/module.php index d87ca15128..208cb5aad6 100644 --- a/phpBB/phpbb/install/module/requirements/module.php +++ b/phpBB/phpbb/install/module/requirements/module.php @@ -14,6 +14,7 @@ namespace phpbb\install\module\requirements; use phpbb\install\exception\user_interaction_required_exception; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; class module extends \phpbb\install\module_base { From 249345d9cc6d6bff380436d6e05f24918d762c0d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 27 Jun 2015 17:10:42 +0200 Subject: [PATCH 25/75] [ticket/13740] Clean up CLI merge [ci skip] PHPBB3-13740 --- .../helper/iohandler/cli_iohandler.php | 21 +++++++++++++++++++ .../install/helper/iohandler/factory.php | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php index d990f48925..f711abe431 100644 --- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -232,4 +232,25 @@ class cli_iohandler extends iohandler_base $this->progress_bar = null; } } + + /** + * {@inheritdoc} + */ + public function request_refresh() + { + } + + /** + * {@inheritdoc} + */ + public function set_active_stage_menu($menu_path) + { + } + + /** + * {@inheritdoc} + */ + public function set_finished_stage_menu($menu_path) + { + } } diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php index 7081af06a5..52d24e49b2 100644 --- a/phpBB/phpbb/install/helper/iohandler/factory.php +++ b/phpBB/phpbb/install/helper/iohandler/factory.php @@ -59,7 +59,7 @@ class factory */ public function get() { - if ($this->container->has('installer.helper.iohandler_' . $this->environment)) + switch ($this->environment) { case 'ajax': return $this->container->get('installer.helper.iohandler_ajax'); From 10f6716566fce9d9c38f3dd99419595b2a1cba4c Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 30 Jun 2015 16:36:34 +0200 Subject: [PATCH 26/75] [ticket/13740] Restore original install folder This reverts commit 934e2821f1cef5e2e21ad6d96f7beb45647ed81c. PHPBB3-13740 --- phpBB/common.php | 2 +- .../convertors/convert_phpbb20.php | 0 .../convertors/functions_phpbb20.php | 0 .../data/confusables.php | 0 .../database_update.php | 2 +- phpBB/{install_old => install}/index.php | 2 +- .../install_convert.php | 0 phpBB/install/install_install.php | 2368 +++++++++++++++++ phpBB/install/install_main.php | 78 + .../install_update.php | 0 phpBB/{install_old => install}/phpinfo.php | 0 phpBB/install/schemas/index.htm | 10 + phpBB/install/schemas/oracle_schema.sql | 37 + phpBB/install/schemas/postgres_schema.sql | 80 + phpBB/install/schemas/schema_data.sql | 821 ++++++ phpBB/{install => install_new}/app.php | 0 phpBB/{install => install_new}/phpbbcli.php | 0 17 files changed, 3397 insertions(+), 3 deletions(-) rename phpBB/{install_old => install}/convertors/convert_phpbb20.php (100%) rename phpBB/{install_old => install}/convertors/functions_phpbb20.php (100%) rename phpBB/{install_old => install}/data/confusables.php (100%) rename phpBB/{install_old => install}/database_update.php (99%) rename phpBB/{install_old => install}/index.php (99%) rename phpBB/{install_old => install}/install_convert.php (100%) create mode 100644 phpBB/install/install_install.php create mode 100644 phpBB/install/install_main.php rename phpBB/{install_old => install}/install_update.php (100%) rename phpBB/{install_old => install}/phpinfo.php (100%) create mode 100644 phpBB/install/schemas/index.htm create mode 100644 phpBB/install/schemas/oracle_schema.sql create mode 100644 phpBB/install/schemas/postgres_schema.sql create mode 100644 phpBB/install/schemas/schema_data.sql rename phpBB/{install => install_new}/app.php (100%) rename phpBB/{install => install_new}/phpbbcli.php (100%) mode change 100755 => 100644 diff --git a/phpBB/common.php b/phpBB/common.php index 38761cfadc..0b898d9553 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -52,7 +52,7 @@ if (!defined('PHPBB_INSTALLED')) } // $phpbb_root_path accounts for redirects from e.g. /adm - $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx; + $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx; // Replace any number of consecutive backslashes and/or slashes with a single slash // (could happen on some proxy setups and/or Windows servers) $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); diff --git a/phpBB/install_old/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php similarity index 100% rename from phpBB/install_old/convertors/convert_phpbb20.php rename to phpBB/install/convertors/convert_phpbb20.php diff --git a/phpBB/install_old/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php similarity index 100% rename from phpBB/install_old/convertors/functions_phpbb20.php rename to phpBB/install/convertors/functions_phpbb20.php diff --git a/phpBB/install_old/data/confusables.php b/phpBB/install/data/confusables.php similarity index 100% rename from phpBB/install_old/data/confusables.php rename to phpBB/install/data/confusables.php diff --git a/phpBB/install_old/database_update.php b/phpBB/install/database_update.php similarity index 99% rename from phpBB/install_old/database_update.php rename to phpBB/install/database_update.php index 853848d637..7ba11c37c4 100644 --- a/phpBB/install_old/database_update.php +++ b/phpBB/install/database_update.php @@ -122,7 +122,7 @@ if (!isset($config['version_update_from'])) $orig_version = $config['version_update_from']; -$user->add_lang(array('common', 'acp/common', 'install', 'migrator')); +$user->add_lang(array('common', 'acp/common', 'old_install', 'migrator')); // Add own hook handler, if present. :o if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) diff --git a/phpBB/install_old/index.php b/phpBB/install/index.php similarity index 99% rename from phpBB/install_old/index.php rename to phpBB/install/index.php index 3559a10971..a1a8fc02b6 100644 --- a/phpBB/install_old/index.php +++ b/phpBB/install/index.php @@ -210,7 +210,7 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r } // And finally, load the relevant language files -$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); +$load_lang_files = array('common', 'acp/common', 'acp/board', 'old_install', 'posting'); $new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; $old_path = $phpbb_root_path . 'language/' . $language . '/'; diff --git a/phpBB/install_old/install_convert.php b/phpBB/install/install_convert.php similarity index 100% rename from phpBB/install_old/install_convert.php rename to phpBB/install/install_convert.php diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php new file mode 100644 index 0000000000..0e223866b1 --- /dev/null +++ b/phpBB/install/install_install.php @@ -0,0 +1,2368 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_INSTALL')) +{ + // Someone has tried to access the file direct. This is not a good idea, so exit + exit; +} + +if (!empty($setmodules)) +{ + // If phpBB is already installed we do not include this module + if (phpbb_check_installation_exists($phpbb_root_path, $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock')) + { + return; + } + + $module[] = array( + 'module_type' => 'install', + 'module_title' => 'INSTALL', + 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_order' => 10, + 'module_subs' => '', + 'module_stages' => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'), + 'module_reqs' => '' + ); +} + +/** +* Installation +*/ +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) + { + global $lang, $template, $language, $phpbb_root_path, $phpEx; + global $phpbb_container, $cache, $phpbb_log, $request, $phpbb_config_php_file; + + switch ($sub) + { + case 'intro': + $phpbb_container->get('cache.driver')->purge(); + + $this->page_title = $lang['SUB_INTRO']; + + $template->assign_vars(array( + 'TITLE' => $lang['INSTALL_INTRO'], + 'BODY' => $lang['INSTALL_INTRO_BODY'], + 'L_SUBMIT' => $lang['NEXT_STEP'], + 'S_LANG_SELECT' => '', + 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language", + )); + + break; + + case 'requirements': + $this->check_server_requirements($mode, $sub); + + break; + + case 'database': + $this->obtain_database_settings($mode, $sub); + + break; + + case 'administrator': + $this->obtain_admin_settings($mode, $sub); + + break; + + case 'config_file': + $this->create_config_file($mode, $sub); + + break; + + case 'advanced': + $this->obtain_advanced_settings($mode, $sub); + + break; + + case 'create_table': + $this->load_schema($mode, $sub); + break; + + case 'final': + // 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_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); + $this->add_modules($mode, $sub); + $this->add_language($mode, $sub); + $this->add_bots($mode, $sub); + $this->email_admin($mode, $sub); + $this->disable_avatars_if_unwritable(); + $this->populate_migrations($phpbb_container->get('ext.manager'), $phpbb_container->get('migrator')); + + // Remove the lock file + @unlink($phpbb_root_path . 'cache/install_lock'); + + break; + } + + $this->tpl_name = 'install_install'; + } + + /** + * Checks that the server we are installing on meets the requirements for running phpBB + */ + function check_server_requirements($mode, $sub) + { + global $lang, $template, $phpbb_root_path, $phpEx, $language; + + $this->page_title = $lang['STAGE_REQUIREMENTS']; + + $template->assign_vars(array( + 'TITLE' => $lang['REQUIREMENTS_TITLE'], + 'BODY' => $lang['REQUIREMENTS_EXPLAIN'], + )); + + $passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false, 'json' => false,); + + // Test for basic PHP settings + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['PHP_SETTINGS'], + 'LEGEND_EXPLAIN' => $lang['PHP_SETTINGS_EXPLAIN'], + )); + + // Test the minimum PHP version + $php_version = PHP_VERSION; + + if (version_compare($php_version, '5.3.9') < 0) + { + $result = '' . $lang['NO'] . ''; + } + else + { + $passed['php'] = true; + + // We also give feedback on whether we're running in safe mode + $result = '' . $lang['YES']; + if (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) == 'on') + { + $result .= ', ' . $lang['PHP_SAFE_MODE']; + } + $result .= ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PHP_VERSION_REQD'], + 'RESULT' => $result, + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + + // Don't check for register_globals on 5.4+ + if (version_compare($php_version, '5.4.0-dev') < 0) + { + // Check for register_globals being enabled + if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on') + { + $result = '' . $lang['NO'] . ''; + } + else + { + $result = '' . $lang['YES'] . ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PHP_REGISTER_GLOBALS'], + 'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + } + + // Check for url_fopen + if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on') + { + $result = '' . $lang['YES'] . ''; + } + else + { + $result = '' . $lang['NO'] . ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PHP_URL_FOPEN_SUPPORT'], + 'TITLE_EXPLAIN' => $lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + + // Check for getimagesize + if (@function_exists('getimagesize')) + { + $passed['imagesize'] = true; + $result = '' . $lang['YES'] . ''; + } + else + { + $result = '' . $lang['NO'] . ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PHP_GETIMAGESIZE_SUPPORT'], + 'TITLE_EXPLAIN' => $lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + + // Check for PCRE UTF-8 support + if (@preg_match('//u', '')) + { + $passed['pcre'] = true; + $result = '' . $lang['YES'] . ''; + } + else + { + $result = '' . $lang['NO'] . ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PCRE_UTF_SUPPORT'], + 'TITLE_EXPLAIN' => $lang['PCRE_UTF_SUPPORT_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + + // Check for php json support + if (@extension_loaded('json')) + { + $passed['json'] = true; + $result = '' . $lang['YES'] . ''; + } + else + { + $result = '' . $lang['NO'] . ''; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['PHP_JSON_SUPPORT'], + 'TITLE_EXPLAIN' => $lang['PHP_JSON_SUPPORT_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + + $passed['mbstring'] = true; + if (@extension_loaded('mbstring')) + { + // Test for available database modules + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['MBSTRING_CHECK'], + 'LEGEND_EXPLAIN' => $lang['MBSTRING_CHECK_EXPLAIN'], + )); + + $checks = array( + array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING), + array('encoding_translation', '!=', 0), + array('http_input', '!=', array('pass', '')), + array('http_output', '!=', array('pass', '')) + ); + + foreach ($checks as $mb_checks) + { + $ini_val = @ini_get('mbstring.' . $mb_checks[0]); + switch ($mb_checks[1]) + { + case '&': + if (intval($ini_val) & $mb_checks[2]) + { + $result = '' . $lang['NO'] . ''; + $passed['mbstring'] = false; + } + else + { + $result = '' . $lang['YES'] . ''; + } + break; + + case '!=': + if (!is_array($mb_checks[2]) && $ini_val != $mb_checks[2] || + is_array($mb_checks[2]) && !in_array($ini_val, $mb_checks[2])) + { + $result = '' . $lang['NO'] . ''; + $passed['mbstring'] = false; + } + else + { + $result = '' . $lang['YES'] . ''; + } + break; + } + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['MBSTRING_' . strtoupper($mb_checks[0])], + 'TITLE_EXPLAIN' => $lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'], + 'RESULT' => $result, + + 'S_EXPLAIN' => true, + 'S_LEGEND' => false, + )); + } + } + + // Test for available database modules + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['PHP_SUPPORTED_DB'], + 'LEGEND_EXPLAIN' => $lang['PHP_SUPPORTED_DB_EXPLAIN'], + )); + + $available_dbms = get_available_dbms(false, true); + $passed['db'] = $available_dbms['ANY_DB_SUPPORT']; + unset($available_dbms['ANY_DB_SUPPORT']); + + foreach ($available_dbms as $db_name => $db_ary) + { + if (!$db_ary['AVAILABLE']) + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DLL_' . strtoupper($db_name)], + 'RESULT' => '' . $lang['UNAVAILABLE'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + else + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DLL_' . strtoupper($db_name)], + 'RESULT' => '' . $lang['AVAILABLE'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + } + + // Test for other modules + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['PHP_OPTIONAL_MODULE'], + 'LEGEND_EXPLAIN' => $lang['PHP_OPTIONAL_MODULE_EXPLAIN'], + )); + + foreach ($this->php_dlls_other as $dll) + { + if (!@extension_loaded($dll)) + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DLL_' . strtoupper($dll)], + 'RESULT' => '' . $lang['UNAVAILABLE'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + continue; + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DLL_' . strtoupper($dll)], + 'RESULT' => '' . $lang['AVAILABLE'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + + // Can we find Imagemagick anywhere on the system? + $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : ''; + + $magic_home = getenv('MAGICK_HOME'); + $img_imagick = ''; + if (empty($magic_home)) + { + $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); + $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH')))); + + $locations = array_merge($path_locations, $locations); + foreach ($locations as $location) + { + // The path might not end properly, fudge it + if (substr($location, -1, 1) !== '/') + { + $location .= '/'; + } + + if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) + { + $img_imagick = str_replace('\\', '/', $location); + continue; + } + } + } + else + { + $img_imagick = str_replace('\\', '/', $magic_home); + } + + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['APP_MAGICK'], + 'RESULT' => ($img_imagick) ? '' . $lang['AVAILABLE'] . ', ' . $img_imagick . '' : '' . $lang['NO_LOCATION'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + + // Check permissions on files/directories we need access to + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['FILES_REQUIRED'], + 'LEGEND_EXPLAIN' => $lang['FILES_REQUIRED_EXPLAIN'], + )); + + $directories = array('cache/', 'files/', 'store/'); + + umask(0); + + $passed['files'] = true; + foreach ($directories as $dir) + { + $exists = $write = false; + + // Try to create the directory if it does not exist + if (!file_exists($phpbb_root_path . $dir)) + { + @mkdir($phpbb_root_path . $dir, 0777); + + 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)) + { + try + { + $this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + $exists = true; + } + + // Now check if it is writable by storing a simple file + $fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb'); + if ($fp !== false) + { + $write = true; + } + @fclose($fp); + + @unlink($phpbb_root_path . $dir . 'test_lock'); + + $passed['files'] = ($exists && $write && $passed['files']) ? true : false; + + $exists = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . ''; + $write = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : ''); + + $template->assign_block_vars('checks', array( + 'TITLE' => $dir, + 'RESULT' => $exists . $write, + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + + // Check permissions on files/directories it would be useful access to + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['FILES_OPTIONAL'], + 'LEGEND_EXPLAIN' => $lang['FILES_OPTIONAL_EXPLAIN'], + )); + + $directories = array('config.' . $phpEx, 'images/avatars/upload/'); + + foreach ($directories as $dir) + { + $write = $exists = true; + if (file_exists($phpbb_root_path . $dir)) + { + if (!$this->filesystem->is_writable($phpbb_root_path . $dir)) + { + $write = false; + } + } + else + { + $write = $exists = false; + } + + $exists_str = ($exists) ? '' . $lang['FOUND'] . '' : '' . $lang['NOT_FOUND'] . ''; + $write_str = ($write) ? ', ' . $lang['WRITABLE'] . '' : (($exists) ? ', ' . $lang['UNWRITABLE'] . '' : ''); + + $template->assign_block_vars('checks', array( + 'TITLE' => $dir, + 'RESULT' => $exists_str . $write_str, + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + + // And finally where do we want to go next (well today is taken isn't it :P) + $s_hidden_fields = ($img_imagick) ? '' : ''; + + $url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&sub=database&language=$language" : $this->p_master->module_url . "?mode=$mode&sub=requirements&language=$language "; + $submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST']; + + $template->assign_vars(array( + 'L_SUBMIT' => $submit, + 'S_HIDDEN' => $s_hidden_fields, + 'U_ACTION' => $url, + )); + } + + /** + * Obtain the information required to connect to the database + */ + function obtain_database_settings($mode, $sub) + { + global $lang, $template, $phpEx; + + $this->page_title = $lang['STAGE_DATABASE']; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + + $connect_test = false; + $error = array(); + $available_dbms = get_available_dbms(false, true); + + // Has the user opted to test the connection? + if (isset($_POST['testdb'])) + { + if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE']) + { + $error[] = $lang['INST_ERR_NO_DB']; + $connect_test = false; + } + else if (!preg_match(get_preg_expression('table_prefix'), $data['table_prefix'])) + { + $error[] = $lang['INST_ERR_DB_INVALID_PREFIX']; + $connect_test = false; + } + else + { + $connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']); + } + + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['DB_CONNECTION'], + 'LEGEND_EXPLAIN' => false, + )); + + if ($connect_test) + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DB_TEST'], + 'RESULT' => '' . $lang['SUCCESSFUL_CONNECT'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + else + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['DB_TEST'], + 'RESULT' => '' . implode('
', $error) . '
', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + } + + if (!$connect_test) + { + // Update the list of available DBMS modules to only contain those which can be used + $available_dbms_temp = array(); + foreach ($available_dbms as $type => $dbms_ary) + { + if (!$dbms_ary['AVAILABLE']) + { + continue; + } + + $available_dbms_temp[$type] = $dbms_ary; + } + + $available_dbms = &$available_dbms_temp; + + // And now for the main part of this page + $data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_'); + + foreach ($this->db_config_options as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang[$vars]) + ); + + continue; + } + + $options = isset($vars['options']) ? $vars['options'] : ''; + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => $lang[$vars['lang']], + 'S_EXPLAIN' => $vars['explain'], + 'S_LEGEND' => false, + 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', + 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), + ) + ); + } + } + + // And finally where do we want to go next (well today is taken isn't it :P) + $s_hidden_fields = ($data['img_imagick']) ? '' : ''; + $s_hidden_fields .= ''; + if ($connect_test) + { + foreach ($this->db_config_options as $config_key => $vars) + { + if (!is_array($vars)) + { + continue; + } + $s_hidden_fields .= ''; + } + } + + $url = ($connect_test) ? $this->p_master->module_url . "?mode=$mode&sub=administrator" : $this->p_master->module_url . "?mode=$mode&sub=database"; + $s_hidden_fields .= ($connect_test) ? '' : ''; + + $submit = $lang['NEXT_STEP']; + + $template->assign_vars(array( + 'L_SUBMIT' => $submit, + 'S_HIDDEN' => $s_hidden_fields, + 'U_ACTION' => $url, + )); + } + + /** + * Obtain the administrator's name, password and email address + */ + function obtain_admin_settings($mode, $sub) + { + global $lang, $template, $phpEx; + + $this->page_title = $lang['STAGE_ADMINISTRATOR']; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + + if ($data['dbms'] == '') + { + // Someone's been silly and tried calling this page direct + // So we send them back to the start to do it again properly + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $s_hidden_fields = ($data['img_imagick']) ? '' : ''; + $passed = false; + + $data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language']; + + if (isset($_POST['check'])) + { + $error = array(); + + // Check the entered email address and password + if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email'] == '') + { + $error[] = $lang['INST_ERR_MISSING_DATA']; + } + + if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '') + { + $error[] = $lang['INST_ERR_PASSWORD_MISMATCH']; + } + + // Test against the default username rules + if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3) + { + $error[] = $lang['INST_ERR_USER_TOO_SHORT']; + } + + if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20) + { + $error[] = $lang['INST_ERR_USER_TOO_LONG']; + } + + // Test against the default password rules + if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6) + { + $error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT']; + } + + if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30) + { + $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; + } + + if ($data['board_email'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email'])) + { + $error[] = $lang['INST_ERR_EMAIL_INVALID']; + } + + $template->assign_block_vars('checks', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang['STAGE_ADMINISTRATOR'], + 'LEGEND_EXPLAIN' => false, + )); + + if (!sizeof($error)) + { + $passed = true; + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['ADMIN_TEST'], + 'RESULT' => '' . $lang['TESTS_PASSED'] . '', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + else + { + $template->assign_block_vars('checks', array( + 'TITLE' => $lang['ADMIN_TEST'], + 'RESULT' => '' . implode('
', $error) . '
', + + 'S_EXPLAIN' => false, + 'S_LEGEND' => false, + )); + } + } + + if (!$passed) + { + foreach ($this->admin_config_options as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang[$vars]) + ); + + continue; + } + + $options = isset($vars['options']) ? $vars['options'] : ''; + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => $lang[$vars['lang']], + 'S_EXPLAIN' => $vars['explain'], + 'S_LEGEND' => false, + 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', + 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), + ) + ); + } + } + else + { + foreach ($this->admin_config_options as $config_key => $vars) + { + if (!is_array($vars)) + { + continue; + } + $s_hidden_fields .= ''; + } + } + + $s_hidden_fields .= ($data['img_imagick']) ? '' : ''; + $s_hidden_fields .= ''; + + foreach ($this->db_config_options as $config_key => $vars) + { + if (!is_array($vars)) + { + continue; + } + $s_hidden_fields .= ''; + } + + $submit = $lang['NEXT_STEP']; + + $url = ($passed) ? $this->p_master->module_url . "?mode=$mode&sub=config_file" : $this->p_master->module_url . "?mode=$mode&sub=administrator"; + $s_hidden_fields .= ($passed) ? '' : ''; + + $template->assign_vars(array( + 'L_SUBMIT' => $submit, + 'S_HIDDEN' => $s_hidden_fields, + 'U_ACTION' => $url, + )); + } + + /** + * Writes the config file to disk, or if unable to do so offers alternative methods + */ + function create_config_file($mode, $sub) + { + global $lang, $template, $phpbb_root_path, $phpEx; + + $this->page_title = $lang['STAGE_CONFIG_FILE']; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + + if ($data['dbms'] == '') + { + // Someone's been silly and tried calling this page direct + // So we send them back to the start to do it again properly + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $s_hidden_fields = ($data['img_imagick']) ? '' : ''; + $s_hidden_fields .= ''; + $written = false; + + // Create a list of any PHP modules we wish to have loaded + $available_dbms = get_available_dbms($data['dbms']); + + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb'); + if ($fp === false) + { + // We were unable to create the lock file - abort + $this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__); + } + @fclose($fp); + + @chmod($phpbb_root_path . 'cache/install_lock', 0777); + + // Time to convert the data provided into a config file + $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) && $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; + + if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w'))) + { + // Something went wrong ... so let's try another method + $written = false; + } + + if (!(@fwrite($fp, $config_data))) + { + // Something went wrong ... so let's try another method + $written = false; + } + + @fclose($fp); + + if ($written) + { + // We may revert back to chmod() if we see problems with users not able to change their config.php file directly + try + { + $this->filesystem->phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + if (isset($_POST['dldone'])) + { + // Do a basic check to make sure that the file has been uploaded + // Note that all we check is that the file has _something_ in it + // We don't compare the contents exactly - if they can't upload + // a single file correctly, it's likely they will have other problems.... + if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10) + { + $written = true; + } + } + + $config_options = array_merge($this->db_config_options, $this->admin_config_options); + + foreach ($config_options as $config_key => $vars) + { + if (!is_array($vars)) + { + continue; + } + $s_hidden_fields .= ''; + } + + if (!$written) + { + // OK, so it didn't work let's try the alternatives + + if (isset($_POST['dlconfig'])) + { + // They want a copy of the file to download, so send the relevant headers and dump out the data + header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); + header("Content-disposition: attachment; filename=config.$phpEx"); + echo $config_data; + exit; + } + + // The option to download the config file is always available, so output it here + $template->assign_vars(array( + 'BODY' => $lang['CONFIG_FILE_UNABLE_WRITE'], + 'L_DL_CONFIG' => $lang['DL_CONFIG'], + 'L_DL_CONFIG_EXPLAIN' => $lang['DL_CONFIG_EXPLAIN'], + 'L_DL_DONE' => $lang['DONE'], + 'L_DL_DOWNLOAD' => $lang['DL_DOWNLOAD'], + 'S_HIDDEN' => $s_hidden_fields, + 'S_SHOW_DOWNLOAD' => true, + 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=config_file", + )); + return; + } + else + { + $template->assign_vars(array( + 'BODY' => $lang['CONFIG_FILE_WRITTEN'], + 'L_SUBMIT' => $lang['NEXT_STEP'], + 'S_HIDDEN' => $s_hidden_fields, + 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&sub=advanced", + )); + return; + } + } + + /** + * Provide an opportunity to customise some advanced settings during the install + * in case it is necessary for them to be set to access later + */ + function obtain_advanced_settings($mode, $sub) + { + global $lang, $template, $phpEx, $request; + + $this->page_title = $lang['STAGE_ADVANCED']; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + + if ($data['dbms'] == '') + { + // Someone's been silly and tried calling this page direct + // So we send them back to the start to do it again properly + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $s_hidden_fields = ($data['img_imagick']) ? '' : ''; + $s_hidden_fields .= ''; + + // HTTP_HOST is having the correct browser url in most cases... + $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); + + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') !== false) + { + $server_name = substr($server_name, 0, strpos($server_name, ':')); + } + + $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true; + $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : $server_name; + $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : $request->server('SERVER_PORT', 0); + $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ($request->is_secure() ? 'https://' : 'http://'); + $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : $request->is_secure(); + + if ($data['script_path'] === '') + { + $name = htmlspecialchars_decode($request->server('PHP_SELF')); + if (!$name) + { + $name = htmlspecialchars_decode($request->server('REQUEST_URI')); + } + + // Replace backslashes and doubled slashes (could happen on some proxy setups) + $name = str_replace(array('\\', '//'), '/', $name); + $data['script_path'] = trim(dirname(dirname($name))); + } + + foreach ($this->advanced_config_options as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => $lang[$vars]) + ); + + continue; + } + + $options = isset($vars['options']) ? $vars['options'] : ''; + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => $lang[$vars['lang']], + 'S_EXPLAIN' => $vars['explain'], + 'S_LEGEND' => false, + 'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '', + 'CONTENT' => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options), + ) + ); + } + + $config_options = array_merge($this->db_config_options, $this->admin_config_options); + foreach ($config_options as $config_key => $vars) + { + if (!is_array($vars)) + { + continue; + } + $s_hidden_fields .= ''; + } + + $submit = $lang['NEXT_STEP']; + + $url = $this->p_master->module_url . "?mode=$mode&sub=create_table"; + + $template->assign_vars(array( + 'BODY' => $lang['STAGE_ADVANCED_EXPLAIN'], + 'L_SUBMIT' => $submit, + 'S_HIDDEN' => $s_hidden_fields, + 'U_ACTION' => $url, + )); + } + + /** + * Load the contents of the schema into the database and then alter it based on what has been input during the installation + */ + function load_schema($mode, $sub) + { + global $db, $lang, $template, $phpbb_root_path, $phpEx, $request; + + $this->page_title = $lang['STAGE_CREATE_TABLE']; + $s_hidden_fields = ''; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + + if ($data['dbms'] == '') + { + // Someone's been silly and tried calling this page direct + // So we send them back to the start to do it again properly + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + // HTTP_HOST is having the correct browser url in most cases... + $server_name = strtolower(htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME')))); + $referer = strtolower($request->header('Referer')); + + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') !== false) + { + $server_name = substr($server_name, 0, strpos($server_name, ':')); + } + + $cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : $server_name; + + // Try to come up with the best solution for cookie domain... + if (strpos($cookie_domain, 'www.') === 0) + { + $cookie_domain = str_replace('www.', '.', $cookie_domain); + } + + // If we get here and the extension isn't loaded it should be safe to just go ahead and load it + $available_dbms = get_available_dbms($data['dbms']); + + if (!isset($available_dbms[$data['dbms']])) + { + // Someone's been silly and tried providing a non-existant dbms + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $dbms = $available_dbms[$data['dbms']]['DRIVER']; + + // Instantiate the database + $db = new $dbms(); + $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); + + // NOTE: trigger_error does not work here. + $db->sql_return_on_error(true); + + // If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;) + if ($data['dbms'] == 'mysql') + { + if (version_compare($db->sql_server_info(true), '4.1.3', '>=')) + { + $available_dbms[$data['dbms']]['SCHEMA'] .= '_41'; + } + else + { + $available_dbms[$data['dbms']]['SCHEMA'] .= '_40'; + } + } + + // Ok we have the db info go ahead and read in the relevant schema + // and work on building the table + $dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql'; + + // How should we treat this schema? + $delimiter = $available_dbms[$data['dbms']]['DELIM']; + + if (file_exists($dbms_schema)) + { + $sql_query = @file_get_contents($dbms_schema); + $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query); + $sql_query = phpbb_remove_comments($sql_query); + $sql_query = split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + // Ignore errors when the functions or types already exist + // to allow installing phpBB twice in the same database with + // a different prefix + $db->sql_query($sql); + } + unset($sql_query); + } + + // Ok we have the db info go ahead and work on building the table + if (file_exists('schemas/schema.json')) + { + $db_table_schema = @file_get_contents('schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + } + else + { + global $phpbb_root_path, $phpEx, $table_prefix; + $table_prefix = 'phpbb_'; + + 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($phpbb_root_path . 'includes/constants.' . $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(); + $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(); + } + + 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', $data['table_prefix'] . 'config'); + } + + $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( + $data['table_prefix'] . substr($table_name, 6), + $table_data + ); + } + + // Ok tables have been built, let's fill in the basic information + $sql_query = file_get_contents('schemas/schema_data.sql'); + + // Deal with any special comments and characters + switch ($data['dbms']) + { + case 'mssql': + case 'mssql_odbc': + case 'mssqlnative': + $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); + break; + + case 'postgres': + $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query); + break; + + case 'mysql': + case 'mysqli': + $sql_query = str_replace('\\', '\\\\', $sql_query); + break; + } + + // Change prefix + $sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $data['table_prefix'] . '\1 ', $sql_query); + + // Change language strings... + $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query); + + $sql_query = phpbb_remove_comments($sql_query); + $sql_query = split_sql_file($sql_query, ';'); + + foreach ($sql_query as $sql) + { + //$sql = trim(str_replace('|', ';', $sql)); + if (!$db->sql_query($sql)) + { + $error = $db->sql_error(); + $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + } + } + unset($sql_query); + + $current_time = time(); + + $user_ip = $request->server('REMOTE_ADDR') ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : ''; + + if ($data['script_path'] !== '/') + { + // Adjust destination path (no trailing slash) + if (substr($data['script_path'], -1) == '/') + { + $data['script_path'] = substr($data['script_path'], 0, -1); + } + + $data['script_path'] = str_replace(array('../', './'), '', $data['script_path']); + + if ($data['script_path'][0] != '/') + { + $data['script_path'] = '/' . $data['script_path']; + } + } + + // Set default config and post data, this applies to all DB's + $sql_ary = array( + 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) + VALUES ('board_startdate', '$current_time')", + + 'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value) + VALUES ('default_lang', '" . $db->sql_escape($data['default_lang']) . "')", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['img_imagick']) . "' + WHERE config_name = 'img_imagick'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['server_name']) . "' + WHERE config_name = 'server_name'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['server_port']) . "' + WHERE config_name = 'server_port'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['board_email']) . "' + WHERE config_name = 'board_email'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['board_email']) . "' + WHERE config_name = 'board_contact'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($cookie_domain) . "' + WHERE config_name = 'cookie_domain'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($lang['default_dateformat']) . "' + WHERE config_name = 'default_dateformat'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['email_enable']) . "' + WHERE config_name = 'email_enable'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['smtp_delivery']) . "' + WHERE config_name = 'smtp_delivery'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['smtp_host']) . "' + WHERE config_name = 'smtp_host'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['smtp_auth']) . "' + WHERE config_name = 'smtp_auth_method'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['smtp_user']) . "' + WHERE config_name = 'smtp_username'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['smtp_pass']) . "' + WHERE config_name = 'smtp_password'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['cookie_secure']) . "' + WHERE config_name = 'cookie_secure'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['force_server_vars']) . "' + WHERE config_name = 'force_server_vars'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['script_path']) . "' + WHERE config_name = 'script_path'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['server_protocol']) . "' + WHERE config_name = 'server_protocol'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($data['admin_name']) . "' + WHERE config_name = 'newest_username'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'avatar_salt'", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'plupload_salt'", + + 'UPDATE ' . $data['table_prefix'] . "users + SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . $db->sql_escape(phpbb_email_hash($data['board_email'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $data['table_prefix'] . "moderator_cache + SET username = '" . $db->sql_escape($data['admin_name']) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $data['table_prefix'] . "forums + SET forum_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' + WHERE forum_last_poster_name = 'Admin'", + + 'UPDATE ' . $data['table_prefix'] . "topics + SET topic_first_poster_name = '" . $db->sql_escape($data['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "' + WHERE topic_first_poster_name = 'Admin' + OR topic_last_poster_name = 'Admin'", + + 'UPDATE ' . $data['table_prefix'] . "users + SET user_regdate = $current_time", + + 'UPDATE ' . $data['table_prefix'] . "posts + SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'", + + 'UPDATE ' . $data['table_prefix'] . "topics + SET topic_time = $current_time, topic_last_post_time = $current_time", + + 'UPDATE ' . $data['table_prefix'] . "forums + SET forum_last_post_time = $current_time", + + 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($db->sql_server_info(true)) . "' + WHERE config_name = 'dbms_version'", + ); + + if (@extension_loaded('gd')) + { + $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = 'core.captcha.plugins.gd' + WHERE config_name = 'captcha_plugin'"; + + $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config + SET config_value = '1' + WHERE config_name = 'captcha_gd'"; + } + + $ref = substr($referer, strpos($referer, '://') + 3); + + if (!(stripos($ref, $server_name) === 0)) + { + $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config + 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 ' . $data['table_prefix'] . "config + SET config_value = '" . $db->sql_escape($cookie_name) . "' + WHERE config_name = 'cookie_name'"; + + foreach ($sql_ary as $sql) + { + //$sql = trim(str_replace('|', ';', $sql)); + + if (!$db->sql_query($sql)) + { + $error = $db->sql_error(); + $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); + } + } + + $submit = $lang['NEXT_STEP']; + + $url = $this->p_master->module_url . "?mode=$mode&sub=final"; + + $template->assign_vars(array( + 'BODY' => $lang['STAGE_CREATE_TABLE_EXPLAIN'], + 'L_SUBMIT' => $submit, + 'S_HIDDEN' => build_hidden_fields($data), + 'U_ACTION' => $url, + )); + } + + /** + * Build the search index... + */ + function build_search_index($mode, $sub) + { + global $db, $lang, $phpbb_root_path, $phpbb_dispatcher, $phpEx, $config, $auth, $user; + + // Obtain any submitted data + $data = $this->get_submitted_data(); + $table_prefix = $data['table_prefix']; + + // If we get here and the extension isn't loaded it should be safe to just go ahead and load it + $available_dbms = get_available_dbms($data['dbms']); + + if (!isset($available_dbms[$data['dbms']])) + { + // Someone's been silly and tried providing a non-existant dbms + $this->p_master->redirect("index.$phpEx?mode=install"); + } + + $dbms = $available_dbms[$data['dbms']]['DRIVER']; + + // Instantiate the database + $db = new $dbms(); + $db->sql_connect($data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], false, false); + + // NOTE: trigger_error does not work here. + $db->sql_return_on_error(true); + + include_once($phpbb_root_path . 'includes/constants.' . $phpEx); + 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\dummy, CONFIG_TABLE); + + $error = false; + $search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id + FROM ' . POSTS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']); + } + $db->sql_freeresult($result); + } + + /** + * Populate the module tables + */ + function add_modules($mode, $sub) + { + global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager, $config, $phpbb_container; + + // 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'); + } + + $_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 + foreach ($module_classes as $module_class) + { + $categories = array(); + + // Set the module class + $_module->module_class = $module_class; + + foreach ($this->module_categories[$module_class] as $cat_name => $subs) + { + $basename = ''; + // Check if this sub-category has a basename. If it has, use it. + if (isset($this->module_categories_basenames[$cat_name])) + { + $basename = $this->module_categories_basenames[$cat_name]; + } + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => 0, + 'module_class' => $module_class, + 'module_langname' => $cat_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + // Add category + $_module->update_module_data($module_data); + + // Check for last sql error happened + if ($db->get_sql_error_triggered()) + { + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); + } + + $categories[$cat_name]['id'] = (int) $module_data['module_id']; + $categories[$cat_name]['parent_id'] = 0; + + // Create sub-categories... + if (is_array($subs)) + { + foreach ($subs as $level2_name) + { + $basename = ''; + // Check if this sub-category has a basename. If it has, use it. + if (isset($this->module_categories_basenames[$level2_name])) + { + $basename = $this->module_categories_basenames[$level2_name]; + } + $module_data = array( + 'module_basename' => $basename, + 'module_enabled' => 1, + 'module_display' => 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $level2_name, + 'module_mode' => '', + 'module_auth' => '', + ); + + $_module->update_module_data($module_data); + + // Check for last sql error happened + if ($db->get_sql_error_triggered()) + { + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); + } + + $categories[$level2_name]['id'] = (int) $module_data['module_id']; + $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id']; + } + } + } + + // Get the modules we want to add... returned sorted by name + $module_info = $_module->get_module_infos($module_class); + + foreach ($module_info as $module_basename => $fileinfo) + { + foreach ($fileinfo['modes'] as $module_mode => $row) + { + foreach ($row['cat'] as $cat_name) + { + if (!isset($categories[$cat_name])) + { + continue; + } + + $module_data = array( + 'module_basename' => $module_basename, + 'module_enabled' => 1, + 'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1, + 'parent_id' => (int) $categories[$cat_name]['id'], + 'module_class' => $module_class, + 'module_langname' => $row['title'], + 'module_mode' => $module_mode, + 'module_auth' => $row['auth'], + ); + + $_module->update_module_data($module_data); + + // Check for last sql error happened + if ($db->get_sql_error_triggered()) + { + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); + } + } + } + } + + // Move some of the modules around since the code above will put them in the wrong place + if ($module_class == 'acp') + { + // Move main module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_main' + AND module_class = 'acp' + AND module_mode = 'main'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'acp', 'move_up', 4); + + // Move permissions intro screen module 4 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_permissions' + AND module_class = 'acp' + AND module_mode = 'intro'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'acp', 'move_up', 4); + + // Move manage users screen module 5 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_users' + AND module_class = 'acp' + AND module_mode = 'overview'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'acp', 'move_up', 5); + + // Move extension management module 1 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT' + AND module_class = 'acp' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'acp', 'move_up', 1); + } + + if ($module_class == 'mcp') + { + // Move pm report details module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_report_details'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'mcp', 'move_down', 3); + + // Move closed pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports_closed'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'mcp', 'move_down', 3); + + // Move open pm reports module 3 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'mcp_pm_reports' + AND module_class = 'mcp' + AND module_mode = 'pm_reports'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'mcp', 'move_down', 3); + } + + if ($module_class == 'ucp') + { + // Move attachment module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_attachments' + AND module_class = 'ucp' + AND module_mode = 'attachments'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'ucp', 'move_down', 4); + + // Move notification options module 4 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_notifications' + AND module_class = 'ucp' + AND module_mode = 'notification_options'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'ucp', 'move_down', 4); + + // Move OAuth module 5 down... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'ucp_auth_link' + AND module_class = 'ucp' + AND module_mode = 'auth_link'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'ucp', 'move_down', 5); + } + + // And now for the special ones + // (these are modules which appear in multiple categories and thus get added manually to some for more control) + if (isset($this->module_extras[$module_class])) + { + foreach ($this->module_extras[$module_class] as $cat_name => $mods) + { + $sql = 'SELECT module_id, left_id, right_id + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $db->sql_escape($cat_name) . "' + AND module_class = '" . $db->sql_escape($module_class) . "'"; + $result = $db->sql_query_limit($sql, 1); + $row2 = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + foreach ($mods as $mod_name) + { + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $db->sql_escape($mod_name) . "' + AND module_class = '" . $db->sql_escape($module_class) . "' + AND module_basename <> ''"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $module_data = array( + 'module_basename' => $row['module_basename'], + 'module_enabled' => (int) $row['module_enabled'], + 'module_display' => (int) $row['module_display'], + 'parent_id' => (int) $row2['module_id'], + 'module_class' => $row['module_class'], + 'module_langname' => $row['module_langname'], + 'module_mode' => $row['module_mode'], + 'module_auth' => $row['module_auth'], + ); + + $_module->update_module_data($module_data); + + // Check for last sql error happened + if ($db->get_sql_error_triggered()) + { + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); + } + } + } + } + + $_module->remove_cache_file($module_class); + } + } + + /** + * Populate the language tables + */ + function add_language($mode, $sub) + { + global $db, $lang, $phpbb_root_path, $phpEx; + + $dir = @opendir($phpbb_root_path . 'language'); + + if (!$dir) + { + $this->error('Unable to access the language directory', __LINE__, __FILE__); + } + + $installed_languages = array(); + while (($file = readdir($dir)) !== false) + { + $path = $phpbb_root_path . 'language/' . $file; + + if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS') + { + continue; + } + + if (is_dir($path) && file_exists($path . '/iso.txt')) + { + $lang_file = file("$path/iso.txt"); + + $lang_pack = array( + 'lang_iso' => basename($path), + 'lang_dir' => basename($path), + 'lang_english_name' => trim(htmlspecialchars($lang_file[0])), + 'lang_local_name' => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')), + 'lang_author' => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')), + ); + + $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack)); + + $installed_languages[] = (int) $db->sql_nextid(); + if ($db->get_sql_error_triggered()) + { + $error = $db->sql_error($db->get_sql_error_sql()); + $this->p_master->db_error($error['message'], $db->get_sql_error_sql(), __LINE__, __FILE__); + } + } + } + closedir($dir); + + $sql = 'SELECT * + FROM ' . PROFILE_FIELDS_TABLE; + $result = $db->sql_query($sql); + + $profile_fields = array(); + $insert_buffer = new \phpbb\db\sql_insert_buffer($db, PROFILE_LANG_TABLE); + while ($row = $db->sql_fetchrow($result)) + { + foreach ($installed_languages as $lang_id) + { + $insert_buffer->insert(array( + 'field_id' => $row['field_id'], + 'lang_id' => $lang_id, + 'lang_name' => strtoupper(substr($row['field_name'], 6)),// Remove phpbb_ from field name + 'lang_explain' => '', + 'lang_default_value' => '', + )); + } + } + $db->sql_freeresult($result); + + $insert_buffer->flush(); + } + + /** + * Add search robots to the database + */ + function add_bots($mode, $sub) + { + global $db, $lang, $phpbb_root_path, $phpEx, $config; + + // Obtain any submitted data + $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\dummy, CONFIG_TABLE); + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + // If we reach this point then something has gone very wrong + $this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__); + } + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + foreach ($this->bot_list as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $data['default_lang'], + 'user_style' => 1, + 'user_timezone' => 'UTC', + 'user_dateformat' => $lang['default_dateformat'], + 'user_allow_massemail' => 0, + 'user_allow_pm' => 0, + ); + + $user_id = user_add($user_row); + + if (!$user_id) + { + // If we can't insert this user then continue to the next one to avoid inconsistent data + $this->p_master->db_error('Unable to insert bot into users table', $db->get_sql_error_sql(), __LINE__, __FILE__, true); + continue; + } + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_ary[0], + 'bot_ip' => (string) $bot_ary[1], + )); + + $db->sql_query($sql); + } + } + + /** + * Sends an email to the board administrator with their password and some useful links + */ + function email_admin($mode, $sub) + { + global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_log; + + $this->page_title = $lang['STAGE_FINAL']; + + // Obtain any submitted data + $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\dummy, CONFIG_TABLE); + + $user->session_begin(); + $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true); + + // OK, Now that we've reached this point we can be confident that everything + // is installed and working......I hope :) + // So it's time to send an email to the administrator confirming the details + // they entered + + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + + $messenger->template('installed', $data['language']); + + $messenger->to($data['board_email'], $data['admin_name']); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($data['admin_name']), + 'PASSWORD' => htmlspecialchars_decode($data['admin_pass1'])) + ); + + $messenger->send(NOTIFY_EMAIL); + } + + // And finally, add a note to the log + $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'], + 'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'), + 'L_SUBMIT' => $lang['INSTALL_LOGIN'], + 'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&mode=send_statistics'), + )); + } + + /** + * Check if the avatar directory is writable and disable avatars + * if it isn't writable. + */ + function disable_avatars_if_unwritable() + { + global $config, $phpbb_root_path; + + if (!$this->filesystem->is_writable($phpbb_root_path . 'images/avatars/upload/')) + { + $config->set('allow_avatar', 0); + $config->set('allow_avatar_upload', 0); + } + } + + /** + * Populate migrations for the installation + * + * This "installs" all migrations from (root path)/phpbb/db/migrations/data. + * "installs" means it adds all migrations to the migrations table, but does not + * perform any of the actions in the migrations. + * + * @param \phpbb\extension\manager $extension_manager + * @param \phpbb\db\migrator $migrator + */ + function populate_migrations($extension_manager, $migrator) + { + $finder = $extension_manager->get_finder(); + + $migrations = $finder + ->core_path('phpbb/db/migration/data/') + ->get_classes(); + $migrator->populate_migrations($migrations); + } + + /** + * Generate a list of available mail server authentication methods + */ + function mail_auth_select($selected_method) + { + global $lang; + + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + $s_smtp_auth_options = ''; + + foreach ($auth_methods as $method) + { + $s_smtp_auth_options .= ''; + } + + return $s_smtp_auth_options; + } + + /** + * Get submitted data + */ + function get_submitted_data() + { + global $request; + + return array( + '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', ''), + ); + } + + /** + * The information below will be used to build the input fields presented to the user + */ + var $db_config_options = array( + 'legend1' => 'DB_CONFIG', + 'dbms' => array('lang' => 'DBMS', 'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false), + 'dbhost' => array('lang' => 'DB_HOST', 'type' => 'text:25:100', 'explain' => true), + 'dbport' => array('lang' => 'DB_PORT', 'type' => 'text:25:100', 'explain' => true), + 'dbname' => array('lang' => 'DB_NAME', 'type' => 'text:25:100', 'explain' => false), + 'dbuser' => array('lang' => 'DB_USERNAME', 'type' => 'text:25:100', 'explain' => false), + 'dbpasswd' => array('lang' => 'DB_PASSWORD', 'type' => 'password:25:100', 'explain' => false), + 'table_prefix' => array('lang' => 'TABLE_PREFIX', 'type' => 'text:25:100', 'explain' => true), + ); + var $admin_config_options = array( + 'legend1' => 'ADMIN_CONFIG', + 'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false), + 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), + 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), + 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), + 'board_email' => array('lang' => 'CONTACT_EMAIL', 'type' => 'email:25:100', 'explain' => false), + ); + var $advanced_config_options = array( + 'legend1' => 'ACP_EMAIL_SETTINGS', + 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false), + 'smtp_auth' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true), + 'smtp_user' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')), + 'smtp_pass' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true, 'options' => array('autocomplete' => 'off')), + + 'legend2' => 'SERVER_URL_SETTINGS', + 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true), + 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'type' => 'text:10:10', 'explain' => true), + 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true), + 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true), + 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true), + ); + + /** + * Specific PHP modules we may require for certain optional or extended features + */ + var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml'); + + /** + * A list of the web-crawlers/bots we recognise by default + * + * Candidates but not included: + * 'Accoona [Bot]' 'Accoona-AI-Agent/' + * 'ASPseek [Crawler]' 'ASPseek/' + * 'Boitho [Crawler]' 'boitho.com-dc/' + * 'Bunnybot [Bot]' 'powered by www.buncat.de' + * 'Cosmix [Bot]' 'cfetch/' + * 'Crawler Search [Crawler]' '.Crawler-Search.de' + * 'Findexa [Crawler]' 'Findexa Crawler (' + * 'GBSpider [Spider]' 'GBSpider v' + * 'genie [Bot]' 'genieBot (' + * 'Hogsearch [Bot]' 'oegp v. 1.3.0' + * 'Insuranco [Bot]' 'InsurancoBot' + * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' + * 'ISC Systems [Bot]' 'ISC Systems iRc Search' + * 'Jyxobot [Bot]' 'Jyxobot/' + * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' + * 'LinkWalker' 'LinkWalker' + * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' + * 'Naver [Bot]' 'nhnbot@naver.com)' + * 'NetResearchServer' 'NetResearchServer/' + * 'Nimble [Crawler]' 'NimbleCrawler' + * 'Ocelli [Bot]' 'Ocelli/' + * 'Onsearch [Bot]' 'onCHECK-Robot' + * 'Orange [Spider]' 'OrangeSpider' + * 'Sproose [Bot]' 'http://www.sproose.com/bot' + * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' + * 'Tbot [Bot]' 'Tbot/' + * 'Thumbshots [Capture]' 'thumbshots-de-Bot' + * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' + * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' + * 'WissenOnline [Bot]' 'WissenOnline-Bot' + * 'WWWeasel [Bot]' 'WWWeasel Robot v' + * 'Xaldon [Spider]' 'Xaldon WebSpider' + */ + var $bot_list = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); + + /** + * Define the module structure so that we can populate the database without + * needing to hard-code module_id values + */ + var $module_categories = array( + 'acp' => array( + 'ACP_CAT_GENERAL' => array( + 'ACP_QUICK_ACCESS', + 'ACP_BOARD_CONFIGURATION', + 'ACP_CLIENT_COMMUNICATION', + 'ACP_SERVER_CONFIGURATION', + ), + 'ACP_CAT_FORUMS' => array( + 'ACP_MANAGE_FORUMS', + 'ACP_FORUM_BASED_PERMISSIONS', + ), + 'ACP_CAT_POSTING' => array( + 'ACP_MESSAGES', + 'ACP_ATTACHMENTS', + ), + 'ACP_CAT_USERGROUP' => array( + 'ACP_CAT_USERS', + 'ACP_GROUPS', + 'ACP_USER_SECURITY', + ), + 'ACP_CAT_PERMISSIONS' => array( + 'ACP_GLOBAL_PERMISSIONS', + 'ACP_FORUM_BASED_PERMISSIONS', + 'ACP_PERMISSION_ROLES', + 'ACP_PERMISSION_MASKS', + ), + 'ACP_CAT_CUSTOMISE' => array( + 'ACP_STYLE_MANAGEMENT', + 'ACP_EXTENSION_MANAGEMENT', + 'ACP_LANGUAGE', + ), + 'ACP_CAT_MAINTENANCE' => array( + 'ACP_FORUM_LOGS', + 'ACP_CAT_DATABASE', + ), + 'ACP_CAT_SYSTEM' => array( + 'ACP_AUTOMATION', + 'ACP_GENERAL_TASKS', + 'ACP_MODULE_MANAGEMENT', + ), + 'ACP_CAT_DOT_MODS' => null, + ), + 'mcp' => array( + 'MCP_MAIN' => null, + 'MCP_QUEUE' => null, + 'MCP_REPORTS' => null, + 'MCP_NOTES' => null, + 'MCP_WARN' => null, + 'MCP_LOGS' => null, + 'MCP_BAN' => null, + ), + 'ucp' => array( + 'UCP_MAIN' => null, + 'UCP_PROFILE' => null, + 'UCP_PREFS' => null, + 'UCP_PM' => null, + 'UCP_USERGROUPS' => null, + 'UCP_ZEBRA' => null, + ), + ); + var $module_categories_basenames = array( + 'UCP_PM' => 'ucp_pm', + ); + + var $module_extras = array( + 'acp' => array( + 'ACP_QUICK_ACCESS' => array( + 'ACP_MANAGE_USERS', + 'ACP_GROUPS_MANAGE', + 'ACP_MANAGE_FORUMS', + 'ACP_MOD_LOGS', + 'ACP_BOTS', + 'ACP_PHP_INFO', + ), + 'ACP_FORUM_BASED_PERMISSIONS' => array( + 'ACP_FORUM_PERMISSIONS', + 'ACP_FORUM_PERMISSIONS_COPY', + 'ACP_FORUM_MODERATORS', + 'ACP_USERS_FORUM_PERMISSIONS', + 'ACP_GROUPS_FORUM_PERMISSIONS', + ), + ), + ); +} diff --git a/phpBB/install/install_main.php b/phpBB/install/install_main.php new file mode 100644 index 0000000000..d5874dac83 --- /dev/null +++ b/phpBB/install/install_main.php @@ -0,0 +1,78 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ + +if ( !defined('IN_INSTALL') ) +{ + // Someone has tried to access the file direct. This is not a good idea, so exit + exit; +} + +if (!empty($setmodules)) +{ + $module[] = array( + 'module_type' => 'install', + 'module_title' => 'OVERVIEW', + 'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1), + 'module_order' => 0, + 'module_subs' => array('INTRO', 'LICENSE', 'SUPPORT'), + 'module_stages' => '', + 'module_reqs' => '' + ); +} + +/** +* Main Tab - Installation +*/ +class install_main extends module +{ + function install_main(&$p_master) + { + $this->p_master = &$p_master; + } + + function main($mode, $sub) + { + global $lang, $template, $language; + + switch ($sub) + { + case 'intro' : + $title = $lang['SUB_INTRO']; + $body = $lang['OVERVIEW_BODY']; + break; + + case 'license' : + $title = $lang['GPL']; + $body = implode("
\n", file(__DIR__ . '/../docs/LICENSE.txt')); + break; + + case 'support' : + $title = $lang['SUB_SUPPORT']; + $body = $lang['SUPPORT_BODY']; + break; + } + + $this->tpl_name = 'install_main'; + $this->page_title = $title; + + $template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + + 'S_LANG_SELECT' => '', + )); + } +} diff --git a/phpBB/install_old/install_update.php b/phpBB/install/install_update.php similarity index 100% rename from phpBB/install_old/install_update.php rename to phpBB/install/install_update.php diff --git a/phpBB/install_old/phpinfo.php b/phpBB/install/phpinfo.php similarity index 100% rename from phpBB/install_old/phpinfo.php rename to phpBB/install/phpinfo.php diff --git a/phpBB/install/schemas/index.htm b/phpBB/install/schemas/index.htm new file mode 100644 index 0000000000..ee1f723a7d --- /dev/null +++ b/phpBB/install/schemas/index.htm @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql new file mode 100644 index 0000000000..2473d31aab --- /dev/null +++ b/phpBB/install/schemas/oracle_schema.sql @@ -0,0 +1,37 @@ +/* + This first section is optional, however its probably the best method + of running phpBB on Oracle. If you already have a tablespace and user created + for phpBB you can leave this section commented out! + + The first set of statements create a phpBB tablespace and a phpBB user, + make sure you change the password of the phpBB user before you run this script!! +*/ + +/* +CREATE TABLESPACE "PHPBB" + LOGGING + DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora' + SIZE 10M + AUTOEXTEND ON NEXT 10M + MAXSIZE 100M; + +CREATE USER "PHPBB" + PROFILE "DEFAULT" + IDENTIFIED BY "phpbb_password" + DEFAULT TABLESPACE "PHPBB" + QUOTA UNLIMITED ON "PHPBB" + ACCOUNT UNLOCK; + +GRANT ANALYZE ANY TO "PHPBB"; +GRANT CREATE SEQUENCE TO "PHPBB"; +GRANT CREATE SESSION TO "PHPBB"; +GRANT CREATE TABLE TO "PHPBB"; +GRANT CREATE TRIGGER TO "PHPBB"; +GRANT CREATE VIEW TO "PHPBB"; +GRANT "CONNECT" TO "PHPBB"; + +COMMIT; +DISCONNECT; + +CONNECT phpbb/phpbb_password; +*/ diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql new file mode 100644 index 0000000000..65caba8d1c --- /dev/null +++ b/phpBB/install/schemas/postgres_schema.sql @@ -0,0 +1,80 @@ + +BEGIN; + +/* + Domain definition +*/ +CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying; + +/* + Operation Functions +*/ +CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT; +CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT; + +/* + Operators +*/ +CREATE OPERATOR <( + PROCEDURE = _varchar_ci_less_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >, + NEGATOR = >=, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR <=( + PROCEDURE = _varchar_ci_less_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = >=, + NEGATOR = >, + RESTRICT = scalarltsel, + JOIN = scalarltjoinsel); + +CREATE OPERATOR >( + PROCEDURE = _varchar_ci_greater_than, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <, + NEGATOR = <=, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR >=( + PROCEDURE = _varchar_ci_greater_equals, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <=, + NEGATOR = <, + RESTRICT = scalargtsel, + JOIN = scalargtjoinsel); + +CREATE OPERATOR <>( + PROCEDURE = _varchar_ci_not_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = <>, + NEGATOR = =, + RESTRICT = neqsel, + JOIN = neqjoinsel); + +CREATE OPERATOR =( + PROCEDURE = _varchar_ci_equal, + LEFTARG = varchar_ci, + RIGHTARG = varchar_ci, + COMMUTATOR = =, + NEGATOR = <>, + RESTRICT = eqsel, + JOIN = eqjoinsel, + HASHES, + MERGES, + SORT1= <); + +COMMIT; + diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql new file mode 100644 index 0000000000..1f856f016c --- /dev/null +++ b/phpBB/install/schemas/schema_data.sql @@ -0,0 +1,821 @@ +# +# $Id$ +# + +# POSTGRES BEGIN # + +# -- Config +INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_attachments', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_gravatar', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_cdn', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_password_reset', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_live_searches', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_mass_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_img', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_links', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('assets_version', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_flash_pm', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_img_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_method', 'db'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_smilies_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize', '6144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path', 'images/avatars/gallery'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height', '90'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width', '90'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_height', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_width', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path', 'images/avatars/upload'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_salt', 'phpbb_avatar'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact', 'contact@yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact_name', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email', 'address@yourdomain.tld'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig', '{L_CONFIG_BOARD_EMAIL_SIG}'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_hide_emails', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_index_text', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone', 'UTC'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('browser_check', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval', '10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_type', 'd'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cache_gc', '7200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'core.captcha.plugins.nogd'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_fonts', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('contact_admin_form_enable', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name', 'phpbb3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path', '/'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('database_gc', '604800'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('dbms_version', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_unstable', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_mod_rewrite', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_http_auth', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_post', '15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_topic', '10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_forum', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topics_new', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topics_active', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_item_statistics', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval', '15'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('force_server_vars', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_mintime', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_sid_guests', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('forward_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('forwarded_for_check', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('full_folder_action', '2'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_max_word_len', '254'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_min_word_len', '4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_common_thres', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_load_upd', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_max_chars', '14'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_min_chars', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_max_word_len', '254'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_min_word_len', '4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_ts_name', 'simple'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_indexer_mem_limit', '512'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_stopwords', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold', '25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('icons_path', 'images/icons'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_create_thumbnail', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_display_inlined', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_imagick', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_height', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_width', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_height', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_thumb_width', '400'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_width', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_min_thumb_filesize', '12000'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_max', '50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_time', '21600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_use_forwarded', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_enable', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_host', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_password', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_package_size', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_port', '5222'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_use_ssl', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_username', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_email', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_password', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_port', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user_filter', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('legend_sort_groupname', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_track', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_notifications', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_guests', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_onlinetrack', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_unreads_search', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize', '262144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize_pm', '262144'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_name_chars', '20'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_num_search_keywords', '10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_pass_chars', '100'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options', '10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '60000'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_font_size', '200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_img_height', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_img_width', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_urls', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_quote_depth', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_reg_attempts', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars', '255'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_font_size', '200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_height', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_width', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_smilies', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_urls', '5'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_group_default', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PASS_TYPE_ANY'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('plupload_salt', 'phpbb_plupload'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '60'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_expire_days', '30'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_gc', '86400'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size', '250'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', '\phpbb\search\fulltext_native'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_downloads', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_protocol', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length', '3600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc', '{L_CONFIG_SITE_DESC}'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_url', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_text', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename', '{L_CONFIG_SITENAME}'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path', 'images/smilies'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_per_page', '50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_auth_method', 'PLAIN'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port', '25'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_memberships', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_forums', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', '25'); +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.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'); + +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('database_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('last_queue_run', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_colour', 'AA0000', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_id', '2', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_username', '', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_files', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_posts', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_topics', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_users', '1', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('plupload_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed_last_update', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('read_notification_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_indexing_state', '', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('session_last_gc', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('upload_dir_size', '0', 1); +INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('warnings_last_gc', '0', 1); + +# Config text +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_uid', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_bitfield', ''); +INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_flags', '7'); + +# -- Forum related auth options +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_announce', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_attach', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bbcode', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bump', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_delete', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_download', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_edit', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_email', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_flash', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_icons', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_ignoreflood', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_img', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_list', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_noapprove', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_poll', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_post', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_postcount', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_print', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_read', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_reply', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_report', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_search', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_sigs', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_smilies', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_sticky', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_subscribe', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1); +INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_softdelete', 1); + +# -- Moderator related auth options +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_approve', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_chgposter', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_delete', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_edit', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_info', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_lock', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_merge', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_softdelete', 1, 1); + +# -- Global moderator auth option (not a local option) +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_warn', 0, 1); + +# -- Admin related auth options +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_aauth', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_attach', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_authgroups', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_authusers', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_backup', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_ban', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bbcode', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_board', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bots', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_clearlogs', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_email', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_extensions', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_fauth', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forum', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumadd', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumdel', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_group', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_groupadd', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_groupdel', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_icons', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_jabber', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_language', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_mauth', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_modules', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_names', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_phpinfo', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_profile', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_prune', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_ranks', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_reasons', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_roles', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_search', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_server', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_styles', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_switchperm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_uauth', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_user', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_userdel', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_viewauth', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_viewlogs', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_words', 1); + +# -- User related auth options +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_attach', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgavatar', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgcensors', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgemail', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chggrp', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm_group', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_attach', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_bbcode', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_delete', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_download', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_edit', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_emailpm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_flash', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_forward', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_img', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_printpm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_smilies', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_readpm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_savedrafts', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_search', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendemail', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendim', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendpm', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sig', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_viewonline', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_viewprofile', 1); + + +# -- standard auth roles +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_STANDARD', 'ROLE_DESCRIPTION_ADMIN_STANDARD', 'a_', 1); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_FORUM', 'ROLE_DESCRIPTION_ADMIN_FORUM', 'a_', 3); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_USERGROUP', 'ROLE_DESCRIPTION_ADMIN_USERGROUP', 'a_', 4); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_FULL', 'ROLE_DESCRIPTION_ADMIN_FULL', 'a_', 2); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_FULL', 'ROLE_DESCRIPTION_USER_FULL', 'u_', 3); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_STANDARD', 'ROLE_DESCRIPTION_USER_STANDARD', 'u_', 1); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_LIMITED', 'ROLE_DESCRIPTION_USER_LIMITED', 'u_', 2); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NOPM', 'ROLE_DESCRIPTION_USER_NOPM', 'u_', 4); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NOAVATAR', 'ROLE_DESCRIPTION_USER_NOAVATAR', 'u_', 5); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_FULL', 'ROLE_DESCRIPTION_MOD_FULL', 'm_', 3); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_STANDARD', 'ROLE_DESCRIPTION_MOD_STANDARD', 'm_', 1); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_SIMPLE', 'ROLE_DESCRIPTION_MOD_SIMPLE', 'm_', 2); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_QUEUE', 'ROLE_DESCRIPTION_MOD_QUEUE', 'm_', 4); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_FULL', 'ROLE_DESCRIPTION_FORUM_FULL', 'f_', 7); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_STANDARD', 'ROLE_DESCRIPTION_FORUM_STANDARD', 'f_', 5); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NOACCESS', 'ROLE_DESCRIPTION_FORUM_NOACCESS', 'f_', 1); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_READONLY', 'ROLE_DESCRIPTION_FORUM_READONLY', 'f_', 2); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED', 'ROLE_DESCRIPTION_FORUM_LIMITED', 'f_', 3); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_BOT', 'ROLE_DESCRIPTION_FORUM_BOT', 'f_', 9); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_ONQUEUE', 'ROLE_DESCRIPTION_FORUM_ONQUEUE', 'f_', 8); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_POLLS', 'ROLE_DESCRIPTION_FORUM_POLLS', 'f_', 6); +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED_POLLS', 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS', 'f_', 4); + +# 23 +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', 6); + +# 24 +INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10); + +# -- phpbb_styles +INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', 'kNg=', 0, ''); + +# -- Forums +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, ''); + +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48); + +# -- Users / Anonymous user +INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', 0); + +# -- username: Admin password: admin (change this or remove it once everything is working!) +INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', ''); + +# -- Groups +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 2, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5); + +# -- Teampage +INSERT INTO phpbb_teampage (group_id, teampage_name, teampage_position, teampage_parent) VALUES (5, '', 1, 0); +INSERT INTO phpbb_teampage (group_id, teampage_name, teampage_position, teampage_parent) VALUES (4, '', 2, 0); + +# -- User -> Group +INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (2, 2, 0, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (4, 2, 0, 0); +INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (5, 2, 0, 1); + +# -- Ranks +INSERT INTO phpbb_ranks (rank_title, rank_min, rank_special, rank_image) VALUES ('{L_RANKS_SITE_ADMIN_TITLE}', 0, 1, ''); + +# -- Roles data + +# Standard Admin (a_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 1, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option NOT IN ('a_switchperm', 'a_jabber', 'a_phpinfo', 'a_server', 'a_backup', 'a_styles', 'a_clearlogs', 'a_modules', 'a_language', 'a_email', 'a_bots', 'a_search', 'a_aauth', 'a_roles'); + +# Forum admin (a_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 2, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option IN ('a_', 'a_authgroups', 'a_authusers', 'a_fauth', 'a_forum', 'a_forumadd', 'a_forumdel', 'a_mauth', 'a_prune', 'a_uauth', 'a_viewauth', 'a_viewlogs'); + +# User and Groups Admin (a_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 3, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option IN ('a_', 'a_authgroups', 'a_authusers', 'a_ban', 'a_group', 'a_groupadd', 'a_groupdel', 'a_ranks', 'a_uauth', 'a_user', 'a_viewauth', 'a_viewlogs'); + +# Full Admin (a_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 4, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%'; + +# All Features (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 5, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%'; + +# Standard Features (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 6, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_flash', 'u_pm_forward'); + +# Limited Features (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group'); + +# No Private Messages (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_', 'u_chgavatar', 'u_chgcensors', 'u_chgemail', 'u_chgpasswd', 'u_download', 'u_hideonline', 'u_sig', 'u_viewprofile'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_readpm', 'u_sendpm', 'u_masspm', 'u_masspm_group'); + +# No Avatar (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar'); + +# Full Moderator (m_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 10, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%'; + +# Standard Moderator (m_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter'); + +# Simple Moderator (m_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_edit', 'm_info', 'm_report'); + +# Queue Moderator (m_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit'); + +# Full Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%'; + +# Standard Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock'); + +# No Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_'; + +# Read Only Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print'); + +# Limited Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg'); + +# Bot Access (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_print'); + +# On Moderation Queue (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove'); + +# Standard Access + Polls (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_sticky', 'f_user_lock'); + +# Limited Access + Polls (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg'); + +# New Member (u_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group', 'u_chgprofileinfo'); + +# New Member (f_) +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove'); + + +# Permissions + +# GUESTS - u_download and u_search ability +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 1, 0, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option IN ('u_', 'u_download', 'u_search'); + +# Admin user - full user features +INSERT INTO phpbb_acl_users (user_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 0, 0, 5, 0); + +# ADMINISTRATOR Group - full user features +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 0, 0, 5, 0); + +# ADMINISTRATOR Group - standard admin +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 0, 0, 1, 0); + +# REGISTERED and REGISTERED_COPPA having standard user features +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 0, 0, 6, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 0, 0, 6, 0); + +# GLOBAL_MODERATORS having full user features +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 0, 0, 5, 0); + +# GLOBAL_MODERATORS having full global moderator access +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 0, 0, 10, 0); + +# Giving all groups read only access to the first category +# since administrators and moderators are already within the registered users group we do not need to set them here +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (1, 1, 0, 17, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 1, 0, 17, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 1, 0, 17, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 1, 0, 17, 0); + +# Giving access to the first forum + +# guests having read only access +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (1, 2, 0, 17, 0); + +# registered and registered_coppa having standard access +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 2, 0, 15, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 2, 0, 15, 0); + +# global moderators having standard access + polls +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 2, 0, 21, 0); + +# administrators having full forum and full moderator access +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 2, 0, 14, 0); +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 2, 0, 10, 0); + +# Bots having bot access +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 2, 0, 19, 0); + +# NEW MEMBERS are not allowed to send private messages +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 0, 0, 23, 0); + +# NEW MEMBERS on the queue +INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 2, 0, 24, 0); + + +# -- Demo Topic +INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title, topic_visibility) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 1, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, '', 1); + +# -- Demo Post +INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid, post_visibility) VALUES (1, 2, 2, 0, 972086460, '', '127.0.0.1', '{L_TOPICS_TOPIC_TITLE}', '{L_DEFAULT_INSTALL_POST}', '5dd683b17f641daf84c040bfefc58ce9', '', 1); + +# -- Admin posted to the demo topic +INSERT INTO phpbb_topics_posted (user_id, topic_id, topic_posted) VALUES (2, 1, 1); + +# -- Smilies +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 1); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 2); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':grin:', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 3); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 4); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 5); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':smile:', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 6); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (';)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 7); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (';-)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 8); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':wink:', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 9); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 10); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 11); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':sad:', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 12); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 13); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 14); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':eek:', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 15); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':shock:', 'icon_eek.gif', '{L_SMILIES_SHOCKED}', 15, 17, 16); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 17); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 18); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':???:', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 19); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES ('8-)', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 20); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':cool:', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 21); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':lol:', 'icon_lol.gif', '{L_SMILIES_LAUGHING}', 15, 17, 22); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 23); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 24); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':mad:', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 25); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 26); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 27); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':razz:', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 28); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':oops:', 'icon_redface.gif', '{L_SMILIES_EMARRASSED}', 15, 17, 29); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':cry:', 'icon_cry.gif', '{L_SMILIES_CRYING}', 15, 17, 30); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':evil:', 'icon_evil.gif', '{L_SMILIES_EVIL}', 15, 17, 31); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':twisted:', 'icon_twisted.gif', '{L_SMILIES_TWISTED_EVIL}', 15, 17, 32); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':roll:', 'icon_rolleyes.gif', '{L_SMILIES_ROLLING_EYES}', 15, 17, 33); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':!:', 'icon_exclaim.gif', '{L_SMILIES_EXCLAMATION}', 15, 17, 34); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':?:', 'icon_question.gif', '{L_SMILIES_QUESTION}', 15, 17, 35); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':idea:', 'icon_idea.gif', '{L_SMILIES_IDEA}', 15, 17, 36); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':arrow:', 'icon_arrow.gif', '{L_SMILIES_ARROW}', 15, 17, 37); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 38); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 39); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':mrgreen:', 'icon_mrgreen.gif', '{L_SMILIES_MR_GREEN}', 15, 17, 40); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':geek:', 'icon_e_geek.gif', '{L_SMILIES_GEEK}', 17, 17, 41); +INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':ugeek:', 'icon_e_ugeek.gif', '{L_SMILIES_UBER_GEEK}', 17, 18, 42); + +# -- icons +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/fire.gif', 16, 16, 1, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/redface.gif', 16, 16, 9, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/mrgreen.gif', 16, 16, 10, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/heart.gif', 16, 16, 4, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/star.gif', 16, 16, 2, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/radioactive.gif', 16, 16, 3, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/thinking.gif', 16, 16, 5, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/info.gif', 16, 16, 8, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/question.gif', 16, 16, 6, 1); +INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/alert.gif', 16, 16, 7, 1); + +# -- reasons +INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('warez', '{L_REPORT_WAREZ}', 1); +INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('spam', '{L_REPORT_SPAM}', 2); +INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('off_topic', '{L_REPORT_OFF_TOPIC}', 3); +INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('other', '{L_REPORT_OTHER}', 4); + +# -- extension_groups +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('IMAGES', 1, 1, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('ARCHIVES', 0, 1, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('PLAIN_TEXT', 0, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOCUMENTS', 0, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('REAL_MEDIA', 3, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('WINDOWS_MEDIA', 2, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('FLASH_FILES', 5, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('QUICKTIME_MEDIA', 6, 0, 1, '', 0, ''); +INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOWNLOADABLE_FILES', 0, 0, 1, '', 0, ''); + +# -- extensions +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'gif'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'png'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'jpeg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'jpg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tif'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tiff'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tga'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'gtar'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'gz'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'tar'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'zip'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'rar'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'ace'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'torrent'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'tgz'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'bz2'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, '7z'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'txt'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'c'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'h'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'cpp'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'hpp'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'diz'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'csv'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'ini'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'log'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'js'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'xml'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xls'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsx'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsb'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'doc'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'docx'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'docm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dot'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dotx'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dotm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pdf'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ai'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ps'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ppt'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pptx'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pptm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odp'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ods'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odt'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'rtf'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'rm'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'ram'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wma'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wmv'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (7, 'swf'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mov'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4v'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4a'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mp4'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3gp'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3g2'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'qt'); + +INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpeg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg'); +INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm'); + +# Add default profile fields +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_website', 'profilefields.type.url', 'phpbb_website', '40', '12', '255', '', '', '', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 2, 1, 'VISIT_WEBSITE', '%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_aol', 'profilefields.type.string', 'phpbb_aol', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 5, 1, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', ''); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'ymsgr:sendim?%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'http://facebook.com/%s/'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_youtube', 'profilefields.type.string', 'phpbb_youtube', '20', '3', '60', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_CHANNEL', 'http://youtube.com/user/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s'); + +# User Notification Options (for first user) +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, ''); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email'); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, ''); +INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email'); + +# POSTGRES COMMIT # diff --git a/phpBB/install/app.php b/phpBB/install_new/app.php similarity index 100% rename from phpBB/install/app.php rename to phpBB/install_new/app.php diff --git a/phpBB/install/phpbbcli.php b/phpBB/install_new/phpbbcli.php old mode 100755 new mode 100644 similarity index 100% rename from phpBB/install/phpbbcli.php rename to phpBB/install_new/phpbbcli.php From 8bfd29e86dac675919d3572aac3ba5891d9d844e Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 30 Jun 2015 18:54:46 +0200 Subject: [PATCH 27/75] [ticket/13740] Clean up CLI CS PHPBB3-13740 --- .../phpbb/install/helper/iohandler/cli_iohandler.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php index f711abe431..f9c19f6d85 100644 --- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -14,7 +14,6 @@ namespace phpbb\install\helper\iohandler; use phpbb\install\exception\installer_exception; -use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\OutputStyle; @@ -39,7 +38,7 @@ class cli_iohandler extends iohandler_base protected $input_values = array(); /** - * @var ProgressBar + * @var \Symfony\Component\Console\Helper\ProgressBar */ protected $progress_bar; @@ -66,7 +65,6 @@ class cli_iohandler extends iohandler_base $result = $this->input_values[$name]; } - if ($multibyte) { return utf8_normalize_nfc($result); @@ -160,7 +158,8 @@ class cli_iohandler extends iohandler_base { if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) { - $this->output->writeln(sprintf('[%3d/%-3d] ---- %s', $this->current_task_progress, $this->task_progress_count, $this->translate_message($log_title, $log_description)['title'])); + $message = $this->translate_message($log_title, $log_description); + $this->output->writeln(sprintf('[%3d/%-3d] ---- %s', $this->current_task_progress, $this->task_progress_count, $message['title'])); } } @@ -193,11 +192,13 @@ class cli_iohandler extends iohandler_base " %message%\n"); $this->progress_bar->setBarWidth(60); - if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + if (!defined('PHP_WINDOWS_VERSION_BUILD')) + { $this->progress_bar->setEmptyBarCharacter('░'); // light shade character \u2591 $this->progress_bar->setProgressCharacter(''); $this->progress_bar->setBarCharacter('▓'); // dark shade character \u2593 } + $this->progress_bar->setMessage(''); $this->io->newLine(2); $this->progress_bar->start(); From 5ad0af3d3df698f7c749fee1f65962e0ba3cf663 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 7 Jul 2015 19:16:58 +0200 Subject: [PATCH 28/75] [ticket/13740] Fixes and Tests for database helper PHPBB3-13740 --- phpBB/phpbb/install/helper/database.php | 3 +- tests/installer/database_helper_test.php | 151 +++++++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 tests/installer/database_helper_test.php diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 38823c1231..d8751582f7 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -43,7 +43,8 @@ class database */ public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) { - $this->filesystem = $filesystem; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; // DBMS supported by phpBB $this->supported_dbms = array( diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php new file mode 100644 index 0000000000..80c76c004b --- /dev/null +++ b/tests/installer/database_helper_test.php @@ -0,0 +1,151 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_installer_database_helper_test extends phpbb_test_case +{ + /** + * @var phpbb\install\helper\database + */ + private $database_helper; + + /** + * @var phpbb\db\driver\driver_interface + */ + private $dbms_mock; + + public function setUp() + { + $filesystem = new \phpbb\filesystem\filesystem(); + $phpbb_root_path = ''; + $this->database_helper = new \phpbb\install\helper\database($filesystem, $phpbb_root_path); + + // I used oracle because it tolerates the shortest table prefixes + // so it's the simplest to write test cases for + $this->dbms_mock = $this->getMock('\phpbb\db\driver\oracle'); + } + + /** + * @param string $input + * @param string $expected + * + * @dataProvider comment_string_provider + */ + public function test_remove_comments($input, $expected) + { + $this->assertEquals($expected, $this->database_helper->remove_comments($input)); + } + + /** + * @param array $expected + * @param string $sql + * @param string $delimiter + * + * @dataProvider sql_file_string_provider + */ + public function test_split_sql($expected, $sql, $delimiter) + { + $this->assertEquals($expected, $this->database_helper->split_sql_file($sql, $delimiter)); + } + + /** + * @param bool|array $expected + * @param string $test_string + * + * @dataProvider prefix_test_case_provider + */ + public function test_validate_table_prefix($expected, $test_string) + { + $this->assertEquals($expected, $this->database_helper->validate_table_prefix($this->dbms_mock, $test_string)); + } + + // Data provider for the remove comments function + public function comment_string_provider() + { + return array( + array( + 'abc', + 'abc', + ), + array( + 'abc /* asdf */', + "abc \n", + ), + array( + 'abc /* asdf */ f', + "abc \n f", + ), + array( + '# abc', + "\n", + ), + ); + } + + // Data provider for the sql file splitter function + public function sql_file_string_provider() + { + return array( + array( + array( + 'abcd "efgh"' . "\n" . 'qwerty', + 'SELECT * FROM table', + ), + 'abcd "efgh" + qwerty; + SELECT * FROM table', + ';', + ), + array( + array( + 'SELECT * FROM table1', + 'SELECT * FROM table2 WHERE i_am="king"', + ), + 'SELECT * FROM table1; SELECT * FROM table2 WHERE i_am="king"', + ';', + ), + ); + } + + // Test data for prefix test + public function prefix_test_case_provider() + { + return array( + array( + true, + 'phpbb_', + ), + array( + true, + 'phpbb', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + ), + '1hpbb_', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + ), + '?hpbb_', + ), + array( + array( + array('title' => 'INST_ERR_PREFIX_TOO_LONG'), + ), + 'php_bb_', + ), + ); + } +} From 9d54867485300eefe7fcd8e8c2080eb655e713ed Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 8 Jul 2015 01:00:28 +0200 Subject: [PATCH 29/75] [ticket/13740] Test navigation provider PHPBB3-13740 --- tests/installer/navigation_provider_test.php | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/installer/navigation_provider_test.php diff --git a/tests/installer/navigation_provider_test.php b/tests/installer/navigation_provider_test.php new file mode 100644 index 0000000000..5bfce0eba8 --- /dev/null +++ b/tests/installer/navigation_provider_test.php @@ -0,0 +1,34 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_installer_navigation_provider_test extends phpbb_test_case +{ + public function test_navigation() + { + // Mock nav interface + $nav_mock = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface') + ->method('get') + ->willReturn(array('foo' => 'bar')) + ->getMock(); + + // Set up dependencies + $container = new phpbb_mock_container_builder(); + $container->set('foo', $nav_mock); + $nav_collection = new \phpbb\di\service_collection($container); + $nav_collection->add('foo'); + + // Let's test + $nav_provider = new \phpbb\install\helper\navigation\navigation_provider($nav_collection); + $this->assertEquals(array('foo' => 'bar'), $nav_provider->get()); + } +} From 612eead5a9932d459d8b65f9217f895c33b51c39 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 8 Jul 2015 01:27:05 +0200 Subject: [PATCH 30/75] [ticket/13740] Installer config test PHPBB3-13740 --- tests/installer/installer_config_test.php | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/installer/installer_config_test.php diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php new file mode 100644 index 0000000000..d1110bf8f8 --- /dev/null +++ b/tests/installer/installer_config_test.php @@ -0,0 +1,86 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +use phpbb\install\helper\config; + +class phpbb_installer_config_test extends phpbb_test_case +{ + /** + * @var \phpbb\install\helper\config + */ + private $config; + + public function setUp() + { + $phpbb_root_path = __DIR__ . './../../phpBB/'; + $filesystem = $this->getMock('\phpbb\filesystem\filesystem'); + $php_ini = $this->getMockBuilder('\phpbb\php\ini') + ->method('get_int') + ->willReturn(-1) + ->method('get_bytes') + ->willReturn(-1) + ->getMock(); + + $this->config = new config($filesystem, $php_ini, $phpbb_root_path); + } + + /** + * @covers config::set + * @covers config::get + */ + public function test_set_get_var() + { + $this->config->set('foo', 'bar'); + $this->assertEquals('bar', $this->config->get('foo')); + } + + public function test_get_time_remaining() + { + $this->assertGreaterThan(0, $this->config->get_time_remaining()); + } + + public function test_get_memory_remaining() + { + $this->assertGreaterThan(0, $this->config->get_memory_remaining()); + } + + /** + * @covers config::set_finished_task + * @covers config::set_active_module + * @covers config::set_task_progress_count + * @covers config::increment_current_task_progress + * @covers config::get_progress_data + */ + public function test_progress_tracking() + { + $this->config->set_finished_task('foo', 3); + $this->config->set_active_module('bar', 4); + $this->config->set_task_progress_count(10); + $this->config->increment_current_task_progress(); + + $this->assertContains(array('current_task_progress' => 1), $this->config->get_progress_data()); + + $this->config->increment_current_task_progress(2); + + $this->assertEquals(array( + 'last_task_module_index' => 4, + 'last_task_module_name' => 'bar', // Stores the service name of the latest finished module + 'last_task_index' => 3, + 'last_task_name' => 'foo', // Stores the service name of the latest finished task + 'max_task_progress' => 10, + 'current_task_progress' => 3, + ), + $this->config->get_progress_data() + ); + } +} From 1c01252b5d899c488e007659234b6224ac3f4c19 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 8 Jul 2015 13:17:42 +0200 Subject: [PATCH 31/75] [ticket/13740] Fix test stubs PHPBB3-13740 --- tests/installer/database_helper_test.php | 20 ++++---------------- tests/installer/installer_config_test.php | 11 ++++++----- tests/installer/navigation_provider_test.php | 8 ++++---- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php index 80c76c004b..84445c86c5 100644 --- a/tests/installer/database_helper_test.php +++ b/tests/installer/database_helper_test.php @@ -28,10 +28,6 @@ class phpbb_installer_database_helper_test extends phpbb_test_case $filesystem = new \phpbb\filesystem\filesystem(); $phpbb_root_path = ''; $this->database_helper = new \phpbb\install\helper\database($filesystem, $phpbb_root_path); - - // I used oracle because it tolerates the shortest table prefixes - // so it's the simplest to write test cases for - $this->dbms_mock = $this->getMock('\phpbb\db\driver\oracle'); } /** @@ -65,7 +61,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case */ public function test_validate_table_prefix($expected, $test_string) { - $this->assertEquals($expected, $this->database_helper->validate_table_prefix($this->dbms_mock, $test_string)); + $this->assertEquals($expected, $this->database_helper->validate_table_prefix('oracle', $test_string)); } // Data provider for the remove comments function @@ -100,17 +96,9 @@ class phpbb_installer_database_helper_test extends phpbb_test_case 'abcd "efgh"' . "\n" . 'qwerty', 'SELECT * FROM table', ), - 'abcd "efgh" - qwerty; - SELECT * FROM table', - ';', - ), - array( - array( - 'SELECT * FROM table1', - 'SELECT * FROM table2 WHERE i_am="king"', - ), - 'SELECT * FROM table1; SELECT * FROM table2 WHERE i_am="king"', + 'abcd "efgh"' . "\n" . + 'qwerty' . "\n" . + 'SELECT * FROM table', ';', ), ); diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php index d1110bf8f8..6c0079a1ec 100644 --- a/tests/installer/installer_config_test.php +++ b/tests/installer/installer_config_test.php @@ -25,11 +25,11 @@ class phpbb_installer_config_test extends phpbb_test_case $phpbb_root_path = __DIR__ . './../../phpBB/'; $filesystem = $this->getMock('\phpbb\filesystem\filesystem'); $php_ini = $this->getMockBuilder('\phpbb\php\ini') - ->method('get_int') - ->willReturn(-1) - ->method('get_bytes') - ->willReturn(-1) ->getMock(); + $php_ini->method('get_int') + ->willReturn(-1); + $php_ini->method('get_bytes') + ->willReturn(-1); $this->config = new config($filesystem, $php_ini, $phpbb_root_path); } @@ -68,7 +68,8 @@ class phpbb_installer_config_test extends phpbb_test_case $this->config->set_task_progress_count(10); $this->config->increment_current_task_progress(); - $this->assertContains(array('current_task_progress' => 1), $this->config->get_progress_data()); + $progress_data = $this->config->get_progress_data(); + $this->assertEquals(1, $progress_data['current_task_progress']); $this->config->increment_current_task_progress(2); diff --git a/tests/installer/navigation_provider_test.php b/tests/installer/navigation_provider_test.php index 5bfce0eba8..ea39af66cd 100644 --- a/tests/installer/navigation_provider_test.php +++ b/tests/installer/navigation_provider_test.php @@ -16,14 +16,14 @@ class phpbb_installer_navigation_provider_test extends phpbb_test_case public function test_navigation() { // Mock nav interface - $nav_mock = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface') - ->method('get') - ->willReturn(array('foo' => 'bar')) + $nav_stub = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface') ->getMock(); + $nav_stub->method('get') + ->willReturn(array('foo' => 'bar')); // Set up dependencies $container = new phpbb_mock_container_builder(); - $container->set('foo', $nav_mock); + $container->set('foo', $nav_stub); $nav_collection = new \phpbb\di\service_collection($container); $nav_collection->add('foo'); From 794726a464452a6056d8a2ba06c4394767d4c497 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 8 Jul 2015 18:08:50 +0200 Subject: [PATCH 32/75] [ticket/13740] Fix database test PHPBB3-13740 --- tests/installer/database_helper_test.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/installer/database_helper_test.php b/tests/installer/database_helper_test.php index 84445c86c5..d2ebe76ad5 100644 --- a/tests/installer/database_helper_test.php +++ b/tests/installer/database_helper_test.php @@ -18,11 +18,6 @@ class phpbb_installer_database_helper_test extends phpbb_test_case */ private $database_helper; - /** - * @var phpbb\db\driver\driver_interface - */ - private $dbms_mock; - public function setUp() { $filesystem = new \phpbb\filesystem\filesystem(); @@ -61,7 +56,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case */ public function test_validate_table_prefix($expected, $test_string) { - $this->assertEquals($expected, $this->database_helper->validate_table_prefix('oracle', $test_string)); + $this->assertEquals($expected, $this->database_helper->validate_table_prefix('sqlite3', $test_string)); } // Data provider for the remove comments function @@ -97,7 +92,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case 'SELECT * FROM table', ), 'abcd "efgh"' . "\n" . - 'qwerty' . "\n" . + 'qwerty;' . "\n" . 'SELECT * FROM table', ';', ), @@ -130,9 +125,16 @@ class phpbb_installer_database_helper_test extends phpbb_test_case ), array( array( - array('title' => 'INST_ERR_PREFIX_TOO_LONG'), + array('title' => array('INST_ERR_PREFIX_TOO_LONG', 200)), ), - 'php_bb_', + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + ), + array( + array( + array('title' => 'INST_ERR_DB_INVALID_PREFIX'), + array('title' => array('INST_ERR_PREFIX_TOO_LONG', 200)), + ), + '_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', ), ); } From 62103cec300ddadb904862ee2a74d68f71eb32ca Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 15:26:48 +0200 Subject: [PATCH 33/75] [ticket/13740] Use service collection instead of array of task names PHPBB3-13740 --- .../container/services_install_data.yml | 17 +- .../container/services_install_database.yml | 18 ++- .../container/services_install_filesystem.yml | 13 +- .../container/services_install_finish.yml | 15 +- .../services_install_obtain_data.yml | 23 ++- .../services_install_requirements.yml | 15 +- .../container/services_installer.yml | 9 +- .../exception/module_not_found_exception.php | 42 ----- .../resource_limit_reached_exception.php | 19 +++ .../exception/task_not_found_exception.php | 42 ----- phpBB/phpbb/install/helper/config.php | 10 +- phpBB/phpbb/install/installer.php | 148 +++++++----------- phpBB/phpbb/install/module_base.php | 82 +++++----- tests/installer/installer_config_test.php | 10 +- 14 files changed, 221 insertions(+), 242 deletions(-) delete mode 100644 phpBB/phpbb/install/exception/module_not_found_exception.php create mode 100644 phpBB/phpbb/install/exception/resource_limit_reached_exception.php delete mode 100644 phpBB/phpbb/install/exception/task_not_found_exception.php diff --git a/phpBB/config/installer/container/services_install_data.yml b/phpBB/config/installer/container/services_install_data.yml index 5e01be2bce..40885b6ed9 100644 --- a/phpBB/config/installer/container/services_install_data.yml +++ b/phpBB/config/installer/container/services_install_data.yml @@ -8,6 +8,8 @@ services: - @language - %core.root_path% - %core.php_ext% + tags: + - { name: install_data_install, order: 2 } installer.install_data.add_languages: class: phpbb\install\module\install_data\task\add_languages @@ -15,15 +17,28 @@ services: - @installer.helper.iohandler - @installer.helper.container_factory - @language.helper.language_file + tags: + - { name: install_data_install, order: 1 } installer.install_data.add_modules: class: phpbb\install\module\install_data\task\add_modules arguments: - @installer.helper.iohandler - @installer.helper.container_factory + tags: + - { name: install_data_install, order: 3 } + + installer.module.data_install_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: install_data_install } installer.module.data_install: class: phpbb\install\module\install_data\module parent: installer.module_base arguments: - - ["installer.install_data.add_languages", "installer.install_data.add_bots", "installer.install_data.add_modules"] + - @installer.module.data_install_collection + tags: + - { name: installer_install_module, order: 5 } diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml index 061d3f6c42..efbfa82623 100644 --- a/phpBB/config/installer/container/services_install_database.yml +++ b/phpBB/config/installer/container/services_install_database.yml @@ -6,9 +6,10 @@ services: - @installer.helper.database - @filesystem - @installer.helper.iohandler - # - @installer.helper.container_factory - %core.root_path% - %core.php_ext% + tags: + - { name: install_database_install, order: 1 } installer.install_database.add_default_data: class: phpbb\install\module\install_database\task\add_default_data @@ -19,6 +20,8 @@ services: - @installer.helper.container_factory - @language - %core.root_path% + tags: + - { name: install_database_install, order: 2 } installer.install_database.add_config_settings: class: phpbb\install\module\install_database\task\add_config_settings @@ -29,9 +32,20 @@ services: - @installer.helper.container_factory - @language - %core.root_path% + tags: + - { name: install_database_install, order: 3 } + + installer.module.install_database_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: install_database_install } installer.module.database_install: class: phpbb\install\module\install_database\module parent: installer.module_base arguments: - - ["installer.install_database.create_schema", "installer.install_database.add_default_data", "installer.install_database.add_config_settings"] + - @installer.module.install_database_collection + tags: + - { name: installer_install_module, order: 4 } diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index 077b1ccb98..71b2f697e0 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -8,9 +8,20 @@ services: - @installer.helper.iohandler - %core.root_path% - %core.php_ext% + tags: + - { name: install_filesystem_install, order: 1 } + + installer.module.install_filesystem_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: install_filesystem_install } installer.module.filesystem_install: class: phpbb\install\module\install_filesystem\module parent: installer.module_base arguments: - - ["installer.install_filesystem.create_config_file"] + - @installer.module.install_filesystem_collection + tags: + - { name: installer_install_module, order: 3 } diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index d2002f9fd7..f70fefad84 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -3,6 +3,8 @@ services: class: phpbb\install\module\install_finish\task\populate_migrations arguments: - @installer.helper.container_factory + tags: + - { name: install_finish, order: 1 } installer.install_finish.notify_user: class: phpbb\install\module\install_finish\task\notify_user @@ -12,9 +14,20 @@ services: - @installer.helper.iohandler - %core.root_path% - %core.php_ext% + tags: + - { name: install_finish, order: 2 } + + installer.module.install_finish_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: install_finish } installer.module.finish_install: class: phpbb\install\module\install_filesystem\module parent: installer.module_base arguments: - - ["installer.install_finish.populate_migrations", "installer.install_finish.notify_user"] + - @installer.module.install_finish_collection + tags: + - { name: installer_install_module, order: 6 } diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index ecbd3d6d37..b4077c2ecd 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -4,6 +4,8 @@ services: arguments: - @installer.helper.config - @installer.helper.iohandler + tags: + - { name: install_obtain_data, order: 1 } installer.obtain_data.obtain_board_data: class: phpbb\install\module\obtain_data\task\obtain_board_data @@ -11,6 +13,8 @@ services: - @installer.helper.config - @installer.helper.iohandler - @language.helper.language_file + tags: + - { name: install_obtain_data, order: 5 } installer.obtain_data.obtain_database_data: class: phpbb\install\module\obtain_data\task\obtain_database_data @@ -18,28 +22,45 @@ services: - @installer.helper.database - @installer.helper.config - @installer.helper.iohandler + tags: + - { name: install_obtain_data, order: 2 } installer.obtain_data.obtain_email_data: class: phpbb\install\module\obtain_data\task\obtain_email_data arguments: - @installer.helper.config - @installer.helper.iohandler + tags: + - { name: install_obtain_data, order: 4 } installer.obtain_data.obtain_imagick_path: class: phpbb\install\module\obtain_data\task\obtain_imagick_path arguments: - @installer.helper.config + tags: + - { name: install_obtain_data, order: 6 } installer.obtain_data.obtain_server_data: class: phpbb\install\module\obtain_data\task\obtain_server_data arguments: - @installer.helper.config - @installer.helper.iohandler + tags: + - { name: install_obtain_data, order: 3 } + + installer.module.install_obtain_data_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: install_obtain_data } installer.module.obtain_data_install: class: phpbb\install\module\obtain_data\module parent: installer.module_base arguments: - - ["installer.obtain_data.obtain_admin_data", "installer.obtain_data.obtain_database_data", "installer.obtain_data.obtain_server_data", "installer.obtain_data.obtain_email_data", "installer.obtain_data.obtain_board_data", "installer.obtain_data.obtain_imagick_path"] + - @installer.module.install_obtain_data_collection - true - false + tags: + - { name: installer_install_module, order: 2 } diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index c93856837d..af640e0cff 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -6,18 +6,31 @@ services: - @installer.helper.iohandler - %core.root_path% - %core.php_ext% + tags: + - { name: installer_requirements, order: 1 } installer.requirements.check_server_environment: class: phpbb\install\module\requirements\task\check_server_environment arguments: - @installer.helper.database - @installer.helper.iohandler + tags: + - { name: installer_requirements, order: 2 } + + installer.module.install_requirements_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: installer_requirements } # Please note, that the name of this module is hard coded in the installer service installer.module.requirements_install: class: phpbb\install\module\requirements\module parent: installer.module_base arguments: - - ["installer.requirements.check_filesystem", "installer.requirements.check_server_environment"] + - @installer.module.install_requirements_collection - true - false + tags: + - { name: installer_install_module, order: 1 } diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index 4c171f3fe7..4403a1ee51 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -69,7 +69,14 @@ services: - @installer.helper.config - @service_container + installer.install.module_collection: + class: phpbb\di\ordered_service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: installer_install_module } + installer.installer.install: parent: installer.installer.abstract calls: - - [set_modules, [["installer.module.requirements_install", "installer.module.obtain_data_install", "installer.module.filesystem_install", "installer.module.database_install", "installer.module.data_install", "installer.module.finish_install"]]] + - [set_modules, [@installer.install.module_collection]] diff --git a/phpBB/phpbb/install/exception/module_not_found_exception.php b/phpBB/phpbb/install/exception/module_not_found_exception.php deleted file mode 100644 index 9fa03fad6e..0000000000 --- a/phpBB/phpbb/install/exception/module_not_found_exception.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @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\exception; - -class module_not_found_exception extends installer_exception -{ - /** - * @var string - */ - private $module_service_name; - - /** - * Constructor - * - * @param string $module_service_name The name of the missing installer module - */ - public function __construct($module_service_name) - { - $this->module_service_name = $module_service_name; - } - - /** - * Returns the missing installer module's service name - * - * @return string - */ - public function get_module_service_name() - { - return $this->module_service_name; - } -} diff --git a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php new file mode 100644 index 0000000000..0b841747e6 --- /dev/null +++ b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php @@ -0,0 +1,19 @@ + + * @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\exception; + +class resource_limit_reached_exception extends installer_exception +{ + +} diff --git a/phpBB/phpbb/install/exception/task_not_found_exception.php b/phpBB/phpbb/install/exception/task_not_found_exception.php deleted file mode 100644 index 11486cc6b0..0000000000 --- a/phpBB/phpbb/install/exception/task_not_found_exception.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @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\exception; - -class task_not_found_exception extends installer_exception -{ - /** - * @var string - */ - private $task_service_name; - - /** - * Constructor - * - * @param string $task_service_name The name of the missing installer module - */ - public function __construct($task_service_name) - { - $this->task_service_name = $task_service_name; - } - - /** - * Returns the missing installer task's service name - * - * @return string - */ - public function get_task_service_name() - { - return $this->task_service_name; - } -} diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index cf51432332..38fdf960f7 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -87,9 +87,7 @@ class config $this->installer_config = array(); $this->system_data = array(); $this->progress_data = array( - 'last_task_module_index' => 0, 'last_task_module_name' => '', // Stores the service name of the latest finished module - 'last_task_index' => 0, 'last_task_name' => '', // Stores the service name of the latest finished task 'max_task_progress' => 0, 'current_task_progress' => 0, @@ -180,24 +178,20 @@ class config * Saves the latest executed task * * @param string $task_service_name Name of the installer task service - * @param int $task_index Index of the task in the task list array */ - public function set_finished_task($task_service_name, $task_index) + public function set_finished_task($task_service_name) { $this->progress_data['last_task_name'] = $task_service_name; - $this->progress_data['last_task_index'] = $task_index; } /** * Set active module * * @param string $module_service_name Name of the installer module service - * @param int $module_index Index of the module in the module list array */ - public function set_active_module($module_service_name, $module_index) + public function set_active_module($module_service_name) { $this->progress_data['last_task_module_name'] = $module_service_name; - $this->progress_data['last_task_module_index'] = $module_index; } /** diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index d64713e6a3..3e73d90453 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -13,10 +13,10 @@ namespace phpbb\install; +use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\invalid_service_name_exception; -use phpbb\install\exception\module_not_found_exception; -use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; @@ -62,7 +62,7 @@ class installer { $this->install_config = $config; $this->container = $container; - $this->installer_modules = array(); + $this->installer_modules = null; } /** @@ -71,12 +71,10 @@ class installer * Note: The installer will run modules in the order they are set in * the array. * - * @param array $modules Array of module service names + * @param ordered_service_collection $modules Service collection of module service names */ - public function set_modules($modules) + public function set_modules(ordered_service_collection $modules) { - $modules = (array) $modules; - $this->installer_modules = $modules; } @@ -99,7 +97,8 @@ class installer $this->install_config->load_config(); // Recover install progress - $module_index = $this->recover_progress(); + $module_name = $this->recover_progress(); + $module_found = false; // Variable used to check if the install process have been finished $install_finished = false; @@ -111,64 +110,53 @@ class installer $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); - try + if ($this->install_config->get_task_progress_count() === 0) { - if ($this->install_config->get_task_progress_count() === 0) + // Count all tasks in the current installer modules + $step_count = 0; + + /** @var \phpbb\install\module_interface $module */ + foreach ($this->installer_modules as $name => $module) { - // Count all tasks in the current installer modules - $step_count = 0; - foreach ($this->installer_modules as $index => $name) - { - try - { - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($name); - } - catch (InvalidArgumentException $e) - { - throw new module_not_found_exception($name); - } - - $module_step_count = $module->get_step_count(); - $step_count += $module_step_count; - $this->module_step_count[$index] = $module_step_count; - } - - // Set task count - $this->install_config->set_task_progress_count($step_count); + $module_step_count = $module->get_step_count(); + $step_count += $module_step_count; + $this->module_step_count[$name] = $module_step_count; } - // Set up progress information - $this->iohandler->set_task_count( - $this->install_config->get_task_progress_count() - ); + // Set task count + $this->install_config->set_task_progress_count($step_count); + } - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + // Set up progress information + $this->iohandler->set_task_count( + $this->install_config->get_task_progress_count() + ); + + try + { + foreach ($this->installer_modules as $name => $module) { - // Check if module exists, if not the install is completed - if (!isset($this->installer_modules[$module_index])) + // Skip forward until the current task is reached + if (!empty($task_name) && !$module_found) { - $install_finished = true; - break; + if ($module_name === $name) + { + $module_found = true; + } + else + { + continue; + } } // Log progress - $module_service_name = $this->installer_modules[$module_index]; - $this->install_config->set_active_module($module_service_name, $module_index); + $this->install_config->set_active_module($name); - // Get module from container - try + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) { - /** @var \phpbb\install\module_interface $module */ - $module = $this->container->get($module_service_name); + throw new resource_limit_reached_exception(); } - catch (InvalidArgumentException $e) - { - throw new module_not_found_exception($module_service_name); - } - - $module_index++; // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) @@ -178,9 +166,9 @@ class installer $this->iohandler->add_log_message(array( 'SKIP_MODULE', - $module_service_name, + $name, )); - $this->install_config->increment_current_task_progress($this->module_step_count[$module_index - 1]); + $this->install_config->increment_current_task_progress($this->module_step_count[$name]); continue; } @@ -192,40 +180,18 @@ class installer $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); - - // Clear task progress - $this->install_config->set_finished_task('', 0); } - if ($install_finished) - { - // Send install finished message - $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); - } - else - { - $this->iohandler->request_refresh(); - } + // Installation finished + $install_finished = true; } catch (user_interaction_required_exception $e) { // Do nothing } - catch (module_not_found_exception $e) + catch (resource_limit_reached_exception $e) { - $this->iohandler->add_error_message('MODULE_NOT_FOUND', array( - 'MODULE_NOT_FOUND_DESCRIPTION', - $e->get_module_service_name(), - )); - $flush_messages = true; - } - catch (task_not_found_exception $e) - { - $this->iohandler->add_error_message('TASK_NOT_FOUND', array( - 'TASK_NOT_FOUND_DESCRIPTION', - $e->get_task_service_name(), - )); - $flush_messages = true; + // Do nothing } catch (invalid_service_name_exception $e) { @@ -244,6 +210,16 @@ class installer $flush_messages = true; } + if ($install_finished) + { + // Send install finished message + $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); + } + else + { + $this->iohandler->request_refresh(); + } + if ($flush_messages) { $this->iohandler->send_response(); @@ -274,14 +250,6 @@ class installer protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - $module_service = $progress_array['last_task_module_name']; - $module_index = $progress_array['last_task_module_index']; - - if ($this->installer_modules[$module_index] === $module_service) - { - return $module_index; - } - - return 0; + return $progress_array['last_task_module_name']; } } diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 6c0c0e0c30..6099eb35f8 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -13,12 +13,13 @@ namespace phpbb\install; +use phpbb\di\ordered_service_collection; use phpbb\install\exception\invalid_service_name_exception; -use phpbb\install\exception\task_not_found_exception; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use phpbb\install\helper\config; /** * Base class for installer module @@ -48,7 +49,7 @@ abstract class module_base implements module_interface /** * Array of tasks for installer module * - * @var array + * @var ordered_service_collection */ protected $task_collection; @@ -60,11 +61,11 @@ abstract class module_base implements module_interface /** * Installer module constructor * - * @param array $tasks array of installer tasks for installer module - * @param bool $essential flag indicating whether the module is essential or not - * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + * @param ordered_service_collection $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module */ - public function __construct(array $tasks, $essential = true, $allow_progress_bar = true) + public function __construct(ordered_service_collection $tasks, $essential = true, $allow_progress_bar = true) { $this->task_collection = $tasks; $this->is_essential = $essential; @@ -109,26 +110,30 @@ abstract class module_base implements module_interface public function run() { // Recover install progress - $task_index = $this->recover_progress(); + $task_name = $this->recover_progress(); + $name_found = false; - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + /** + * @var string $name ID of the service + * @var \phpbb\install\task_interface $task Task object + */ + foreach ($this->task_collection as $name => $task) { - // Check if task exists - if (!isset($this->task_collection[$task_index])) + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) { - break; + throw new resource_limit_reached_exception(); } - // Recover task to be executed - try + // Skip forward until the next task is reached + if (!empty($task_name) && !$name_found) { - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); - } - catch (InvalidArgumentException $e) - { - throw new task_not_found_exception($this->task_collection[$task_index]); + if ($name === $task_name) + { + $name_found = true; + } + + continue; } // Send progress information @@ -140,17 +145,15 @@ abstract class module_base implements module_interface ); } - // Iterate to the next task - $task_index++; - // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) { $this->iohandler->add_log_message(array( 'SKIP_TASK', - $this->task_collection[$task_index], + $name, )); - $class_name = $this->get_class_from_service_name($this->task_collection[$task_index - 1]); + + $class_name = $this->get_class_from_service_name($name); $this->install_config->increment_current_task_progress($class_name::get_step_count()); continue; } @@ -174,9 +177,11 @@ abstract class module_base implements module_interface $this->iohandler->send_response(); // Log install progress - $current_task_index = $task_index - 1; - $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); + $this->install_config->set_finished_task($name); } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(''); } /** @@ -187,24 +192,7 @@ abstract class module_base implements module_interface protected function recover_progress() { $progress_array = $this->install_config->get_progress_data(); - $last_finished_task_name = $progress_array['last_task_name']; - $last_finished_task_index = $progress_array['last_task_index']; - - // Check if the data is relevant to this module - if (isset($this->task_collection[$last_finished_task_index])) - { - if ($this->task_collection[$last_finished_task_index] === $last_finished_task_name) - { - // Return the task index of the next task - return $last_finished_task_index + 1; - } - } - - // As of now if the progress has not been resolved we assume that it is because - // the task progress belongs to the previous module, - // so just default to the first task - // @todo make module aware of it's service name that way this can be improved - return 0; + return $progress_array['last_task_name']; } /** @@ -214,11 +202,13 @@ abstract class module_base implements module_interface { $step_count = 0; + /** @todo: Fix this foreach ($this->task_collection as $task_service_name) { $class_name = $this->get_class_from_service_name($task_service_name); $step_count += $class_name::get_step_count(); } + */ return $step_count; } diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php index 6c0079a1ec..4b83eb9a8f 100644 --- a/tests/installer/installer_config_test.php +++ b/tests/installer/installer_config_test.php @@ -63,8 +63,8 @@ class phpbb_installer_config_test extends phpbb_test_case */ public function test_progress_tracking() { - $this->config->set_finished_task('foo', 3); - $this->config->set_active_module('bar', 4); + $this->config->set_finished_task('foo'); + $this->config->set_active_module('bar'); $this->config->set_task_progress_count(10); $this->config->increment_current_task_progress(); @@ -74,10 +74,8 @@ class phpbb_installer_config_test extends phpbb_test_case $this->config->increment_current_task_progress(2); $this->assertEquals(array( - 'last_task_module_index' => 4, - 'last_task_module_name' => 'bar', // Stores the service name of the latest finished module - 'last_task_index' => 3, - 'last_task_name' => 'foo', // Stores the service name of the latest finished task + 'last_task_module_name' => 'bar', + 'last_task_name' => 'foo', 'max_task_progress' => 10, 'current_task_progress' => 3, ), From b284e31a9e55e5fc617a229439282cc6d746432a Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 15:29:49 +0200 Subject: [PATCH 34/75] [ticket/13740] Add option to have class names in service collections PHPBB3-13740 --- phpBB/phpbb/di/service_collection.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 82ca9bf679..24f358ca84 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -25,6 +25,11 @@ class service_collection extends \ArrayObject */ protected $container; + /** + * @var array + */ + protected $service_classes; + /** * Constructor * @@ -33,6 +38,7 @@ class service_collection extends \ArrayObject public function __construct(ContainerInterface $container) { $this->container = $container; + $this->service_classes = array(); } /** @@ -76,4 +82,25 @@ class service_collection extends \ArrayObject { $this->offsetSet($name, null); } + + /** + * Add a service's class to the collection + * + * @param string $service_id + * @param string $class + */ + public function add_service_classes($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; + } } From e967f3c1a81eab0f14daf314b7fb1b2001e4d220 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:08:28 +0200 Subject: [PATCH 35/75] [ticket/13740] Fix itteration problems, implement class name aware collections PHPBB3-13740 --- .../container/services_install_data.yml | 2 +- .../container/services_install_database.yml | 2 +- .../container/services_install_filesystem.yml | 2 +- .../container/services_install_finish.yml | 2 +- .../services_install_obtain_data.yml | 2 +- .../services_install_requirements.yml | 2 +- phpBB/phpbb/di/pass/collection_pass.php | 13 ++- phpBB/phpbb/di/service_collection.php | 2 +- phpBB/phpbb/install/installer.php | 6 +- .../install/module/requirements/module.php | 55 ++++++++----- phpBB/phpbb/install/module_base.php | 79 ++++++++----------- phpBB/phpbb/install/task_interface.php | 4 - 12 files changed, 88 insertions(+), 83 deletions(-) diff --git a/phpBB/config/installer/container/services_install_data.yml b/phpBB/config/installer/container/services_install_data.yml index 40885b6ed9..c21f859406 100644 --- a/phpBB/config/installer/container/services_install_data.yml +++ b/phpBB/config/installer/container/services_install_data.yml @@ -33,7 +33,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: install_data_install } + - { name: service_collection, tag: install_data_install, class_name_aware: true } installer.module.data_install: class: phpbb\install\module\install_data\module diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml index efbfa82623..f42fa65239 100644 --- a/phpBB/config/installer/container/services_install_database.yml +++ b/phpBB/config/installer/container/services_install_database.yml @@ -40,7 +40,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: install_database_install } + - { name: service_collection, tag: install_database_install, class_name_aware: true } installer.module.database_install: class: phpbb\install\module\install_database\module diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index 71b2f697e0..cbd8381d02 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -16,7 +16,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: install_filesystem_install } + - { name: service_collection, tag: install_filesystem_install, class_name_aware: true } installer.module.filesystem_install: class: phpbb\install\module\install_filesystem\module diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index f70fefad84..7f4c4d99bf 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -22,7 +22,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: install_finish } + - { name: service_collection, tag: install_finish, class_name_aware: true } installer.module.finish_install: class: phpbb\install\module\install_filesystem\module diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index b4077c2ecd..49c2b99f19 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -53,7 +53,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: install_obtain_data } + - { name: service_collection, tag: install_obtain_data, class_name_aware: true } installer.module.obtain_data_install: class: phpbb\install\module\obtain_data\module diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index af640e0cff..1a6ed634cf 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -22,7 +22,7 @@ services: arguments: - @service_container tags: - - { name: service_collection, tag: installer_requirements } + - { name: service_collection, tag: installer_requirements, class_name_aware: true } # Please note, that the name of this module is hard coded in the installer service installer.module.requirements_install: diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php index ccc1250c20..341f88518d 100644 --- a/phpBB/phpbb/di/pass/collection_pass.php +++ b/phpBB/phpbb/di/pass/collection_pass.php @@ -34,10 +34,12 @@ class collection_pass implements CompilerPassInterface foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) { $definition = $container->getDefinition($id); + $is_ordered_collection = (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection'); + $is_class_name_aware = (isset($data[0]['class_name_aware']) && $data[0]['class_name_aware']); foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) { - if (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection') + if ($is_ordered_collection) { $arguments = array($service_id, $service_data[0]['order']); } @@ -46,6 +48,15 @@ class collection_pass implements CompilerPassInterface $arguments = array($service_id); } + if ($is_class_name_aware) + { + $service_definition = $container->getDefinition($service_id); + $definition->addMethodCall('add_service_class', array( + $service_id, + $service_definition->getClass() + )); + } + $definition->addMethodCall('add', $arguments); } } diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 24f358ca84..8e9175e204 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -89,7 +89,7 @@ class service_collection extends \ArrayObject * @param string $service_id * @param string $class */ - public function add_service_classes($service_id, $class) + public function add_service_class($service_id, $class) { $this->service_classes[$service_id] = $class; } diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 3e73d90453..c1ac2de7f9 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -137,9 +137,9 @@ class installer foreach ($this->installer_modules as $name => $module) { // Skip forward until the current task is reached - if (!empty($task_name) && !$module_found) + if (!$module_found) { - if ($module_name === $name) + if ($module_name === $name || empty($module_name)) { $module_found = true; } @@ -245,7 +245,7 @@ class installer /** * Recover install progress * - * @return int Index of the next installer module to execute + * @return string Index of the next installer module to execute */ protected function recover_progress() { diff --git a/phpBB/phpbb/install/module/requirements/module.php b/phpBB/phpbb/install/module/requirements/module.php index 208cb5aad6..794a35bef5 100644 --- a/phpBB/phpbb/install/module/requirements/module.php +++ b/phpBB/phpbb/install/module/requirements/module.php @@ -13,6 +13,7 @@ namespace phpbb\install\module\requirements; +use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; @@ -23,30 +24,38 @@ class module extends \phpbb\install\module_base $tests_passed = true; // Recover install progress - $task_index = 0; + $task_name = $this->recover_progress(); + $task_found = false; - // Run until there are available resources - while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0) + /** + * @var string $name ID of the service + * @var \phpbb\install\task_interface $task Task object + */ + foreach ($this->task_collection as $name => $task) { - // Check if task exists - if (!isset($this->task_collection[$task_index])) + // Run until there are available resources + if ($this->install_config->get_time_remaining() <= 0 && $this->install_config->get_memory_remaining() <= 0) { - break; + throw new resource_limit_reached_exception(); } - // Recover task to be executed - try + // Skip forward until the next task is reached + if (!$task_found) { - /** @var \phpbb\install\task_interface $task */ - $task = $this->container->get($this->task_collection[$task_index]); - } - catch (InvalidArgumentException $e) - { - throw new task_not_found_exception($this->task_collection[$task_index]); - } + if ($name === $task_name || empty($task_name)) + { + $task_found = true; - // Iterate to the next task - $task_index++; + if ($name === $task_name) + { + continue; + } + } + else + { + continue; + } + } // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) @@ -54,10 +63,18 @@ class module extends \phpbb\install\module_base continue; } + if ($this->allow_progress_bar) + { + $this->install_config->increment_current_task_progress(); + } + $test_result = $task->run(); $tests_passed = ($tests_passed) ? $test_result : false; } + // Module finished, so clear task progress + $this->install_config->set_finished_task(''); + // Check if tests have failed if (!$tests_passed) { @@ -74,10 +91,6 @@ class module extends \phpbb\install\module_base $this->iohandler->send_response(); throw new user_interaction_required_exception(); } - - // Log install progress - $current_task_index = $task_index - 1; - $this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index); } /** diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 6099eb35f8..e0cb862be9 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -14,7 +14,6 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; -use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; @@ -53,6 +52,11 @@ abstract class module_base implements module_interface */ protected $task_collection; + /** + * @var array + */ + protected $task_step_count; + /** * @var bool */ @@ -111,7 +115,7 @@ abstract class module_base implements module_interface { // Recover install progress $task_name = $this->recover_progress(); - $name_found = false; + $task_found = false; /** * @var string $name ID of the service @@ -126,14 +130,21 @@ abstract class module_base implements module_interface } // Skip forward until the next task is reached - if (!empty($task_name) && !$name_found) + if (!$task_found) { - if ($name === $task_name) + if ($name === $task_name || empty($task_name)) { - $name_found = true; - } + $task_found = true; - continue; + if ($name === $task_name) + { + continue; + } + } + else + { + continue; + } } // Send progress information @@ -153,18 +164,22 @@ abstract class module_base implements module_interface $name, )); - $class_name = $this->get_class_from_service_name($name); - $this->install_config->increment_current_task_progress($class_name::get_step_count()); + $this->install_config->increment_current_task_progress($this->task_step_count[$name]); continue; } if ($this->allow_progress_bar) { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself $this->install_config->increment_current_task_progress(); } $task->run(); + // Log install progress + $this->install_config->set_finished_task($name); + // Send progress information if ($this->allow_progress_bar) { @@ -175,9 +190,6 @@ abstract class module_base implements module_interface } $this->iohandler->send_response(); - - // Log install progress - $this->install_config->set_finished_task($name); } // Module finished, so clear task progress @@ -187,7 +199,7 @@ abstract class module_base implements module_interface /** * Returns the next task's index * - * @return int index of the array element of the next task + * @return string index of the array element of the next task */ protected function recover_progress() { @@ -200,43 +212,16 @@ abstract class module_base implements module_interface */ public function get_step_count() { - $step_count = 0; + $task_step_count = 0; + $task_class_names = $this->task_collection->get_service_classes(); - /** @todo: Fix this - foreach ($this->task_collection as $task_service_name) + foreach ($task_class_names as $name => $task_class) { - $class_name = $this->get_class_from_service_name($task_service_name); - $step_count += $class_name::get_step_count(); - } - */ - - return $step_count; - } - - /** - * Returns the name of the class form the service name - * - * @param string $task_service_name Name of the service - * - * @return string Name of the class - * - * @throws invalid_service_name_exception When the service name does not meet the requirements described in task_interface - */ - protected function get_class_from_service_name($task_service_name) - { - $task_service_name_parts = explode('.', $task_service_name); - - if ($task_service_name_parts[0] !== 'installer') - { - throw new invalid_service_name_exception('TASK_SERVICE_INSTALLER_MISSING'); + $step_count = $task_class::get_step_count(); + $task_step_count += $step_count; + $this->task_step_count[$name] = $step_count; } - $class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2]; - if (!class_exists($class_name)) - { - throw new invalid_service_name_exception('TASK_CLASS_NOT_FOUND', array($task_service_name, $class_name)); - } - - return $class_name; + return $task_step_count; } } diff --git a/phpBB/phpbb/install/task_interface.php b/phpBB/phpbb/install/task_interface.php index 14cde23a56..794cb16482 100644 --- a/phpBB/phpbb/install/task_interface.php +++ b/phpBB/phpbb/install/task_interface.php @@ -15,10 +15,6 @@ namespace phpbb\install; /** * Interface for installer tasks - * - * Note: The task service ID must match up with the namespace and class name. - * For example: if your task is located at \phpbb\install\module\module_name\task\task_name - * then the service ID must be installer.module_name.task_name. */ interface task_interface { From 3309c89b05a46a03d09ffef693ed309699a3f59b Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:32:30 +0200 Subject: [PATCH 36/75] [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 1 - phpBB/phpbb/install/module/requirements/module.php | 1 - phpBB/phpbb/install/module_base.php | 1 - 3 files changed, 3 deletions(-) diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index c1ac2de7f9..33b9214cfa 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -21,7 +21,6 @@ use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; class installer { diff --git a/phpBB/phpbb/install/module/requirements/module.php b/phpBB/phpbb/install/module/requirements/module.php index 794a35bef5..79a031bad9 100644 --- a/phpBB/phpbb/install/module/requirements/module.php +++ b/phpBB/phpbb/install/module/requirements/module.php @@ -15,7 +15,6 @@ namespace phpbb\install\module\requirements; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; class module extends \phpbb\install\module_base { diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index e0cb862be9..eb04379f8e 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -18,7 +18,6 @@ use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; /** * Base class for installer module From 4d2212a3c2c8528e6d2adde6c57090bf8e26ba7d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 21:52:36 +0200 Subject: [PATCH 37/75] [ticket/13740] Fix database version comparison PHPBB3-13740 --- phpBB/phpbb/install/helper/database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index d8751582f7..27cb2dc828 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -395,7 +395,7 @@ class database switch ($dbms) { case 'mysqli': - if (version_compare($db->sql_server_info(), '4.1.3', '<')) + if (version_compare($db->sql_server_info(true), '4.1.3', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_MYSQLI', @@ -403,7 +403,7 @@ class database } break; case 'sqlite': - if (version_compare($db->sql_server_info(), '2.8.2', '<')) + if (version_compare($db->sql_server_info(true), '2.8.2', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_SQLITE', @@ -411,7 +411,7 @@ class database } break; case 'sqlite3': - if (version_compare($db->sql_server_info(), '3.6.15', '<')) + if (version_compare($db->sql_server_info(true), '3.6.15', '<')) { $errors[] = array( 'title' => 'INST_ERR_DB_NO_SQLITE3', From e46689a0cdbb418673741234f55e843f1bdd8016 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 23:23:40 +0200 Subject: [PATCH 38/75] [ticket/13740] Remove service container from modules PHPBB3-13740 --- phpBB/config/installer/container/services_installer.yml | 3 +-- phpBB/phpbb/install/installer.php | 4 +--- phpBB/phpbb/install/module_base.php | 9 +++------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index 4403a1ee51..8e19be5c0c 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -60,14 +60,13 @@ services: installer.module_base: abstract: true calls: - - [setup, [@service_container, @installer.helper.config, @installer.helper.iohandler]] + - [setup, [@installer.helper.config, @installer.helper.iohandler]] installer.installer.abstract: class: phpbb\install\installer abstract: true arguments: - @installer.helper.config - - @service_container installer.install.module_collection: class: phpbb\di\ordered_service_collection diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 33b9214cfa..f69b48ce3b 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -55,12 +55,10 @@ class installer * Constructor * * @param config $config Installer config handler - * @param ContainerInterface $container Dependency injection container */ - public function __construct(config $config, ContainerInterface $container) + public function __construct(config $config) { $this->install_config = $config; - $this->container = $container; $this->installer_modules = null; } diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index eb04379f8e..60eaa79139 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -17,7 +17,6 @@ use phpbb\di\ordered_service_collection; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for installer module @@ -78,13 +77,11 @@ abstract class module_base implements module_interface /** * Dependency getter * - * @param ContainerInterface $container * @param config $config * @param iohandler_interface $iohandler */ - public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler) + public function setup(config $config, iohandler_interface $iohandler) { - $this->container = $container; $this->install_config = $config; $this->iohandler = $iohandler; } @@ -196,9 +193,9 @@ abstract class module_base implements module_interface } /** - * Returns the next task's index + * Returns the next task's name * - * @return string index of the array element of the next task + * @return string Index of the array element of the next task */ protected function recover_progress() { From 59d22eff497ea1107851067aa99eed4c979c0766 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 10 Jul 2015 00:47:28 +0200 Subject: [PATCH 39/75] [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/installer.php | 6 ------ phpBB/phpbb/install/module_base.php | 5 ----- 2 files changed, 11 deletions(-) diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index f69b48ce3b..548615cb1d 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -20,15 +20,9 @@ use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; use phpbb\install\helper\iohandler\iohandler_interface; -use Symfony\Component\DependencyInjection\ContainerInterface; class installer { - /** - * @var ContainerInterface - */ - protected $container; - /** * @var config */ diff --git a/phpBB/phpbb/install/module_base.php b/phpBB/phpbb/install/module_base.php index 60eaa79139..a933d4987c 100644 --- a/phpBB/phpbb/install/module_base.php +++ b/phpBB/phpbb/install/module_base.php @@ -23,11 +23,6 @@ use phpbb\install\helper\iohandler\iohandler_interface; */ abstract class module_base implements module_interface { - /** - * @var ContainerInterface - */ - protected $container; - /** * @var config */ From 051b7d1867351df293d055b62e0eb051758f90da Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 10 Jul 2015 14:54:21 +0200 Subject: [PATCH 40/75] [ticket/13740] Module base test PHPBB3-13740 --- .../installer/mocks/test_installer_module.php | 20 ++++++ .../mocks/test_installer_task_mock.php | 44 +++++++++++++ tests/installer/module_base_test.php | 65 +++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 tests/installer/mocks/test_installer_module.php create mode 100644 tests/installer/mocks/test_installer_task_mock.php create mode 100644 tests/installer/module_base_test.php diff --git a/tests/installer/mocks/test_installer_module.php b/tests/installer/mocks/test_installer_module.php new file mode 100644 index 0000000000..e6ebbba263 --- /dev/null +++ b/tests/installer/mocks/test_installer_module.php @@ -0,0 +1,20 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class test_installer_module extends \phpbb\install\module_base +{ + public function get_navigation_stage_path() + { + return array(); + } +} diff --git a/tests/installer/mocks/test_installer_task_mock.php b/tests/installer/mocks/test_installer_task_mock.php new file mode 100644 index 0000000000..ccd62b3bf4 --- /dev/null +++ b/tests/installer/mocks/test_installer_task_mock.php @@ -0,0 +1,44 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class test_installer_task_mock extends \phpbb\install\task_base +{ + private $task_was_runned; + + public function __construct() + { + $this->task_was_runned = false; + + parent::__construct(); + } + + public function run() + { + $this->task_was_runned = true; + } + + public function was_task_runned() + { + return $this->task_was_runned; + } + + public function get_task_lang_name() + { + return ''; + } + + public static function get_step_count() + { + return 2; + } +} diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php new file mode 100644 index 0000000000..fd92c9b674 --- /dev/null +++ b/tests/installer/module_base_test.php @@ -0,0 +1,65 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once __DIR__ . '/mocks/test_installer_task_mock.php'; +require_once __DIR__ . '/mocks/test_installer_module.php'; + +class module_base_test extends phpbb_test_case +{ + /** + * @var \phpbb\install\module_interface + */ + protected $module; + + /** + * @var phpbb_mock_container_builder + */ + protected $container; + + public function setUp() + { + // DI container mock + $this->container = new phpbb_mock_container_builder(); + $this->container->set('task_one', new test_installer_task_mock()); + $this->container->set('task_two', new test_installer_task_mock()); + + // the collection + $module_collection = new \phpbb\di\ordered_service_collection($this->container); + $module_collection->add('task_one'); + $module_collection->add('task_two'); + $module_collection->add_service_class('task_one', 'test_installer_task_mock'); + $module_collection->add_service_class('task_two', 'test_installer_task_mock'); + + $this->module = new test_installer_module($module_collection, true, false); + + $iohandler = $this->getMock('\phpbb\install\helper\iohandler\iohandler_interface'); + $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \phpbb\php\ini(), '', 'php'); + $this->module->setup($config, $iohandler); + } + + public function test_run() + { + $this->module->run(); + + $task = $this->container->get('task_one'); + $this->assertTrue($task->was_task_runned()); + + $task = $this->container->get('task_two'); + $this->assertTrue($task->was_task_runned()); + } + + public function test_step_count() + { + $this->assertEquals(4, $this->module->get_step_count()); + } +} From c5c98b7ca2dfb85925bc3ec1d6057ec554f9b4f9 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 14 Jul 2015 23:14:35 +0200 Subject: [PATCH 41/75] [ticket/13740] Implement navigation sorting PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 35 ++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 8445d80a41..5ef98ac2bb 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -158,8 +158,7 @@ class helper { // Get navigation items $nav_array = $this->navigation_provider->get(); - - // @todo Sort navs by order + $nav_array = $this->sort_navigation_level($nav_array); $active_main_menu = $this->get_active_main_menu($nav_array); @@ -174,7 +173,7 @@ class helper if (is_array($entry[0]) && $active_main_menu === $key) { - // @todo Sort navs by order + $entry[0] = $this->sort_navigation_level($entry[0]); foreach ($entry[0] as $name => $sub_entry) { @@ -220,6 +219,7 @@ class helper protected function render_language_select() { $langs = $this->lang_helper->get_available_languages(); + // @todo } /** @@ -246,7 +246,7 @@ class helper { foreach ($nav_options[0] as $sub_menus) { - if (isset($sub_menus['route']) &&$sub_menus['route'] === $active_route) + if (isset($sub_menus['route']) && $sub_menus['route'] === $active_route) { return $current_menu; } @@ -256,4 +256,31 @@ class helper return false; } + + /** + * Sorts the top level of navigation array + * + * @param array $nav_array Navigation array + * + * @return array + */ + protected function sort_navigation_level($nav_array) + { + $sorted = array(); + foreach ($nav_array as $nav) + { + $order = (isset($nav['order'])) ? $nav['order'] : 0; + $sorted[$order][] = $nav; + } + + // Linearization of navigation array + $nav_array = array(); + ksort($sorted); + foreach ($sorted as $nav) + { + $nav_array = array_merge($nav_array, $nav); + } + + return $nav_array; + } } From c89b226a7ae03c2e4ff12e60d36a27fe269583d4 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:06:02 +0200 Subject: [PATCH 42/75] [ticket/13740] Add more room for further tasks PHPBB3-13740 --- .../installer/container/services_install_data.yml | 8 ++++---- .../container/services_install_database.yml | 8 ++++---- .../container/services_install_filesystem.yml | 4 ++-- .../container/services_install_finish.yml | 6 +++--- .../container/services_install_obtain_data.yml | 14 +++++++------- .../container/services_install_requirements.yml | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/phpBB/config/installer/container/services_install_data.yml b/phpBB/config/installer/container/services_install_data.yml index c21f859406..ea5b5a2c52 100644 --- a/phpBB/config/installer/container/services_install_data.yml +++ b/phpBB/config/installer/container/services_install_data.yml @@ -9,7 +9,7 @@ services: - %core.root_path% - %core.php_ext% tags: - - { name: install_data_install, order: 2 } + - { name: install_data_install, order: 20 } installer.install_data.add_languages: class: phpbb\install\module\install_data\task\add_languages @@ -18,7 +18,7 @@ services: - @installer.helper.container_factory - @language.helper.language_file tags: - - { name: install_data_install, order: 1 } + - { name: install_data_install, order: 10 } installer.install_data.add_modules: class: phpbb\install\module\install_data\task\add_modules @@ -26,7 +26,7 @@ services: - @installer.helper.iohandler - @installer.helper.container_factory tags: - - { name: install_data_install, order: 3 } + - { name: install_data_install, order: 30 } installer.module.data_install_collection: class: phpbb\di\ordered_service_collection @@ -41,4 +41,4 @@ services: arguments: - @installer.module.data_install_collection tags: - - { name: installer_install_module, order: 5 } + - { name: installer_install_module, order: 50 } diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml index f42fa65239..743d62bae5 100644 --- a/phpBB/config/installer/container/services_install_database.yml +++ b/phpBB/config/installer/container/services_install_database.yml @@ -9,7 +9,7 @@ services: - %core.root_path% - %core.php_ext% tags: - - { name: install_database_install, order: 1 } + - { name: install_database_install, order: 10 } installer.install_database.add_default_data: class: phpbb\install\module\install_database\task\add_default_data @@ -21,7 +21,7 @@ services: - @language - %core.root_path% tags: - - { name: install_database_install, order: 2 } + - { name: install_database_install, order: 20 } installer.install_database.add_config_settings: class: phpbb\install\module\install_database\task\add_config_settings @@ -33,7 +33,7 @@ services: - @language - %core.root_path% tags: - - { name: install_database_install, order: 3 } + - { name: install_database_install, order: 30 } installer.module.install_database_collection: class: phpbb\di\ordered_service_collection @@ -48,4 +48,4 @@ services: arguments: - @installer.module.install_database_collection tags: - - { name: installer_install_module, order: 4 } + - { name: installer_install_module, order: 40 } diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index cbd8381d02..776d7b9198 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -9,7 +9,7 @@ services: - %core.root_path% - %core.php_ext% tags: - - { name: install_filesystem_install, order: 1 } + - { name: install_filesystem_install, order: 10 } installer.module.install_filesystem_collection: class: phpbb\di\ordered_service_collection @@ -24,4 +24,4 @@ services: arguments: - @installer.module.install_filesystem_collection tags: - - { name: installer_install_module, order: 3 } + - { name: installer_install_module, order: 30 } diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index 7f4c4d99bf..1dd280306a 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -4,7 +4,7 @@ services: arguments: - @installer.helper.container_factory tags: - - { name: install_finish, order: 1 } + - { name: install_finish, order: 10 } installer.install_finish.notify_user: class: phpbb\install\module\install_finish\task\notify_user @@ -15,7 +15,7 @@ services: - %core.root_path% - %core.php_ext% tags: - - { name: install_finish, order: 2 } + - { name: install_finish, order: 20 } installer.module.install_finish_collection: class: phpbb\di\ordered_service_collection @@ -30,4 +30,4 @@ services: arguments: - @installer.module.install_finish_collection tags: - - { name: installer_install_module, order: 6 } + - { name: installer_install_module, order: 60 } diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index 49c2b99f19..a1fab313c4 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -5,7 +5,7 @@ services: - @installer.helper.config - @installer.helper.iohandler tags: - - { name: install_obtain_data, order: 1 } + - { name: install_obtain_data, order: 10 } installer.obtain_data.obtain_board_data: class: phpbb\install\module\obtain_data\task\obtain_board_data @@ -14,7 +14,7 @@ services: - @installer.helper.iohandler - @language.helper.language_file tags: - - { name: install_obtain_data, order: 5 } + - { name: install_obtain_data, order: 50 } installer.obtain_data.obtain_database_data: class: phpbb\install\module\obtain_data\task\obtain_database_data @@ -23,7 +23,7 @@ services: - @installer.helper.config - @installer.helper.iohandler tags: - - { name: install_obtain_data, order: 2 } + - { name: install_obtain_data, order: 20 } installer.obtain_data.obtain_email_data: class: phpbb\install\module\obtain_data\task\obtain_email_data @@ -31,14 +31,14 @@ services: - @installer.helper.config - @installer.helper.iohandler tags: - - { name: install_obtain_data, order: 4 } + - { name: install_obtain_data, order: 40 } installer.obtain_data.obtain_imagick_path: class: phpbb\install\module\obtain_data\task\obtain_imagick_path arguments: - @installer.helper.config tags: - - { name: install_obtain_data, order: 6 } + - { name: install_obtain_data, order: 60 } installer.obtain_data.obtain_server_data: class: phpbb\install\module\obtain_data\task\obtain_server_data @@ -46,7 +46,7 @@ services: - @installer.helper.config - @installer.helper.iohandler tags: - - { name: install_obtain_data, order: 3 } + - { name: install_obtain_data, order: 30 } installer.module.install_obtain_data_collection: class: phpbb\di\ordered_service_collection @@ -63,4 +63,4 @@ services: - true - false tags: - - { name: installer_install_module, order: 2 } + - { name: installer_install_module, order: 20 } diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index 1a6ed634cf..f368031707 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -7,7 +7,7 @@ services: - %core.root_path% - %core.php_ext% tags: - - { name: installer_requirements, order: 1 } + - { name: installer_requirements, order: 10 } installer.requirements.check_server_environment: class: phpbb\install\module\requirements\task\check_server_environment @@ -15,7 +15,7 @@ services: - @installer.helper.database - @installer.helper.iohandler tags: - - { name: installer_requirements, order: 2 } + - { name: installer_requirements, order: 20 } installer.module.install_requirements_collection: class: phpbb\di\ordered_service_collection @@ -33,4 +33,4 @@ services: - true - false tags: - - { name: installer_install_module, order: 1 } + - { name: installer_install_module, order: 10 } From 846ab1d22fd33aaeeb1f122c14a4ba6156b7d6d5 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:12:50 +0200 Subject: [PATCH 43/75] [ticket/13740] Move install-config.yml to docs/ PHPBB3-13740 --- phpBB/{install-config.yml => docs/install-config.sample..yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpBB/{install-config.yml => docs/install-config.sample..yml} (100%) diff --git a/phpBB/install-config.yml b/phpBB/docs/install-config.sample..yml similarity index 100% rename from phpBB/install-config.yml rename to phpBB/docs/install-config.sample..yml From 88bf1d7f5802fc37bf77277a8ee65c6fb1f34c87 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:22:53 +0200 Subject: [PATCH 44/75] [ticket/13740] Clean up install config file when installation has finished PHPBB3-13740 --- phpBB/phpbb/install/helper/config.php | 23 +++++++++++++++++++++++ phpBB/phpbb/install/installer.php | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index 38fdf960f7..457b64b301 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -73,6 +73,13 @@ class config */ protected $navigation_data; + /** + * Flag indicating that config file should be cleaned up + * + * @var bool + */ + protected $do_clean_up; + /** * Constructor */ @@ -81,6 +88,7 @@ class config $this->filesystem = $filesystem; $this->php_ini = $php_ini; $this->phpbb_root_path = $phpbb_root_path; + $this->do_clean_up = false; // Set up data arrays $this->navigation_data = array(); @@ -228,6 +236,12 @@ class config */ public function save_config() { + if ($this->do_clean_up) + { + @unlink($this->install_config_file); + return; + } + // Create array to save $save_array = array( 'installer_config' => $this->installer_config, @@ -336,6 +350,15 @@ class config return $this->navigation_data; } + /** + * Removes install config file + */ + public function clean_up_config_file() + { + $this->do_clean_up = true; + @unlink($this->install_config_file); + } + /** * Filling up system_data array */ diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 548615cb1d..695632472a 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -219,7 +219,14 @@ class installer // Save install progress try { - $this->install_config->save_config(); + if ($install_finished) + { + $this->install_config->clean_up_config_file(); + } + else + { + $this->install_config->save_config(); + } } catch (installer_config_not_writable_exception $e) { From 6216007caaa884bdbca8bbb5e098ff231b5a36a6 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:47:10 +0200 Subject: [PATCH 45/75] [ticket/13740] Fix docblocks and comments PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 1 + phpBB/phpbb/install/helper/iohandler/cli_iohandler.php | 3 ++- phpBB/phpbb/install/module/install_finish/task/notify_user.php | 2 +- .../install/module/requirements/task/check_filesystem.php | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c1329b6456..c742906305 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -77,6 +77,7 @@ class install * @param factory $factory * @param navigation_provider $nav_provider * @param language $language + * @param template $template * @param request_interface $request * @param installer $installer */ diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php index f9c19f6d85..bf68f363c3 100644 --- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -45,7 +45,8 @@ class cli_iohandler extends iohandler_base /** * Set the style and output used to display feedback; * - * @param OutputStyle $style + * @param OutputStyle $style + * @param OutputInterface $output */ public function set_style(OutputStyle $style, OutputInterface $output) { diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php index 4ab6ec56c6..baffaf2228 100644 --- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -85,7 +85,7 @@ class notify_user extends \phpbb\install\task_base */ public function run() { - // @todo + // @todo Login user after installation has been finished //$this->user->setup('common'); //$this->user->session_begin(); diff --git a/phpBB/phpbb/install/module/requirements/task/check_filesystem.php b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php index 5b944b8415..ab6b1091e2 100644 --- a/phpBB/phpbb/install/module/requirements/task/check_filesystem.php +++ b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php @@ -47,7 +47,7 @@ class check_filesystem extends \phpbb\install\task_base * Constructor * * @param \phpbb\filesystem\filesystem_interface $filesystem filesystem handler - * @parma \phpbb\install\helper\iohandler\iohandler_interface $response response helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $response response helper * @param string $phpbb_root_path relative path to phpBB's root * @param string $php_ext extension of php files */ From 0488c49116f77de55da3ddf36aa2b08f6a5fd085 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 19:26:07 +0200 Subject: [PATCH 46/75] [ticket/13740] Exit from installation if phpBB is already installed PHPBB3-13740 --- .../container/services_install_console.yml | 1 + .../container/services_install_controller.yml | 1 + .../container/services_installer.yml | 6 ++ phpBB/language/en/install.php | 3 +- .../console/command/install/install.php | 24 +++++--- phpBB/phpbb/install/controller/helper.php | 2 +- phpBB/phpbb/install/controller/install.php | 18 +++++- phpBB/phpbb/install/helper/install_helper.php | 60 +++++++++++++++++++ 8 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 phpBB/phpbb/install/helper/install_helper.php diff --git a/phpBB/config/installer/container/services_install_console.yml b/phpBB/config/installer/container/services_install_console.yml index 9a4808b6aa..5a1e898754 100644 --- a/phpBB/config/installer/container/services_install_console.yml +++ b/phpBB/config/installer/container/services_install_console.yml @@ -21,6 +21,7 @@ services: - @language - @installer.helper.iohandler_factory - @installer.installer.install + - @installer.helper.install_helper tags: - { name: console.installer.command } diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml index c8d140aa5f..7acc7025a6 100644 --- a/phpBB/config/installer/container/services_install_controller.yml +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -30,3 +30,4 @@ services: - @template - @request - @installer.installer.install + - @installer.helper.install_helper diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index 8e19be5c0c..62137aa9d8 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -56,6 +56,12 @@ services: - %core.root_path% - %core.php_ext% + installer.helper.install_helper: + class: phpbb\install\helper\install_helper + arguments: + - %core.root_path% + - %core.php_ext% + # -------- Installer -------------------------------- installer.module_base: abstract: true diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f050d49ebd..10d25b0311 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -113,7 +113,8 @@ $lang = array_merge($lang, array( // General error messages $lang = array_merge($lang, array( - 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + 'PHPBB_ALREADY_INSTALLED' => 'phpBB is already installed.' )); // Data obtaining translations diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index d3f6d363f8..e9b4192ded 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -14,6 +14,7 @@ namespace phpbb\install\console\command\install; use phpbb\install\exception\installer_exception; +use phpbb\install\helper\install_helper; use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\factory; use phpbb\install\installer; @@ -40,6 +41,11 @@ class install extends \phpbb\console\command\command */ protected $installer; + /** + * @var install_helper + */ + protected $install_helper; + /** * @var language */ @@ -48,21 +54,22 @@ class install extends \phpbb\console\command\command /** * Constructor * - * @param language $language - * @param factory $factory - * @param installer $installer + * @param language $language + * @param factory $factory + * @param installer $installer + * @param install_helper $install_helper */ - public function __construct(language $language, factory $factory, installer $installer) + public function __construct(language $language, factory $factory, installer $installer, install_helper $install_helper) { $this->iohandler_factory = $factory; $this->installer = $installer; $this->language = $language; + $this->install_helper = $install_helper; parent::__construct(new \phpbb\user($language, 'datetime')); } /** - * * {@inheritdoc} */ protected function configure() @@ -89,8 +96,6 @@ class install extends \phpbb\console\command\command */ protected function execute(InputInterface $input, OutputInterface $output) { - // @todo check that phpBB is not already installed - $this->iohandler_factory->set_environment('cli'); /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ @@ -102,6 +107,11 @@ class install extends \phpbb\console\command\command $config_file = $input->getArgument('config-file'); + if ($this->install_helper->is_phpbb_installed()) + { + $iohandler->add_error_message('PHPBB_ALREADY_INSTALLED'); + } + if (!is_file($config_file)) { $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 5ef98ac2bb..a16298c525 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -219,7 +219,7 @@ class helper protected function render_language_select() { $langs = $this->lang_helper->get_available_languages(); - // @todo + // @todo Implement language change option } /** diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c742906305..5cd42fcb84 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,7 +13,9 @@ namespace phpbb\install\controller; +use phpbb\exception\http_exception; use phpbb\install\helper\config; +use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\Response; @@ -69,6 +71,11 @@ class install */ protected $installer; + /** + * @var install_helper + */ + protected $install_helper; + /** * Constructor * @@ -80,8 +87,9 @@ class install * @param template $template * @param request_interface $request * @param installer $installer + * @param install_helper $install_helper */ - public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer) + public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper) { $this->controller_helper = $helper; $this->installer_config = $install_config; @@ -91,6 +99,7 @@ class install $this->template = $template; $this->request = $request; $this->installer = $installer; + $this->install_helper = $install_helper; } /** @@ -100,8 +109,6 @@ class install */ public function handle() { - // @todo check that phpBB is not already installed - $this->template->assign_vars(array( 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), )); @@ -124,6 +131,11 @@ class install /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { diff --git a/phpBB/phpbb/install/helper/install_helper.php b/phpBB/phpbb/install/helper/install_helper.php new file mode 100644 index 0000000000..c1506de5bf --- /dev/null +++ b/phpBB/phpbb/install/helper/install_helper.php @@ -0,0 +1,60 @@ + + * @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\helper; + +/** + * General helper functionality for the installer + */ +class install_helper +{ + /** + * @var string + */ + protected $php_ext; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param string $phpbb_root_path path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Check whether phpBB is installed. + * + * @return bool + */ + public function is_phpbb_installed() + { + $config_path = $this->phpbb_root_path . 'config' . $this->php_ext; + $install_lock_path = $this->phpbb_root_path . 'cache/install_lock'; + + if (file_exists($config_path) && !file_exists($install_lock_path)) + { + include_once $config_path; + } + + return defined('PHPBB_INSTALLED'); + } +} From b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 14:42:15 +0200 Subject: [PATCH 47/75] [ticket/13740] Fix CS and docblocks PHPBB3-13740 --- .../console/command/install/install.php | 10 +++++--- phpBB/phpbb/install/controller/install.php | 10 ++++---- .../cannot_build_container_exception.php | 2 +- ...nstaller_config_not_writable_exception.php | 2 +- .../exception/invalid_dbms_exception.php | 2 +- .../invalid_service_name_exception.php | 19 -------------- .../resource_limit_reached_exception.php | 3 +++ .../install/helper/container_factory.php | 17 +++++++++++++ .../helper/iohandler/ajax_iohandler.php | 8 ++---- phpBB/phpbb/install/installer.php | 25 ------------------- 10 files changed, 36 insertions(+), 62 deletions(-) delete mode 100644 phpBB/phpbb/install/exception/invalid_service_name_exception.php diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index e9b4192ded..81ad1039f6 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -110,13 +110,15 @@ class install extends \phpbb\console\command\command if ($this->install_helper->is_phpbb_installed()) { $iohandler->add_error_message('PHPBB_ALREADY_INSTALLED'); + + return 1; } if (!is_file($config_file)) { $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); - return; + return 1; } try @@ -127,7 +129,7 @@ class install extends \phpbb\console\command\command { $iohandler->add_error_message('INVALID_YAML_FILE'); - return; + return 1; } $processor = new Processor(); @@ -141,7 +143,7 @@ class install extends \phpbb\console\command\command { $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); - return; + return 1; } $this->register_configuration($iohandler, $config); @@ -153,7 +155,7 @@ class install extends \phpbb\console\command\command catch (installer_exception $e) { $iohandler->add_error_message($e->getMessage()); - return; + return 1; } } diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 5cd42fcb84..b3103c8284 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -109,6 +109,11 @@ class install */ public function handle() { + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + $this->template->assign_vars(array( 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), )); @@ -131,11 +136,6 @@ class install /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); - if ($this->install_helper->is_phpbb_installed()) - { - throw new http_exception(404, 'PAGE_NOT_FOUND'); - } - // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { diff --git a/phpBB/phpbb/install/exception/cannot_build_container_exception.php b/phpBB/phpbb/install/exception/cannot_build_container_exception.php index 11be507bc9..6cf12b008b 100644 --- a/phpBB/phpbb/install/exception/cannot_build_container_exception.php +++ b/phpBB/phpbb/install/exception/cannot_build_container_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * This exception should be thrown when + * Thrown when the container cannot be built */ class cannot_build_container_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php index 3f3b03f178..51864c5dca 100644 --- a/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php +++ b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * Exception for the event when installer config is not writable to disk + * Thrown when installer config is not writable to disk */ class installer_config_not_writable_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/invalid_dbms_exception.php b/phpBB/phpbb/install/exception/invalid_dbms_exception.php index ccb35bc237..38de5f613a 100644 --- a/phpBB/phpbb/install/exception/invalid_dbms_exception.php +++ b/phpBB/phpbb/install/exception/invalid_dbms_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * This exception should be thrown when + * Thrown when an unavailable DBMS has been selected */ class invalid_dbms_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/invalid_service_name_exception.php b/phpBB/phpbb/install/exception/invalid_service_name_exception.php deleted file mode 100644 index dff4873f3c..0000000000 --- a/phpBB/phpbb/install/exception/invalid_service_name_exception.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @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\exception; - -class invalid_service_name_exception extends installer_exception -{ - -} diff --git a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php index 0b841747e6..025e09fbd3 100644 --- a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php +++ b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php @@ -13,6 +13,9 @@ namespace phpbb\install\exception; +/** + * Thrown when the installer is out of memory or time + */ class resource_limit_reached_exception extends installer_exception { diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index 255f8f428e..eb44b470b7 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -93,9 +93,26 @@ class container_factory * @param string $param_name * * @return mixed + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built */ public function get_parameter($param_name) { + // Check if container was built, if not try to build it + if ($this->container === null) + { + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + $this->build_container(); + } + else + { + throw new cannot_build_container_exception(); + } + } + return $this->container->getParameter($param_name); } diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index 85cb2ca753..ce1112c7a1 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -96,10 +96,6 @@ class ajax_iohandler extends iohandler_base */ public function add_user_form_group($title, $form) { - // - // This code is pretty ugly... but works - // - $this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form)); $this->template->assign_block_vars('options', array( @@ -166,8 +162,8 @@ class ajax_iohandler extends iohandler_base $json_data = json_encode($json_data_array); // Try to push content to the browser - print (str_pad(' ', 4096) . "\n"); - print ($json_data . "\n\n"); + print(str_pad(' ', 4096) . "\n"); + print($json_data . "\n\n"); flush(); } diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 695632472a..0e19129247 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -15,7 +15,6 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; -use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; @@ -94,9 +93,6 @@ class installer // Variable used to check if the install process have been finished $install_finished = false; - // Flag used by exception handling, whether or not we need to flush output buffer once again - $flush_messages = false; - // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); @@ -184,22 +180,6 @@ class installer { // Do nothing } - catch (invalid_service_name_exception $e) - { - $params = $e->get_parameters(); - - if (!empty($params)) - { - array_unshift($params, $e->getMessage()); - } - else - { - $params = $e->getMessage(); - } - - $this->iohandler->add_error_message($params); - $flush_messages = true; - } if ($install_finished) { @@ -211,11 +191,6 @@ class installer $this->iohandler->request_refresh(); } - if ($flush_messages) - { - $this->iohandler->send_response(); - } - // Save install progress try { From 3a3dd941452eca6f487bb8ab2d21c99f89846f24 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 15:06:15 +0200 Subject: [PATCH 48/75] [ticket/13740] Remove default config CLI command PHPBB3-13740 --- .../container/services_install_console.yml | 10 -- .../command/install/config/default_config.php | 103 ------------------ 2 files changed, 113 deletions(-) delete mode 100644 phpBB/phpbb/install/console/command/install/config/default_config.php diff --git a/phpBB/config/installer/container/services_install_console.yml b/phpBB/config/installer/container/services_install_console.yml index 5a1e898754..6f931c5031 100644 --- a/phpBB/config/installer/container/services_install_console.yml +++ b/phpBB/config/installer/container/services_install_console.yml @@ -15,16 +15,6 @@ services: tags: - { name: console.installer.command } - console.installer.command.config.default: - class: phpbb\install\console\command\install\config\default_config - arguments: - - @language - - @installer.helper.iohandler_factory - - @installer.installer.install - - @installer.helper.install_helper - tags: - - { name: console.installer.command } - console.installer.command.config.show: class: phpbb\install\console\command\install\config\show arguments: diff --git a/phpBB/phpbb/install/console/command/install/config/default_config.php b/phpBB/phpbb/install/console/command/install/config/default_config.php deleted file mode 100644 index 75c9f94901..0000000000 --- a/phpBB/phpbb/install/console/command/install/config/default_config.php +++ /dev/null @@ -1,103 +0,0 @@ - -* @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\console\command\install\config; - -use phpbb\language\language; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Yaml\Yaml; - -class default_config extends \phpbb\console\command\command -{ - /** - * @var language - */ - protected $language; - - /** - * Constructor - * - * @param language $language - */ - public function __construct(language $language) - { - $this->language = $language; - - parent::__construct(new \phpbb\user($language, 'datetime')); - } - - /** - * - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('install:config:default') - ; - } - - /** - * Display the default configuration - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * - * @return null - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $default_config = <<writeln($default_config); - } -} From 3d4f21c1f87f88c6cf6efd6e3844672d7784f09f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 15:13:54 +0200 Subject: [PATCH 49/75] [ticket/13740] Check navigation requirements PHPBB3-13740 --- .../container/services_install_navigation.yml | 2 ++ .../helper/navigation/install_navigation.php | 25 +++++++++++++++++++ .../helper/navigation/main_navigation.php | 3 +++ 3 files changed, 30 insertions(+) diff --git a/phpBB/config/installer/container/services_install_navigation.yml b/phpBB/config/installer/container/services_install_navigation.yml index 88c495825b..53e20e89cc 100644 --- a/phpBB/config/installer/container/services_install_navigation.yml +++ b/phpBB/config/installer/container/services_install_navigation.yml @@ -19,6 +19,8 @@ services: installer.navigation.install_navigation: class: phpbb\install\helper\navigation\install_navigation + arguments: + - @installer.helper.install_helper scope: prototype tags: - { name: installer.navigation } diff --git a/phpBB/phpbb/install/helper/navigation/install_navigation.php b/phpBB/phpbb/install/helper/navigation/install_navigation.php index 1389f11fa0..f690f8de76 100644 --- a/phpBB/phpbb/install/helper/navigation/install_navigation.php +++ b/phpBB/phpbb/install/helper/navigation/install_navigation.php @@ -13,10 +13,35 @@ namespace phpbb\install\helper\navigation; +use phpbb\install\helper\install_helper; + class install_navigation implements navigation_interface { + /** + * @var install_helper + */ + private $install_helper; + + /** + * Constructor + * + * @param install_helper $install_helper + */ + public function __construct(install_helper $install_helper) + { + $this->install_helper = $install_helper; + } + + /** + * {@inheritdoc} + */ public function get() { + if ($this->install_helper->is_phpbb_installed()) + { + return array(); + } + return array( 'install' => array( 'label' => 'INSTALL', diff --git a/phpBB/phpbb/install/helper/navigation/main_navigation.php b/phpBB/phpbb/install/helper/navigation/main_navigation.php index ad67840424..214bb04963 100644 --- a/phpBB/phpbb/install/helper/navigation/main_navigation.php +++ b/phpBB/phpbb/install/helper/navigation/main_navigation.php @@ -15,6 +15,9 @@ namespace phpbb\install\helper\navigation; class main_navigation implements navigation_interface { + /** + * {@inheritdoc} + */ public function get() { return array( From 030f6da9118a30541fe56403893e3679457a0684 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 15:30:31 +0200 Subject: [PATCH 50/75] [ticket/13740] Remove extra dot from config sample's name PHPBB3-13740 --- .../{install-config.sample..yml => install-config.sample.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpBB/docs/{install-config.sample..yml => install-config.sample.yml} (100%) diff --git a/phpBB/docs/install-config.sample..yml b/phpBB/docs/install-config.sample.yml similarity index 100% rename from phpBB/docs/install-config.sample..yml rename to phpBB/docs/install-config.sample.yml From 136ec8d7e25efe7b466cb41f80dc5a75a51eaa68 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Tue, 21 Jul 2015 15:53:26 +0200 Subject: [PATCH 51/75] [ticket/13740] Keep keys when sorting navigation PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index a16298c525..569938be09 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -267,10 +267,10 @@ class helper protected function sort_navigation_level($nav_array) { $sorted = array(); - foreach ($nav_array as $nav) + foreach ($nav_array as $key => $nav) { $order = (isset($nav['order'])) ? $nav['order'] : 0; - $sorted[$order][] = $nav; + $sorted[$order][$key] = $nav; } // Linearization of navigation array From 11642a5f9481e4e25402833edb2bac903c23c627 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 22 Jul 2015 02:42:13 +0200 Subject: [PATCH 52/75] [ticket/13740] Keep language file's names PHPBB3-13740 --- phpBB/install/database_update.php | 2 +- phpBB/install/index.php | 2 +- phpBB/install_new/app.php | 2 +- phpBB/install_new/phpbbcli.php | 2 +- phpBB/language/en/install.php | 683 ++++++++++++++++++++++-------- phpBB/language/en/install_new.php | 305 +++++++++++++ phpBB/language/en/old_install.php | 629 --------------------------- 7 files changed, 813 insertions(+), 812 deletions(-) create mode 100644 phpBB/language/en/install_new.php delete mode 100644 phpBB/language/en/old_install.php diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7ba11c37c4..853848d637 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -122,7 +122,7 @@ if (!isset($config['version_update_from'])) $orig_version = $config['version_update_from']; -$user->add_lang(array('common', 'acp/common', 'old_install', 'migrator')); +$user->add_lang(array('common', 'acp/common', 'install', 'migrator')); // Add own hook handler, if present. :o if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index a1a8fc02b6..3559a10971 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -210,7 +210,7 @@ if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_r } // And finally, load the relevant language files -$load_lang_files = array('common', 'acp/common', 'acp/board', 'old_install', 'posting'); +$load_lang_files = array('common', 'acp/common', 'acp/board', 'install', 'posting'); $new_path = $phpbb_root_path . 'install/update/new/language/' . $language . '/'; $old_path = $phpbb_root_path . 'language/' . $language . '/'; diff --git a/phpBB/install_new/app.php b/phpBB/install_new/app.php index 75b28fa092..b173f40dfc 100644 --- a/phpBB/install_new/app.php +++ b/phpBB/install_new/app.php @@ -67,7 +67,7 @@ $template->set_custom_style(array( /** @var \phpbb\language\language $language */ $language = $phpbb_installer_container->get('language'); -$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting')); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install_new', 'posting')); /* @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */ $http_kernel = $phpbb_installer_container->get('http_kernel'); diff --git a/phpBB/install_new/phpbbcli.php b/phpBB/install_new/phpbbcli.php index 20a202f584..4c8034be4e 100644 --- a/phpBB/install_new/phpbbcli.php +++ b/phpBB/install_new/phpbbcli.php @@ -61,7 +61,7 @@ $phpbb_filesystem = $phpbb_installer_container->get('filesystem'); /** @var \phpbb\language\language $language */ $language = $phpbb_installer_container->get('language'); -$language->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting', 'cli')); +$language->add_lang(array('common', 'acp/common', 'acp/board', 'install_new', 'posting', 'cli')); $application = new \phpbb\console\application('phpBB Installer', PHPBB_VERSION, $language); $application->register_container_commands($phpbb_installer_container->get('console.installer.command_collection')); diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 10d25b0311..a776a539ed 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -36,26 +36,166 @@ if (empty($lang) || !is_array($lang)) // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -// Common installer pages $lang = array_merge($lang, array( - 'INSTALL_PANEL' => 'Installation Panel', + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_TEST' => 'Check administrator settings', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', + 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', + 'AUTHOR_NOTES' => 'Author notes
» %s', + 'AVAILABLE' => 'Available', + 'AVAILABLE_CONVERTORS' => 'Available convertors', - 'STAGE_INSTALL' => 'Installing phpBB', + 'BEGIN_CONVERT' => 'Begin conversion', + 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', + 'BOARD_NOT_INSTALLED' => 'No installation found', + 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', + 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', - // Introduction page - 'INTRODUCTION_TITLE' => 'Introduction', - 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + 'CATEGORY' => 'Category', + 'CACHE_STORE' => 'Cache type', + 'CACHE_STORE_EXPLAIN' => 'The physical location where data is cached, filesystem is preferred.', + 'CAT_CONVERT' => 'Convert', + 'CAT_INSTALL' => 'Install', + 'CAT_OVERVIEW' => 'Overview', + 'CAT_UPDATE' => 'Update', + 'CHANGE' => 'Change', + 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', + 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', + 'CLEANING_USERNAMES' => 'Cleaning usernames', + 'COLLIDING_CLEAN_USERNAME' => '%s is the clean username for:', + 'COLLIDING_USERNAMES_FOUND' => 'Colliding usernames were found on your old board. In order to complete the conversion please delete or rename these users so that there is only one user on your old board for each clean username.', + 'COLLIDING_USER' => '» user id: %d username: %s (%d posts)', + 'CONFIG_CONVERT' => 'Converting the configuration', + 'CONFIG_FILE_UNABLE_WRITE' => 'It was not possible to write the configuration file. Alternative methods for this file to be created are presented below.', + 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', + 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', + 'CONFIG_RETRY' => 'Retry', + 'CONTINUE_CONVERT' => 'Continue conversion', + 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', + 'CONTINUE_LAST' => 'Continue last statements', + 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', + 'CONVERT' => 'Convert', + 'CONVERT_COMPLETE' => 'Conversion completed', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', + 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', + 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', + 'CONVERT_NEW_CONVERSION' => 'New conversion', + 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', + 'CONVERT_OPTIONS' => 'Options', + 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, please push the button below.', + 'CONV_ERR_FATAL' => 'Fatal conversion error', - // Support page - 'SUPPORT_TITLE' => 'Support', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', + 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', + 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', + 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', + 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', + 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', + 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', + 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', + 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', + 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', + 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', + 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', + 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', + 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', + 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', + 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', + 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', + 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', + 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', + 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', + 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', + 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', + 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', + 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', + 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', + 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', + 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', + 'CONV_SAVED_MESSAGES' => 'Saved messages', - // License - 'LICENSE_TITLE' => 'General Public License', + 'COULD_NOT_COPY' => 'Could not copy file %1$s to %2$s

Please check that the target directory exists and is writable by the webserver.', + 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', - // Install page - 'INSTALL_INTRO' => 'Welcome to Installation', - 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ 'DBMS' => 'Database type', + 'DB_CONFIG' => 'Database configuration', + 'DB_CONNECTION' => 'Database connection', + 'DB_ERR_INSERT' => 'Error while processing INSERT query.', + 'DB_ERR_LAST' => 'Error while processing query_last.', + 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', + 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', + 'DB_ERR_SELECT' => 'Error while running SELECT query.', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_NAME' => 'Database name', + 'DB_PASSWORD' => 'Database password', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$s”. The version you currently have installed is “%2$s”. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', + 'DB_USERNAME' => 'Database username', + 'DB_TEST' => 'Test connection', + 'DEFAULT_LANG' => 'Default board language', + 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', + 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', + 'DIRECTORIES_AND_FILES' => 'Directory and file setup', + 'DISABLE_KEYS' => 'Disabling keys', + 'DLL_FTP' => 'Remote FTP support [ Installation ]', + 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', + 'DLL_MBSTRING' => 'Multi-byte character support', + 'DLL_MSSQL' => 'MSSQL Server 2000+', + 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DLL_MYSQL' => 'MySQL', + 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', + 'DLL_ORACLE' => 'Oracle', + 'DLL_POSTGRES' => 'PostgreSQL', + 'DLL_SQLITE' => 'SQLite 2', + 'DLL_SQLITE3' => 'SQLite 3', + 'DLL_XML' => 'XML support [ Jabber ]', + 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', + 'DL_CONFIG' => 'Download config', + 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', + 'DL_DOWNLOAD' => 'Download', + 'DONE' => 'Done', + + 'ENABLE_KEYS' => 'Re-enabling keys. This can take a while.', + + 'FILES_OPTIONAL' => 'Optional files and directories', + 'FILES_OPTIONAL_EXPLAIN' => 'Optional - These files, directories or permission settings are not required. The installation system will attempt to use various techniques to create them if they do not exist or cannot be written to. However, the presence of these will speed installation.', + 'FILES_REQUIRED' => 'Files and Directories', + 'FILES_REQUIRED_EXPLAIN' => 'Required - In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see “Not Found” you need to create the relevant file or directory. If you see “Unwritable” you need to change the permissions on the file or directory to allow phpBB to write to it.', + 'FILLING_TABLE' => 'Filling table %s', + 'FILLING_TABLES' => 'Filling tables', + + 'FINAL_STEP' => 'Process final step', + 'FORUM_ADDRESS' => 'Board address', + 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example http://www.example.com/phpBB2/. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', + 'FORUM_PATH' => 'Board path', + 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', + 'FOUND' => 'Found', + 'FTP_CONFIG' => 'Transfer config by FTP', + 'FTP_CONFIG_EXPLAIN' => 'phpBB has detected the presence of the FTP module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are).', + 'FTP_PATH' => 'FTP path', + 'FTP_PATH_EXPLAIN' => 'This is the path from your root directory to that of phpBB, e.g. htdocs/phpBB3/.', + 'FTP_UPLOAD' => 'Upload', + + 'GPL' => 'General Public License', + + 'INITIAL_CONFIG' => 'Basic configuration', + 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', + 'INSTALL_CONGRATS' => 'Congratulations!', + 'INSTALL_CONGRATS_EXPLAIN' => ' + You have successfully installed phpBB %1$s. Please proceed by choosing one of the following options:

+

Convert an existing board to phpBB3

+

The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.

+

Go live with your phpBB3!

+

Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.

Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.', + 'INSTALL_INTRO' => 'Welcome to Installation', + + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

  • The Database Type - the database you will be using.
  • @@ -79,134 +219,367 @@ $lang = array_merge($lang, array(

Only those databases supported on your server will be displayed.', -)); - -// Requirements translation -$lang = array_merge($lang, array( - // Filesystem requirements - 'FILE_NOT_EXISTS' => 'File not exists', - 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s file need to exist.', - 'FILE_NOT_WRITABLE' => 'File not writable', - 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s file need to be writable.', - - 'DIRECTORY_NOT_EXISTS' => 'Directory not exists', - 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s directory need to exist.', - 'DIRECTORY_NOT_WRITABLE' => 'Directory not writable', - 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s directory need to be writable.', - - // Server requirements - 'PHP_VERSION_REQD' => 'PHP version', - 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 5.3.9 or higher.', - 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', - 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', - 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', - 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', - 'PHP_JSON_SUPPORT' => 'PHP JSON support', - 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', - 'PHP_SUPPORTED_DB' => 'Supported databases', - 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', - - 'RETEST_REQUIREMENTS' => 'Retest requirements', - - 'STAGE_REQUIREMENTS' => 'Check requirements' -)); - -// General error messages -$lang = array_merge($lang, array( + 'INSTALL_INTRO_NEXT' => 'To commence the installation, please press the button below.', + 'INSTALL_LOGIN' => 'Login', + 'INSTALL_NEXT' => 'Next stage', + 'INSTALL_NEXT_FAIL' => 'Some tests failed and you should correct these problems before proceeding to the next stage. Failure to do so may result in an incomplete installation.', + 'INSTALL_NEXT_PASS' => 'All the basic tests have been passed and you may proceed to the next stage of installation. If you have changed any permissions, modules, etc. and wish to re-test you can do so if you wish.', + 'INSTALL_PANEL' => 'Installation Panel', + 'INSTALL_SEND_CONFIG' => 'Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writable. A number of options will be listed below enabling you to complete installation of config.php.', + 'INSTALL_START' => 'Start install', + 'INSTALL_TEST' => 'Test again', + 'INST_ERR' => 'Installation error', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_EMAIL_MISMATCH' => 'The emails you entered did not match.', + 'INST_ERR_FATAL' => 'Fatal installation error', + 'INST_ERR_FATAL_DB' => 'A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.', + 'INST_ERR_FTP_PATH' => 'Could not change to the given directory, please check the path.', + 'INST_ERR_FTP_LOGIN' => 'Could not login to FTP server, check your username and password.', 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', - 'PHPBB_ALREADY_INSTALLED' => 'phpBB is already installed.' -)); - -// Data obtaining translations -$lang = array_merge($lang, array( - 'STAGE_OBTAIN_DATA' => 'Set installation data', - - // - // Admin data - // - 'STAGE_ADMINISTRATOR' => 'Administrator details', - - // Form labels - 'ADMIN_CONFIG' => 'Administrator configuration', - 'ADMIN_PASSWORD' => 'Administrator password', - 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', - 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', - 'ADMIN_USERNAME' => 'Administrator username', - 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', - - // Errors - 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', - 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', - 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_PREFIX_INVALID' => 'The table prefix you have specified is invalid for your database. Please try another, removing characters such as the hyphen.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + 'INVALID_PRIMARY_KEY' => 'Invalid primary key : %s', - // - // Board data - // - // Form labels - 'BOARD_CONFIG' => 'Bulletin board configuration', - 'DEFAULT_LANGUAGE' => 'Default language', - 'BOARD_NAME' => 'Title of the board', - 'BOARD_DESCRIPTION' => 'Short description of the board', + 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', - // - // Database data - // - 'STAGE_DATABASE' => 'Database settings', + // mbstring + 'MBSTRING_CHECK' => 'mbstring extension check', + 'MBSTRING_CHECK_EXPLAIN' => 'Required - mbstring is a PHP extension that provides multibyte string functions. Certain features of mbstring are not compatible with phpBB and must be disabled.', + 'MBSTRING_FUNC_OVERLOAD' => 'Function overloading', + 'MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4.', + 'MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding', + 'MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0.', + 'MBSTRING_HTTP_INPUT' => 'HTTP input character conversion', + 'MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass.', + 'MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion', + 'MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass.', - // Form labels - 'DB_CONFIG' => 'Database configuration', - 'DBMS' => 'Database type', - 'DB_HOST' => 'Database server hostname or DSN', - 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', - 'DB_PORT' => 'Database server port', - 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', - 'DB_PASSWORD' => 'Database password', - 'DB_NAME' => 'Database name', - 'DB_USERNAME' => 'Database username', - 'TABLE_PREFIX' => 'Prefix for tables in database', - 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', + 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', - // Database options - 'DB_OPTION_MSSQL' => 'MSSQL Server 2000+', - 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', - 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', - 'DB_OPTION_MYSQL' => 'MySQL', - 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', - 'DB_OPTION_ORACLE' => 'Oracle', - 'DB_OPTION_POSTGRES' => 'PostgreSQL', - 'DB_OPTION_SQLITE' => 'SQLite 2', - 'DB_OPTION_SQLITE3' => 'SQLite 3', + 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.
Before you proceed the update, you need to upgrade the schema.

Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.', - // Errors - 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', - 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', - 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', - 'INST_ERR_DB_NO_NAME' => 'No database name specified.', - 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', - 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', - 'INST_ERR_DB_NO_ERROR' => 'No error message given.', - 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', - 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', - 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', - 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', - 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', - 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', + 'NEXT_STEP' => 'Proceed to next step', + 'NOT_FOUND' => 'Cannot find', + 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', + 'NO_CONVERTORS' => 'No convertors are available for use.', + 'NO_CONVERT_SPECIFIED' => 'No convertor specified.', + 'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel', + 'NO_TABLES_FOUND' => 'No tables found.', - // - // Email data - // - 'EMAIL_CONFIG' => 'E-mail configuration', + 'OVERVIEW_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', - // - // Server data - // - // Form labels - 'SERVER_CONFIG' => 'Server configuration', - 'SCRIPT_PATH' => 'Script path', - 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_OPTIONAL_MODULE' => 'Optional modules', + 'PHP_OPTIONAL_MODULE_EXPLAIN' => 'Optional - These modules or applications are optional. However, if they are available they will enable extra features.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'Required - You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + 'PHP_REGISTER_GLOBALS' => 'PHP setting register_globals is disabled', + 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', + 'PHP_SAFE_MODE' => 'Safe mode', + 'PHP_SETTINGS' => 'PHP version and settings', + 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.9 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', + 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting allow_url_fopen is enabled', + 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', + 'PHP_VERSION_REQD' => 'PHP version >= 5.3.9', + 'POST_ID' => 'Post ID', + 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', + 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', + 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', + 'PROCESS_LAST' => 'Processing last statements', + + 'REFRESH_PAGE' => 'Refresh page to continue conversion', + 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', + 'REQUIREMENTS_TITLE' => 'Installation compatibility', + 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with the full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to use any of the features depending on the optional tests, you should ensure that these tests are passed also.', + 'RETRY_WRITE' => 'Retry writing config', + 'RETRY_WRITE_EXPLAIN' => 'If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB has finished installation.', + + 'SELECT_LANG' => 'Select language', + 'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted', + 'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.', + 'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):', + 'SOFTWARE' => 'Board software', + 'SPECIFY_OPTIONS' => 'Specify conversion options', + 'STAGE_ADMINISTRATOR' => 'Administrator details', + 'STAGE_ADVANCED' => 'Advanced settings', + 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', + 'STAGE_CONFIG_FILE' => 'Configuration file', + 'STAGE_CREATE_TABLE' => 'Create database tables', + 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', + 'STAGE_DATABASE' => 'Database settings', + 'STAGE_FINAL' => 'Final stage', + 'STAGE_INTRO' => 'Introduction', + 'STAGE_IN_PROGRESS' => 'Conversion in progress', + 'STAGE_REQUIREMENTS' => 'Requirements', + 'STAGE_SETTINGS' => 'Settings', + 'STARTING_CONVERT' => 'Starting conversion process', + 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', + 'SUB_INTRO' => 'Introduction', + 'SUB_LICENSE' => 'License', + 'SUB_SUPPORT' => 'Support', + 'SUCCESSFUL_CONNECT' => 'Successful connection', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', + 'SYNC_FORUMS' => 'Starting to synchronise forums', + 'SYNC_POST_COUNT' => 'Synchronising post_counts', + 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', + 'SYNC_TOPICS' => 'Starting to synchronise topics', + 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', + + 'TABLES_MISSING' => 'Could not find these tables
» %s.', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', + 'TESTS_PASSED' => 'Tests passed', + 'TESTS_FAILED' => 'Tests failed', + + 'UNABLE_WRITE_LOCK' => 'Unable to write lock file.', + 'UNAVAILABLE' => 'Unavailable', + 'UNWRITABLE' => 'Unwritable', + 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', + 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', + 'VERIFY_OPTIONS' => 'Verifying conversion options', + 'VERSION' => 'Version', + + 'WELCOME_INSTALL' => 'Welcome to phpBB3 Installation', + 'WRITABLE' => 'Writable', +)); + +// Updater +$lang = array_merge($lang, array( + 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', + 'ARCHIVE_FILE' => 'Source file within archive', + + 'BACK' => 'Back', + 'BINARY_FILE' => 'Binary file', + 'BOT' => 'Spider/Robot', + + 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', + 'CHECK_FILES' => 'Check files', + 'CHECK_FILES_AGAIN' => 'Check files again', + 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', + 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', + 'CHECK_UPDATE_DATABASE' => 'Continue update process', + 'COLLECTED_INFORMATION' => 'File information', + 'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', + 'COLLECTING_FILE_DIFFS' => 'Collecting file differences', + 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory!', + 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater + 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished + 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', + 'CURRENT_VERSION' => 'Current version', + + 'DATABASE_TYPE' => 'Database type', + 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', + 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', + 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', + 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', + 'DELETE_USER_REMOVE' => 'Delete user and remove posts', + 'DELETE_USER_RETAIN' => 'Delete user but keep posts', + 'DESTINATION' => 'Destination file', + 'DIFF_INLINE' => 'Inline', + 'DIFF_RAW' => 'Raw unified diff', + 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', + 'DIFF_SIDE_BY_SIDE' => 'Side by Side', + 'DIFF_UNIFIED' => 'Unified diff', + 'DO_NOT_UPDATE' => 'Do not update this file', + 'DONE' => 'Done', + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_AS' => 'Download as', + 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', + 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', + 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', + 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', + + 'EDIT_USERNAME' => 'Edit username', + 'ERROR' => 'Error', + 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', + 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', + 'FILE_USED' => 'Information used from', // Single file + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'FTP_SETTINGS' => 'FTP settings', + 'FTP_UPDATE_METHOD' => 'FTP upload', + + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', + 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete.', + 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.', + + 'KEEP_OLD_NAME' => 'Keep username', + + 'LATEST_VERSION' => 'Latest version', + 'LINE' => 'Line', + 'LINE_ADDED' => 'Added', + 'LINE_MODIFIED' => 'Modified', + 'LINE_REMOVED' => 'Removed', + 'LINE_UNMODIFIED' => 'Unmodified', + 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', + + 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', + + 'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications', + + 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', + 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', + 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (removes new phpBB code within conflicting block)', + 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (removes modified code within conflicting block)', + 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', + 'MERGING_FILES' => 'Merging differences', + 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.

Please wait until phpBB has completed all operations on changed files.', + + 'NEW_FILE' => 'End of Conflict', + 'NEW_USERNAME' => 'New username', + 'NO_AUTH_UPDATE' => 'Not authorised to update', + 'NO_ERRORS' => 'No errors', + 'NO_UPDATE_FILES' => 'Not updating the following files', + 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', + 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit https://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.', + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'NO_UPDATE_INFO' => 'Update file information could not be found.', + 'NO_UPDATES_REQUIRED' => 'No updates required', + 'NO_VISIBLE_CHANGES' => 'No visible changes', + 'NOTICE' => 'Notice', + 'NUM_CONFLICTS' => 'Number of conflicts', + 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.
Please wait until all files are checked.', + + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + + 'PACKAGE_UPDATES_TO' => 'Current package updates to version', + 'PERFORM_DATABASE_UPDATE' => 'Perform database update', + 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a button to the database update script. The database update can take a while, so please do not stop the execution if it seems to hang. After the database update has been performed just follow the instructions to continue the update process.', + 'PREVIOUS_VERSION' => 'Previous version', + 'PROGRESS' => 'Progress', + + 'RELEASE_ANNOUNCEMENT' => 'Announcement', + 'RESULT' => 'Result', + 'RUN_DATABASE_SCRIPT' => 'Update my database now', + + 'SELECT_DIFF_MODE' => 'Select diff mode', + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + 'SELECT_FTP_SETTINGS' => 'Select FTP settings', + 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_DELETED' => 'Show file contents', + 'SHOW_DIFF_FINAL' => 'Show resulting file', + 'SHOW_DIFF_MODIFIED' => 'Show merged differences', + 'SHOW_DIFF_NEW' => 'Show file contents', + 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', + 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', + 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.', + 'SQL' => 'SQL', + 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See README for details on how to obtain advice.', + 'STAGE_FILE_CHECK' => 'Check files', + 'STAGE_UPDATE_DB' => 'Update database', + 'STAGE_UPDATE_FILES' => 'Update files', + 'STAGE_VERSION_CHECK' => 'Version check', + 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'STATUS_DELETED' => 'Deleted file', + 'STATUS_MODIFIED' => 'Modified file', + 'STATUS_NEW' => 'New file', + 'STATUS_NEW_CONFLICT' => 'Conflicting new file', + 'STATUS_NOT_MODIFIED' => 'Not modified file', + 'STATUS_UP_TO_DATE' => 'Already updated file', + + 'TOGGLE_DISPLAY' => 'View/Hide file list', + 'TRY_DOWNLOAD_METHOD' => 'You may want to try the download modified files method.
This method always works and is also the recommended update path.', + 'TRY_DOWNLOAD_METHOD_BUTTON'=> 'Try this method now', + + 'UPDATE_COMPLETED' => 'Update completed', + 'UPDATE_DATABASE' => 'Update database', + 'UPDATE_DATABASE_EXPLAIN' => 'Within the next step the database will be updated.', + 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', + 'UPDATE_FILES' => 'Update files', + 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', + 'UPDATE_INSTALLATION' => 'Update phpBB installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', + 'UPDATE_INSTRUCTIONS' => ' + +

Release announcement

+ +

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+ +
+ +

How to update your installation with the Automatic Update Package

+ +

The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:

+ +
    +
  • Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.

  • +
  • Unpack the archive.

  • +
  • Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  • +
+ +

Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.

+ Now start the update process by pointing your browser to the install folder.
+
+ You will then be guided through the update process. You will be notified once the update is complete. +

+ ', + 'UPDATE_METHOD' => 'Update method', + 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', + 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', + 'UPDATE_SUCCESS' => 'Update was successful', + 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', + 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimising tables', + 'UPDATING_DATA' => 'Updating data', + 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', + 'UPDATED_VERSION' => 'Updated version', + 'UPLOAD_METHOD' => 'Upload method', + + 'UPDATE_DB_SUCCESS' => 'Database update was successful.', + 'UPDATE_FILE_SUCCESS' => 'File update was successful.', + 'USER_ACTIVE' => 'Active user', + 'USER_INACTIVE' => 'Inactive user', + + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', + 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', + 'VIEWING_FILE_DIFF' => 'Viewing file differences', + + 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', )); // Default database schema entries... @@ -254,51 +627,3 @@ $lang = array_merge($lang, array( 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', )); - -// Common navigation items' translation -$lang = array_merge($lang, array( - 'MENU_OVERVIEW' => 'Overview', - 'MENU_INTRO' => 'Introduction', - 'MENU_LICENSE' => 'License', - 'MENU_SUPPORT' => 'Support', -)); - -// Task names -$lang = array_merge($lang, array( - // Install filesystem - 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', - - // Install database - 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', - 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', - 'TASK_CREATE_DATABASE_SCHEMA' => 'Creating database schema', - - // Install data - 'TASK_ADD_BOTS' => 'Registering bots', - 'TASK_ADD_LANGUAGES' => 'Installing available languages', - 'TASK_ADD_MODULES' => 'Installing modules', - - // Install finish tasks - 'TASK_NOTIFY_USER' => 'Sending notification e-mail', - 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', - - // Installer general progress messages - 'INSTALLER_FINISHED' => 'The installer has finished successfully', -)); - -// Installer's general messages -$lang = array_merge($lang, array( - 'MODULE_NOT_FOUND' => 'Module not found', - 'MODULE_NOT_FOUND_DESCRIPTION' => 'No module is found under the service definition “%s” is not defined.', - - 'TASK_NOT_FOUND' => 'Task not found', - 'TASK_NOT_FOUND_DESCRIPTION' => 'No task is found under the service definition “%s” is not defined.', - - 'SKIP_MODULE' => 'Skip “%s” module', - 'SKIP_TASK' => 'Skip “%s” task', - - 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', - 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', - - 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', -)); diff --git a/phpBB/language/en/install_new.php b/phpBB/language/en/install_new.php new file mode 100644 index 0000000000..607565fcd0 --- /dev/null +++ b/phpBB/language/en/install_new.php @@ -0,0 +1,305 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Common installer pages +$lang = array_merge($lang, array( + 'INSTALL_PANEL' => 'Installation Panel', + 'SELECT_LANG' => 'Select language', + + 'STAGE_INSTALL' => 'Installing phpBB', + + // Introduction page + 'INTRODUCTION_TITLE' => 'Introduction', + 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + // Support page + 'SUPPORT_TITLE' => 'Support', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', + + // License + 'LICENSE_TITLE' => 'General Public License', + + // Install page + 'INSTALL_INTRO' => 'Welcome to Installation', + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ +
    +
  • The Database Type - the database you will be using.
  • +
  • The Database server hostname or DSN - the address of the database server.
  • +
  • The Database server port - the port of the database server (most of the time this is not needed).
  • +
  • The Database name - the name of the database on the server.
  • +
  • The Database username and Database password - the login data to access the database.
  • +
+ +

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

+ +

phpBB3 supports the following databases:

+
    +
  • MySQL 3.23 or above (MySQLi supported)
  • +
  • PostgreSQL 8.3+
  • +
  • SQLite 2.8.2+
  • +
  • SQLite 3.6.15+
  • +
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • +
  • Oracle
  • +
+ +

Only those databases supported on your server will be displayed.', +)); + +// Requirements translation +$lang = array_merge($lang, array( + // Filesystem requirements + 'FILE_NOT_EXISTS' => 'File not exists', + 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s file need to exist.', + 'FILE_NOT_WRITABLE' => 'File not writable', + 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s file need to be writable.', + + 'DIRECTORY_NOT_EXISTS' => 'Directory not exists', + 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB %1$s directory need to exist.', + 'DIRECTORY_NOT_WRITABLE' => 'Directory not writable', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB %1$s directory need to be writable.', + + // Server requirements + 'PHP_VERSION_REQD' => 'PHP version', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 5.3.9 or higher.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + + 'RETEST_REQUIREMENTS' => 'Retest requirements', + + 'STAGE_REQUIREMENTS' => 'Check requirements' +)); + +// General error messages +$lang = array_merge($lang, array( + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + 'PHPBB_ALREADY_INSTALLED' => 'phpBB is already installed.' +)); + +// Data obtaining translations +$lang = array_merge($lang, array( + 'STAGE_OBTAIN_DATA' => 'Set installation data', + + // + // Admin data + // + 'STAGE_ADMINISTRATOR' => 'Administrator details', + + // Form labels + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', + + // Errors + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + + // + // Board data + // + // Form labels + 'BOARD_CONFIG' => 'Bulletin board configuration', + 'DEFAULT_LANGUAGE' => 'Default language', + 'BOARD_NAME' => 'Title of the board', + 'BOARD_DESCRIPTION' => 'Short description of the board', + + // + // Database data + // + 'STAGE_DATABASE' => 'Database settings', + + // Form labels + 'DB_CONFIG' => 'Database configuration', + 'DBMS' => 'Database type', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_PASSWORD' => 'Database password', + 'DB_NAME' => 'Database name', + 'DB_USERNAME' => 'Database username', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + + // Database options + 'DB_OPTION_MSSQL' => 'MSSQL Server 2000+', + 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DB_OPTION_MYSQL' => 'MySQL', + 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', + 'DB_OPTION_ORACLE' => 'Oracle', + 'DB_OPTION_POSTGRES' => 'PostgreSQL', + 'DB_OPTION_SQLITE' => 'SQLite 2', + 'DB_OPTION_SQLITE3' => 'SQLite 3', + + // Errors + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + + // + // Email data + // + 'EMAIL_CONFIG' => 'E-mail configuration', + + // + // Server data + // + // Form labels + 'SERVER_CONFIG' => 'Server configuration', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', +)); + +// Default database schema entries... +$lang = array_merge($lang, array( + 'CONFIG_BOARD_EMAIL_SIG' => 'Thanks, The Management', + 'CONFIG_SITE_DESC' => 'A short text to describe your forum', + 'CONFIG_SITENAME' => 'yourdomain.com', + + 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', + + 'FORUMS_FIRST_CATEGORY' => 'Your first category', + 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', + 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', + + 'RANKS_SITE_ADMIN_TITLE' => 'Site Admin', + 'REPORT_WAREZ' => 'The post contains links to illegal or pirated software.', + 'REPORT_SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', + 'REPORT_OFF_TOPIC' => 'The reported post is off topic.', + 'REPORT_OTHER' => 'The reported post does not fit into any other category, please use the further information field.', + + 'SMILIES_ARROW' => 'Arrow', + 'SMILIES_CONFUSED' => 'Confused', + 'SMILIES_COOL' => 'Cool', + 'SMILIES_CRYING' => 'Crying or Very Sad', + 'SMILIES_EMARRASSED' => 'Embarrassed', + 'SMILIES_EVIL' => 'Evil or Very Mad', + 'SMILIES_EXCLAMATION' => 'Exclamation', + 'SMILIES_GEEK' => 'Geek', + 'SMILIES_IDEA' => 'Idea', + 'SMILIES_LAUGHING' => 'Laughing', + 'SMILIES_MAD' => 'Mad', + 'SMILIES_MR_GREEN' => 'Mr. Green', + 'SMILIES_NEUTRAL' => 'Neutral', + 'SMILIES_QUESTION' => 'Question', + 'SMILIES_RAZZ' => 'Razz', + 'SMILIES_ROLLING_EYES' => 'Rolling Eyes', + 'SMILIES_SAD' => 'Sad', + 'SMILIES_SHOCKED' => 'Shocked', + 'SMILIES_SMILE' => 'Smile', + 'SMILIES_SURPRISED' => 'Surprised', + 'SMILIES_TWISTED_EVIL' => 'Twisted Evil', + 'SMILIES_UBER_GEEK' => 'Uber Geek', + 'SMILIES_VERY_HAPPY' => 'Very Happy', + 'SMILIES_WINK' => 'Wink', + + 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', +)); + +// Common navigation items' translation +$lang = array_merge($lang, array( + 'MENU_OVERVIEW' => 'Overview', + 'MENU_INTRO' => 'Introduction', + 'MENU_LICENSE' => 'License', + 'MENU_SUPPORT' => 'Support', +)); + +// Task names +$lang = array_merge($lang, array( + // Install filesystem + 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', + + // Install database + 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', + 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', + 'TASK_CREATE_DATABASE_SCHEMA' => 'Creating database schema', + + // Install data + 'TASK_ADD_BOTS' => 'Registering bots', + 'TASK_ADD_LANGUAGES' => 'Installing available languages', + 'TASK_ADD_MODULES' => 'Installing modules', + + // Install finish tasks + 'TASK_NOTIFY_USER' => 'Sending notification e-mail', + 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', + + // Installer general progress messages + 'INSTALLER_FINISHED' => 'The installer has finished successfully', +)); + +// Installer's general messages +$lang = array_merge($lang, array( + 'MODULE_NOT_FOUND' => 'Module not found', + 'MODULE_NOT_FOUND_DESCRIPTION' => 'No module is found under the service definition “%s” is not defined.', + + 'TASK_NOT_FOUND' => 'Task not found', + 'TASK_NOT_FOUND_DESCRIPTION' => 'No task is found under the service definition “%s” is not defined.', + + 'SKIP_MODULE' => 'Skip “%s” module', + 'SKIP_TASK' => 'Skip “%s” task', + + 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', + 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', + + 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', +)); diff --git a/phpBB/language/en/old_install.php b/phpBB/language/en/old_install.php deleted file mode 100644 index a776a539ed..0000000000 --- a/phpBB/language/en/old_install.php +++ /dev/null @@ -1,629 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* DO NOT CHANGE -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -if (empty($lang) || !is_array($lang)) -{ - $lang = array(); -} - -// DEVELOPERS PLEASE NOTE -// -// All language files should use UTF-8 as their encoding and the files must not contain a BOM. -// -// Placeholders can now contain order information, e.g. instead of -// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows -// translators to re-order the output of data while ensuring it remains correct -// -// You do not need this where single placeholders are used, e.g. 'Message %d' is fine -// equally where a string contains only two placeholders which are used to wrap text -// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine - -$lang = array_merge($lang, array( - 'ADMIN_CONFIG' => 'Administrator configuration', - 'ADMIN_PASSWORD' => 'Administrator password', - 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', - 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', - 'ADMIN_TEST' => 'Check administrator settings', - 'ADMIN_USERNAME' => 'Administrator username', - 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', - 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', - 'AUTHOR_NOTES' => 'Author notes
» %s', - 'AVAILABLE' => 'Available', - 'AVAILABLE_CONVERTORS' => 'Available convertors', - - 'BEGIN_CONVERT' => 'Begin conversion', - 'BLANK_PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using no table prefix.', - 'BOARD_NOT_INSTALLED' => 'No installation found', - 'BOARD_NOT_INSTALLED_EXPLAIN' => 'The phpBB Unified Convertor Framework requires a default installation of phpBB3 to function, please proceed by first installing phpBB3.', - 'BACKUP_NOTICE' => 'Please backup your board before updating in case any problems arise during the update process.', - - 'CATEGORY' => 'Category', - 'CACHE_STORE' => 'Cache type', - 'CACHE_STORE_EXPLAIN' => 'The physical location where data is cached, filesystem is preferred.', - 'CAT_CONVERT' => 'Convert', - 'CAT_INSTALL' => 'Install', - 'CAT_OVERVIEW' => 'Overview', - 'CAT_UPDATE' => 'Update', - 'CHANGE' => 'Change', - 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', - 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', - 'CLEANING_USERNAMES' => 'Cleaning usernames', - 'COLLIDING_CLEAN_USERNAME' => '%s is the clean username for:', - 'COLLIDING_USERNAMES_FOUND' => 'Colliding usernames were found on your old board. In order to complete the conversion please delete or rename these users so that there is only one user on your old board for each clean username.', - 'COLLIDING_USER' => '» user id: %d username: %s (%d posts)', - 'CONFIG_CONVERT' => 'Converting the configuration', - 'CONFIG_FILE_UNABLE_WRITE' => 'It was not possible to write the configuration file. Alternative methods for this file to be created are presented below.', - 'CONFIG_FILE_WRITTEN' => 'The configuration file has been written. You may now proceed to the next step of the installation.', - 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', - 'CONFIG_RETRY' => 'Retry', - 'CONTINUE_CONVERT' => 'Continue conversion', - 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', - 'CONTINUE_LAST' => 'Continue last statements', - 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', - 'CONVERT' => 'Convert', - 'CONVERT_COMPLETE' => 'Conversion completed', - 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.1. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', - 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', - 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', - 'CONVERT_NEW_CONVERSION' => 'New conversion', - 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', - 'CONVERT_OPTIONS' => 'Options', - 'CONVERT_SETTINGS_VERIFIED' => 'The information you entered has been verified. To start the conversion process, please push the button below.', - 'CONV_ERR_FATAL' => 'Fatal conversion error', - - 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', - 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', - 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', - 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', - 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', - 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', - 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', - 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', - 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', - 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', - 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', - 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', - 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', - 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', - 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', - 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', - 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', - 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', - 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', - 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', - 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', - 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', - 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', - 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', - 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', - 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', - 'CONV_SAVED_MESSAGES' => 'Saved messages', - - 'COULD_NOT_COPY' => 'Could not copy file %1$s to %2$s

Please check that the target directory exists and is writable by the webserver.', - 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', - - 'DBMS' => 'Database type', - 'DB_CONFIG' => 'Database configuration', - 'DB_CONNECTION' => 'Database connection', - 'DB_ERR_INSERT' => 'Error while processing INSERT query.', - 'DB_ERR_LAST' => 'Error while processing query_last.', - 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', - 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', - 'DB_ERR_SELECT' => 'Error while running SELECT query.', - 'DB_HOST' => 'Database server hostname or DSN', - 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', - 'DB_NAME' => 'Database name', - 'DB_PASSWORD' => 'Database password', - 'DB_PORT' => 'Database server port', - 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', - 'DB_UPDATE_NOT_SUPPORTED' => 'We are sorry, but this script does not support updating from versions of phpBB prior to “%1$s”. The version you currently have installed is “%2$s”. Please update to a previous version before running this script. Assistance with this is available in the Support Forum on phpBB.com.', - 'DB_USERNAME' => 'Database username', - 'DB_TEST' => 'Test connection', - 'DEFAULT_LANG' => 'Default board language', - 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', - 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', - 'DIRECTORIES_AND_FILES' => 'Directory and file setup', - 'DISABLE_KEYS' => 'Disabling keys', - 'DLL_FTP' => 'Remote FTP support [ Installation ]', - 'DLL_GD' => 'GD graphics support [ Visual Confirmation ]', - 'DLL_MBSTRING' => 'Multi-byte character support', - 'DLL_MSSQL' => 'MSSQL Server 2000+', - 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', - 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', - 'DLL_MYSQL' => 'MySQL', - 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', - 'DLL_ORACLE' => 'Oracle', - 'DLL_POSTGRES' => 'PostgreSQL', - 'DLL_SQLITE' => 'SQLite 2', - 'DLL_SQLITE3' => 'SQLite 3', - 'DLL_XML' => 'XML support [ Jabber ]', - 'DLL_ZLIB' => 'zlib compression support [ gz, .tar.gz, .zip ]', - 'DL_CONFIG' => 'Download config', - 'DL_CONFIG_EXPLAIN' => 'You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 3.1 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click “Done” to move to the next stage.', - 'DL_DOWNLOAD' => 'Download', - 'DONE' => 'Done', - - 'ENABLE_KEYS' => 'Re-enabling keys. This can take a while.', - - 'FILES_OPTIONAL' => 'Optional files and directories', - 'FILES_OPTIONAL_EXPLAIN' => 'Optional - These files, directories or permission settings are not required. The installation system will attempt to use various techniques to create them if they do not exist or cannot be written to. However, the presence of these will speed installation.', - 'FILES_REQUIRED' => 'Files and Directories', - 'FILES_REQUIRED_EXPLAIN' => 'Required - In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see “Not Found” you need to create the relevant file or directory. If you see “Unwritable” you need to change the permissions on the file or directory to allow phpBB to write to it.', - 'FILLING_TABLE' => 'Filling table %s', - 'FILLING_TABLES' => 'Filling tables', - - 'FINAL_STEP' => 'Process final step', - 'FORUM_ADDRESS' => 'Board address', - 'FORUM_ADDRESS_EXPLAIN' => 'This is the URL of your former board, for example http://www.example.com/phpBB2/. If an address is entered here and not left empty every instance of this address will be replaced by your new board address within messages, private messages and signatures.', - 'FORUM_PATH' => 'Board path', - 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', - 'FOUND' => 'Found', - 'FTP_CONFIG' => 'Transfer config by FTP', - 'FTP_CONFIG_EXPLAIN' => 'phpBB has detected the presence of the FTP module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are).', - 'FTP_PATH' => 'FTP path', - 'FTP_PATH_EXPLAIN' => 'This is the path from your root directory to that of phpBB, e.g. htdocs/phpBB3/.', - 'FTP_UPLOAD' => 'Upload', - - 'GPL' => 'General Public License', - - 'INITIAL_CONFIG' => 'Basic configuration', - 'INITIAL_CONFIG_EXPLAIN' => 'Now that install has determined your server can run phpBB you need to supply some specific information. If you do not know how to connect to your database please contact your hosting provider (in the first instance) or use the phpBB support forums. When entering data please ensure you check it thoroughly before continuing.', - 'INSTALL_CONGRATS' => 'Congratulations!', - 'INSTALL_CONGRATS_EXPLAIN' => ' - You have successfully installed phpBB %1$s. Please proceed by choosing one of the following options:

-

Convert an existing board to phpBB3

-

The phpBB Unified Convertor Framework supports the conversion of phpBB 2.0.x and other board systems to phpBB3. If you have an existing board that you wish to convert, please proceed to the convertor.

-

Go live with your phpBB3!

-

Clicking the button below will take you to a form for submitting statistical data to phpBB in your Administration Control Panel (ACP). We would appreciate it if you could help us by sending that information. Afterwards you should take some time to examine the options available to you. Remember that help is available online via the Documentation, README and the Support Forums.

Please delete, move or rename the install directory before using your board. While this directory exists, only the Administration Control Panel (ACP) will be accessible.', - 'INSTALL_INTRO' => 'Welcome to Installation', - - 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

- -
    -
  • The Database Type - the database you will be using.
  • -
  • The Database server hostname or DSN - the address of the database server.
  • -
  • The Database server port - the port of the database server (most of the time this is not needed).
  • -
  • The Database name - the name of the database on the server.
  • -
  • The Database username and Database password - the login data to access the database.
  • -
- -

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

- -

phpBB3 supports the following databases:

-
    -
  • MySQL 3.23 or above (MySQLi supported)
  • -
  • PostgreSQL 8.3+
  • -
  • SQLite 2.8.2+
  • -
  • SQLite 3.6.15+
  • -
  • MS SQL Server 2000 or above (directly or via ODBC)
  • -
  • MS SQL Server 2005 or above (native)
  • -
  • Oracle
  • -
- -

Only those databases supported on your server will be displayed.', - 'INSTALL_INTRO_NEXT' => 'To commence the installation, please press the button below.', - 'INSTALL_LOGIN' => 'Login', - 'INSTALL_NEXT' => 'Next stage', - 'INSTALL_NEXT_FAIL' => 'Some tests failed and you should correct these problems before proceeding to the next stage. Failure to do so may result in an incomplete installation.', - 'INSTALL_NEXT_PASS' => 'All the basic tests have been passed and you may proceed to the next stage of installation. If you have changed any permissions, modules, etc. and wish to re-test you can do so if you wish.', - 'INSTALL_PANEL' => 'Installation Panel', - 'INSTALL_SEND_CONFIG' => 'Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writable. A number of options will be listed below enabling you to complete installation of config.php.', - 'INSTALL_START' => 'Start install', - 'INSTALL_TEST' => 'Test again', - 'INST_ERR' => 'Installation error', - 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', - 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', - 'INST_ERR_DB_INVALID_PREFIX'=> 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', - 'INST_ERR_DB_NO_ERROR' => 'No error message given.', - 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', - 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', - 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', - 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', - 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', - 'INST_ERR_DB_NO_NAME' => 'No database name specified.', - 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', - 'INST_ERR_EMAIL_MISMATCH' => 'The emails you entered did not match.', - 'INST_ERR_FATAL' => 'Fatal installation error', - 'INST_ERR_FATAL_DB' => 'A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.', - 'INST_ERR_FTP_PATH' => 'Could not change to the given directory, please check the path.', - 'INST_ERR_FTP_LOGIN' => 'Could not login to FTP server, check your username and password.', - 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', - 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', - 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', - 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', - 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', - 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', - 'INST_ERR_PREFIX_INVALID' => 'The table prefix you have specified is invalid for your database. Please try another, removing characters such as the hyphen.', - 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', - 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', - 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', - 'INVALID_PRIMARY_KEY' => 'Invalid primary key : %s', - - 'LONG_SCRIPT_EXECUTION' => 'Please note that this can take a while... Please do not stop the script.', - - // mbstring - 'MBSTRING_CHECK' => 'mbstring extension check', - 'MBSTRING_CHECK_EXPLAIN' => 'Required - mbstring is a PHP extension that provides multibyte string functions. Certain features of mbstring are not compatible with phpBB and must be disabled.', - 'MBSTRING_FUNC_OVERLOAD' => 'Function overloading', - 'MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4.', - 'MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding', - 'MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0.', - 'MBSTRING_HTTP_INPUT' => 'HTTP input character conversion', - 'MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass.', - 'MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion', - 'MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass.', - - 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', - 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', - - 'MYSQL_SCHEMA_UPDATE_REQUIRED' => 'Your MySQL database schema for phpBB is outdated. phpBB detected a schema for MySQL 3.x/4.x, but the server runs on MySQL %2$s.
Before you proceed the update, you need to upgrade the schema.

Please refer to the Knowledge Base article about upgrading the MySQL schema. If you encounter problems, please use our support forums.', - - 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', - 'NEXT_STEP' => 'Proceed to next step', - 'NOT_FOUND' => 'Cannot find', - 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', - 'NO_CONVERTORS' => 'No convertors are available for use.', - 'NO_CONVERT_SPECIFIED' => 'No convertor specified.', - 'NO_LOCATION' => 'Cannot determine location. If you know Imagemagick is installed, you may specify the location later within your administration control panel', - 'NO_TABLES_FOUND' => 'No tables found.', - - 'OVERVIEW_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', - - 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', - 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', - 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP function getimagesize() is available', - 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the getimagesize function needs to be available.', - 'PHP_JSON_SUPPORT' => 'PHP JSON support', - 'PHP_JSON_SUPPORT_EXPLAIN' => 'Required - In order for phpBB to function correctly, the PHP JSON extension needs to be available.', - 'PHP_OPTIONAL_MODULE' => 'Optional modules', - 'PHP_OPTIONAL_MODULE_EXPLAIN' => 'Optional - These modules or applications are optional. However, if they are available they will enable extra features.', - 'PHP_SUPPORTED_DB' => 'Supported databases', - 'PHP_SUPPORTED_DB_EXPLAIN' => 'Required - You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', - 'PHP_REGISTER_GLOBALS' => 'PHP setting register_globals is disabled', - 'PHP_REGISTER_GLOBALS_EXPLAIN' => 'phpBB will still run if this setting is enabled, but if possible, it is recommended that register_globals is disabled on your PHP install for security reasons.', - 'PHP_SAFE_MODE' => 'Safe mode', - 'PHP_SETTINGS' => 'PHP version and settings', - 'PHP_SETTINGS_EXPLAIN' => 'Required - You must be running at least version 5.3.9 of PHP in order to install phpBB. If safe mode is displayed below your PHP installation is running in that mode. This will impose limitations on remote administration and similar features.', - 'PHP_URL_FOPEN_SUPPORT' => 'PHP setting allow_url_fopen is enabled', - 'PHP_URL_FOPEN_SUPPORT_EXPLAIN' => 'Optional - This setting is optional, however certain phpBB functions like off-site avatars will not work properly without it.', - 'PHP_VERSION_REQD' => 'PHP version >= 5.3.9', - 'POST_ID' => 'Post ID', - 'PREFIX_FOUND' => 'A scan of your tables has shown a valid installation using %s as table prefix.', - 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', - 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', - 'PROCESS_LAST' => 'Processing last statements', - - 'REFRESH_PAGE' => 'Refresh page to continue conversion', - 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', - 'REQUIREMENTS_TITLE' => 'Installation compatibility', - 'REQUIREMENTS_EXPLAIN' => 'Before proceeding with the full installation phpBB will carry out some tests on your server configuration and files to ensure that you are able to install and run phpBB. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed. If you wish to use any of the features depending on the optional tests, you should ensure that these tests are passed also.', - 'RETRY_WRITE' => 'Retry writing config', - 'RETRY_WRITE_EXPLAIN' => 'If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB has finished installation.', - - 'SELECT_LANG' => 'Select language', - 'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted', - 'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.', - 'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):', - 'SOFTWARE' => 'Board software', - 'SPECIFY_OPTIONS' => 'Specify conversion options', - 'STAGE_ADMINISTRATOR' => 'Administrator details', - 'STAGE_ADVANCED' => 'Advanced settings', - 'STAGE_ADVANCED_EXPLAIN' => 'The settings on this page are only necessary to set if you know that you require something different from the default. If you are unsure, just proceed to the next page, as these settings can be altered from the Administration Control Panel later.', - 'STAGE_CONFIG_FILE' => 'Configuration file', - 'STAGE_CREATE_TABLE' => 'Create database tables', - 'STAGE_CREATE_TABLE_EXPLAIN' => 'The database tables used by phpBB 3.1 have been created and populated with some initial data. Proceed to the next screen to finish installing phpBB.', - 'STAGE_DATABASE' => 'Database settings', - 'STAGE_FINAL' => 'Final stage', - 'STAGE_INTRO' => 'Introduction', - 'STAGE_IN_PROGRESS' => 'Conversion in progress', - 'STAGE_REQUIREMENTS' => 'Requirements', - 'STAGE_SETTINGS' => 'Settings', - 'STARTING_CONVERT' => 'Starting conversion process', - 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', - 'SUB_INTRO' => 'Introduction', - 'SUB_LICENSE' => 'License', - 'SUB_SUPPORT' => 'Support', - 'SUCCESSFUL_CONNECT' => 'Successful connection', - 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

The phpBB Welcome Package
Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, why not subscribe to our mailing list?

', - 'SYNC_FORUMS' => 'Starting to synchronise forums', - 'SYNC_POST_COUNT' => 'Synchronising post_counts', - 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', - 'SYNC_TOPICS' => 'Starting to synchronise topics', - 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', - - 'TABLES_MISSING' => 'Could not find these tables
» %s.', - 'TABLE_PREFIX' => 'Prefix for tables in database', - 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', - 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', - 'TESTS_PASSED' => 'Tests passed', - 'TESTS_FAILED' => 'Tests failed', - - 'UNABLE_WRITE_LOCK' => 'Unable to write lock file.', - 'UNAVAILABLE' => 'Unavailable', - 'UNWRITABLE' => 'Unwritable', - 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', - 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', - 'VERIFY_OPTIONS' => 'Verifying conversion options', - 'VERSION' => 'Version', - - 'WELCOME_INSTALL' => 'Welcome to phpBB3 Installation', - 'WRITABLE' => 'Writable', -)); - -// Updater -$lang = array_merge($lang, array( - 'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.', - 'ARCHIVE_FILE' => 'Source file within archive', - - 'BACK' => 'Back', - 'BINARY_FILE' => 'Binary file', - 'BOT' => 'Spider/Robot', - - 'CHANGE_CLEAN_NAMES' => 'The method used to make sure a username is not used by multiple users has been changed. There are some users which have the same name when compared with the new method. You have to delete or rename these users to make sure that each name is only used by one user before you can proceed.', - 'CHECK_FILES' => 'Check files', - 'CHECK_FILES_AGAIN' => 'Check files again', - 'CHECK_FILES_EXPLAIN' => 'Within the next step all files will be checked against the update files - this can take a while if this is the first file check.', - 'CHECK_FILES_UP_TO_DATE' => 'According to your database your version is up to date. You may want to proceed with the file check to make sure all files are really up to date with the latest phpBB version.', - 'CHECK_UPDATE_DATABASE' => 'Continue update process', - 'COLLECTED_INFORMATION' => 'File information', - 'COLLECTED_INFORMATION_EXPLAIN' => 'The list below shows information about the files needing an update. Please read the information in front of every status block to see what they mean and what you may need to do to perform a successful update.', - 'COLLECTING_FILE_DIFFS' => 'Collecting file differences', - 'COMPLETE_LOGIN_TO_BOARD' => 'You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory!', - 'CONTINUE_UPDATE_NOW' => 'Continue the update process now', // Shown within the database update script at the end if called from the updater - 'CONTINUE_UPDATE' => 'Continue update now', // Shown after file upload to indicate the update process is not yet finished - 'CURRENT_FILE' => 'Begin of Conflict - Original File code before update', - 'CURRENT_VERSION' => 'Current version', - - 'DATABASE_TYPE' => 'Database type', - 'DATABASE_UPDATE_COMPLETE' => 'Database updater has completed!', - 'DATABASE_UPDATE_CONTINUE' => 'Continue database update', - 'DATABASE_UPDATE_INFO_OLD' => 'The database update file within the install directory is outdated. Please make sure you uploaded the correct version of the file.', - 'DATABASE_UPDATE_NOT_COMPLETED' => 'The database update has not yet completed.', - 'DELETE_USER_REMOVE' => 'Delete user and remove posts', - 'DELETE_USER_RETAIN' => 'Delete user but keep posts', - 'DESTINATION' => 'Destination file', - 'DIFF_INLINE' => 'Inline', - 'DIFF_RAW' => 'Raw unified diff', - 'DIFF_SEP_EXPLAIN' => 'Code block used within the updated/new file', - 'DIFF_SIDE_BY_SIDE' => 'Side by Side', - 'DIFF_UNIFIED' => 'Unified diff', - 'DO_NOT_UPDATE' => 'Do not update this file', - 'DONE' => 'Done', - 'DOWNLOAD' => 'Download', - 'DOWNLOAD_AS' => 'Download as', - 'DOWNLOAD_UPDATE_METHOD_BUTTON' => 'Download modified files archive (recommended)', - 'DOWNLOAD_CONFLICTS' => 'Download conflicts for this file', - 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', - 'DOWNLOAD_UPDATE_METHOD' => 'Download modified files archive', - 'DOWNLOAD_UPDATE_METHOD_EXPLAIN' => 'Once downloaded you should unpack the archive. You will find the modified files you need to upload to your phpBB root directory within it. Please upload the files to their respective locations then. After you have uploaded all files, please check the files again with the other button below.', - - 'EDIT_USERNAME' => 'Edit username', - 'ERROR' => 'Error', - 'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now login to your board and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the Send statistics module in your ACP.', - - 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', - 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', - 'FILE_USED' => 'Information used from', // Single file - 'FILES_CONFLICT' => 'Conflict files', - 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', - 'FILES_DELETED' => 'Deleted files', - 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', - 'FILES_MODIFIED' => 'Modified files', - 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', - 'FILES_NEW' => 'New files', - 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', - 'FILES_NEW_CONFLICT' => 'New conflicting files', - 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', - 'FILES_NOT_MODIFIED' => 'Not modified files', - 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', - 'FILES_UP_TO_DATE' => 'Already updated files', - 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', - 'FTP_SETTINGS' => 'FTP settings', - 'FTP_UPDATE_METHOD' => 'FTP upload', - - 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', - 'INCOMPLETE_UPDATE_FILES' => 'The update files are incomplete.', - 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful. Now you need to continue the update process.', - - 'KEEP_OLD_NAME' => 'Keep username', - - 'LATEST_VERSION' => 'Latest version', - 'LINE' => 'Line', - 'LINE_ADDED' => 'Added', - 'LINE_MODIFIED' => 'Modified', - 'LINE_REMOVED' => 'Removed', - 'LINE_UNMODIFIED' => 'Unmodified', - 'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.', - - 'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.', - - 'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications', - - 'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file', - 'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file', - 'MERGE_MOD_FILE_OPTION' => 'Merge modifications (removes new phpBB code within conflicting block)', - 'MERGE_NEW_FILE_OPTION' => 'Merge modifications (removes modified code within conflicting block)', - 'MERGE_SELECT_ERROR' => 'Conflicting file merge modes are not correctly selected.', - 'MERGING_FILES' => 'Merging differences', - 'MERGING_FILES_EXPLAIN' => 'Currently collecting final file changes.

Please wait until phpBB has completed all operations on changed files.', - - 'NEW_FILE' => 'End of Conflict', - 'NEW_USERNAME' => 'New username', - 'NO_AUTH_UPDATE' => 'Not authorised to update', - 'NO_ERRORS' => 'No errors', - 'NO_UPDATE_FILES' => 'Not updating the following files', - 'NO_UPDATE_FILES_EXPLAIN' => 'The following files are new or modified but the directory they normally reside in could not be found on your installation. If this list contains files to other directories than language/ or styles/ than you may have modified your directory structure and the update may be incomplete.', - 'NO_UPDATE_FILES_OUTDATED' => 'No valid update directory was found, please make sure you uploaded the relevant files.

Your installation does not seem to be up to date. Updates are available for your version of phpBB %1$s, please visit https://www.phpbb.com/downloads/ to obtain the correct package to update from Version %2$s to Version %3$s.', - 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', - 'NO_UPDATE_INFO' => 'Update file information could not be found.', - 'NO_UPDATES_REQUIRED' => 'No updates required', - 'NO_VISIBLE_CHANGES' => 'No visible changes', - 'NOTICE' => 'Notice', - 'NUM_CONFLICTS' => 'Number of conflicts', - 'NUMBER_OF_FILES_COLLECTED' => 'Currently differences from %1$d of %2$d files have been checked.
Please wait until all files are checked.', - - 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', - - 'PACKAGE_UPDATES_TO' => 'Current package updates to version', - 'PERFORM_DATABASE_UPDATE' => 'Perform database update', - 'PERFORM_DATABASE_UPDATE_EXPLAIN' => 'Below you will find a button to the database update script. The database update can take a while, so please do not stop the execution if it seems to hang. After the database update has been performed just follow the instructions to continue the update process.', - 'PREVIOUS_VERSION' => 'Previous version', - 'PROGRESS' => 'Progress', - - 'RELEASE_ANNOUNCEMENT' => 'Announcement', - 'RESULT' => 'Result', - 'RUN_DATABASE_SCRIPT' => 'Update my database now', - - 'SELECT_DIFF_MODE' => 'Select diff mode', - 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', - 'SELECT_FTP_SETTINGS' => 'Select FTP settings', - 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', - 'SHOW_DIFF_DELETED' => 'Show file contents', - 'SHOW_DIFF_FINAL' => 'Show resulting file', - 'SHOW_DIFF_MODIFIED' => 'Show merged differences', - 'SHOW_DIFF_NEW' => 'Show file contents', - 'SHOW_DIFF_NEW_CONFLICT' => 'Show differences', - 'SHOW_DIFF_NOT_MODIFIED' => 'Show differences', - 'SOME_QUERIES_FAILED' => 'Some queries failed, the statements and errors are listed below.', - 'SQL' => 'SQL', - 'SQL_FAILURE_EXPLAIN' => 'This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our support forums. See README for details on how to obtain advice.', - 'STAGE_FILE_CHECK' => 'Check files', - 'STAGE_UPDATE_DB' => 'Update database', - 'STAGE_UPDATE_FILES' => 'Update files', - 'STAGE_VERSION_CHECK' => 'Version check', - 'STATUS_CONFLICT' => 'Modified file producing conflicts', - 'STATUS_DELETED' => 'Deleted file', - 'STATUS_MODIFIED' => 'Modified file', - 'STATUS_NEW' => 'New file', - 'STATUS_NEW_CONFLICT' => 'Conflicting new file', - 'STATUS_NOT_MODIFIED' => 'Not modified file', - 'STATUS_UP_TO_DATE' => 'Already updated file', - - 'TOGGLE_DISPLAY' => 'View/Hide file list', - 'TRY_DOWNLOAD_METHOD' => 'You may want to try the download modified files method.
This method always works and is also the recommended update path.', - 'TRY_DOWNLOAD_METHOD_BUTTON'=> 'Try this method now', - - 'UPDATE_COMPLETED' => 'Update completed', - 'UPDATE_DATABASE' => 'Update database', - 'UPDATE_DATABASE_EXPLAIN' => 'Within the next step the database will be updated.', - 'UPDATE_DATABASE_SCHEMA' => 'Updating database schema', - 'UPDATE_FILES' => 'Update files', - 'UPDATE_FILES_NOTICE' => 'Please make sure you have updated your board files too, this file is only updating your database.', - 'UPDATE_INSTALLATION' => 'Update phpBB installation', - 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', - 'UPDATE_INSTRUCTIONS' => ' - -

Release announcement

- -

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

- -
- -

How to update your installation with the Automatic Update Package

- -

The recommended way of updating your installation listed here is only valid for the automatic update package. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 automatically are:

- -
    -
  • Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.

  • -
  • Unpack the archive.

  • -
  • Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  • -
- -

Once uploaded your board will be offline for normal users due to the install directory you uploaded now present.

- Now start the update process by pointing your browser to the install folder.
-
- You will then be guided through the update process. You will be notified once the update is complete. -

- ', - 'UPDATE_METHOD' => 'Update method', - 'UPDATE_METHOD_EXPLAIN' => 'You are now able to choose your preferred update method. Using the FTP upload will present you with a form you need to enter your FTP account details into. With this method the files will be automatically moved to the new location and backups of the old files being created by appending .bak to the filename. If you choose to download the modified files you are able to unpack and upload them to their correct location manually later.', - 'UPDATE_REQUIRES_FILE' => 'The updater requires that the following file is present: %s', - 'UPDATE_SUCCESS' => 'Update was successful', - 'UPDATE_SUCCESS_EXPLAIN' => 'Successfully updated all files. The next step involves checking all files again to make sure the files got updated correctly.', - 'UPDATE_VERSION_OPTIMIZE' => 'Updating version and optimising tables', - 'UPDATING_DATA' => 'Updating data', - 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', - 'UPDATED_VERSION' => 'Updated version', - 'UPLOAD_METHOD' => 'Upload method', - - 'UPDATE_DB_SUCCESS' => 'Database update was successful.', - 'UPDATE_FILE_SUCCESS' => 'File update was successful.', - 'USER_ACTIVE' => 'Active user', - 'USER_INACTIVE' => 'Inactive user', - - 'VERSION_CHECK' => 'Version check', - 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', - 'VERSION_NOT_UP_TO_DATE' => 'Your phpBB installation is not up to date. Please continue the update process.', - 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', - 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', - 'VERSION_UP_TO_DATE' => 'Your phpBB installation is up to date. Although there are no updates available at this time, you may continue in order to perform a file validity check.', - 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', - 'VIEWING_FILE_CONTENTS' => 'Viewing file contents', - 'VIEWING_FILE_DIFF' => 'Viewing file differences', - - 'WRONG_INFO_FILE_FORMAT' => 'Wrong info file format', -)); - -// Default database schema entries... -$lang = array_merge($lang, array( - 'CONFIG_BOARD_EMAIL_SIG' => 'Thanks, The Management', - 'CONFIG_SITE_DESC' => 'A short text to describe your forum', - 'CONFIG_SITENAME' => 'yourdomain.com', - - 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', - - 'FORUMS_FIRST_CATEGORY' => 'Your first category', - 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', - 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', - - 'RANKS_SITE_ADMIN_TITLE' => 'Site Admin', - 'REPORT_WAREZ' => 'The post contains links to illegal or pirated software.', - 'REPORT_SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', - 'REPORT_OFF_TOPIC' => 'The reported post is off topic.', - 'REPORT_OTHER' => 'The reported post does not fit into any other category, please use the further information field.', - - 'SMILIES_ARROW' => 'Arrow', - 'SMILIES_CONFUSED' => 'Confused', - 'SMILIES_COOL' => 'Cool', - 'SMILIES_CRYING' => 'Crying or Very Sad', - 'SMILIES_EMARRASSED' => 'Embarrassed', - 'SMILIES_EVIL' => 'Evil or Very Mad', - 'SMILIES_EXCLAMATION' => 'Exclamation', - 'SMILIES_GEEK' => 'Geek', - 'SMILIES_IDEA' => 'Idea', - 'SMILIES_LAUGHING' => 'Laughing', - 'SMILIES_MAD' => 'Mad', - 'SMILIES_MR_GREEN' => 'Mr. Green', - 'SMILIES_NEUTRAL' => 'Neutral', - 'SMILIES_QUESTION' => 'Question', - 'SMILIES_RAZZ' => 'Razz', - 'SMILIES_ROLLING_EYES' => 'Rolling Eyes', - 'SMILIES_SAD' => 'Sad', - 'SMILIES_SHOCKED' => 'Shocked', - 'SMILIES_SMILE' => 'Smile', - 'SMILIES_SURPRISED' => 'Surprised', - 'SMILIES_TWISTED_EVIL' => 'Twisted Evil', - 'SMILIES_UBER_GEEK' => 'Uber Geek', - 'SMILIES_VERY_HAPPY' => 'Very Happy', - 'SMILIES_WINK' => 'Wink', - - 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', -)); From 97d08d6f56cf448fd4def8a4d29c570da91faa89 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 22 Jul 2015 03:16:16 +0200 Subject: [PATCH 53/75] [ticket/13740] Allow language change in the installer PHPBB3-13740 --- phpBB/adm/style/install_header.html | 8 +- phpBB/assets/javascript/installer.js | 3 + .../container/services_install_controller.yml | 1 + phpBB/phpbb/install/controller/helper.php | 243 ++++++++++++------ phpBB/phpbb/install/controller/install.php | 2 +- .../install/controller/installer_index.php | 2 +- phpBB/phpbb/language/language.php | 48 +++- 7 files changed, 212 insertions(+), 95 deletions(-) diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index b162fa3e89..9d0f9a56de 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -15,10 +15,14 @@

{L_INSTALL_PANEL}

{L_SKIP}

-
+
- {S_LANG_SELECT} +
diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 105818f82b..91e8eb4797 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -330,6 +330,9 @@ xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhReq.send(getFormFields($form, $submitBtn)); + // Disable language selector + $('#language_selector :input, label').css('display', 'none'); + // Clear content setupAjaxLayout(); $('#loading_indicator').css('display', 'block'); diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml index 7acc7025a6..a3595ff0a3 100644 --- a/phpBB/config/installer/container/services_install_controller.yml +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -15,6 +15,7 @@ services: - @installer.navigation.provider - @template - @path_helper + - @request - @symfony_request - @router - %core.root_path% diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 569938be09..5fd0abf9c7 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -17,10 +17,13 @@ use phpbb\install\helper\navigation\navigation_provider; use phpbb\language\language; use phpbb\language\language_file_helper; use phpbb\path_helper; +use phpbb\request\request; +use phpbb\request\request_interface; use phpbb\routing\router; use phpbb\symfony_request; use phpbb\template\template; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Cookie; /** * A duplicate of \phpbb\controller\helper @@ -35,6 +38,11 @@ class helper */ protected $language; + /** + * @var bool|string + */ + protected $language_cookie; + /** * @var \phpbb\language\language_file_helper */ @@ -55,6 +63,11 @@ class helper */ protected $path_helper; + /** + * @var \phpbb\request\request + */ + protected $phpbb_request; + /** * @var \phpbb\symfony_request */ @@ -83,120 +96,58 @@ class helper * @param navigation_provider $nav * @param template $template * @param path_helper $path_helper + * @param request $phpbb_request * @param symfony_request $request * @param router $router * @param string $phpbb_root_path */ - public function __construct(language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, symfony_request $request, router $router, $phpbb_root_path) + public function __construct(language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, request $phpbb_request, symfony_request $request, router $router, $phpbb_root_path) { $this->language = $language; + $this->language_cookie = false; $this->lang_helper = $lang_helper; $this->navigation_provider = $nav; $this->template = $template; $this->path_helper = $path_helper; + $this->phpbb_request = $phpbb_request; $this->request = $request; $this->router = $router; $this->phpbb_root_path = $phpbb_root_path; $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; + + $this->handle_language_select(); } /** * Automate setting up the page and creating the response object. * - * @param string $template_file The template handle to render - * @param string $page_title The title of the page to output - * @param int $status_code The status code to be sent to the page header + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param bool $selected_language True to enable language selector it, false otherwise + * @param int $status_code The status code to be sent to the page header * * @return Response object containing rendered page */ - public function render($template_file, $page_title = '', $status_code = 200) + public function render($template_file, $page_title = '', $selected_language = false, $status_code = 200) { - $this->page_header($page_title); + $this->page_header($page_title, $selected_language); $this->template->set_filenames(array( 'body' => $template_file, )); - return new Response($this->template->assign_display('body'), $status_code); - } + $response = new Response($this->template->assign_display('body'), $status_code); - /** - * Set default template variables - * - * @param string $page_title - */ - protected function page_header($page_title) - { - $this->template->assign_vars(array( - 'L_CHANGE' => $this->language->lang('CHANGE'), - 'L_COLON' => $this->language->lang('COLON'), - 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), - 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), - 'L_SKIP' => $this->language->lang('SKIP'), - 'PAGE_TITLE' => $this->language->lang($page_title), - 'T_IMAGE_PATH' => htmlspecialchars($this->phpbb_admin_path) . 'images/', - 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . 'assets/javascript/jquery.min.js', - 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . 'adm/style', - 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . 'assets/', - - 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), - 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', - 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', - 'S_CONTENT_ENCODING' => 'UTF-8', - - 'S_USER_LANG' => $this->language->lang('USER_LANG'), - ) - ); - - $this->render_navigation(); - } - - /** - * Render navigation - */ - protected function render_navigation() - { - // Get navigation items - $nav_array = $this->navigation_provider->get(); - $nav_array = $this->sort_navigation_level($nav_array); - - $active_main_menu = $this->get_active_main_menu($nav_array); - - // Pass navigation to template - foreach ($nav_array as $key => $entry) + // Set language cookie + if ($this->language_cookie !== false) { - $this->template->assign_block_vars('t_block1', array( - 'L_TITLE' => $this->language->lang($entry['label']), - 'S_SELECTED' => ($active_main_menu === $key), - 'U_TITLE' => $this->route($entry['route']), - )); + $cookie = new Cookie('lang', $this->language_cookie, time() + 3600); + $response->headers->setCookie($cookie); - if (is_array($entry[0]) && $active_main_menu === $key) - { - $entry[0] = $this->sort_navigation_level($entry[0]); - - foreach ($entry[0] as $name => $sub_entry) - { - if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) - { - $this->template->assign_block_vars('l_block2', array( - 'L_TITLE' => $this->language->lang($sub_entry['label']), - 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), - 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), - 'STAGE_NAME' => $name, - )); - } - else - { - $this->template->assign_block_vars('l_block1', array( - 'L_TITLE' => $this->language->lang($sub_entry['label']), - 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), - 'U_TITLE' => $this->route($sub_entry['route']), - )); - } - } - } + $this->language_cookie = false; } + + return $response; } /** @@ -214,12 +165,134 @@ class helper } /** - * Render language select form + * Handles language selector form */ - protected function render_language_select() + protected function handle_language_select() + { + $lang = null; + + // Check if language form has been submited + $submit = $this->phpbb_request->variable('change_lang', ''); + if (!empty($submit)) + { + $lang = $this->phpbb_request->variable('language', ''); + + if (!empty($lang)) + { + $this->language_cookie = $lang; + } + } + + // Retrive language from cookie + $lang_cookie = $this->phpbb_request->variable('lang', '', false, request_interface::COOKIE); + if (empty($lang) && !empty($lang_cookie)) + { + $lang = $lang_cookie; + $this->language_cookie = $lang; + } + + $lang = (!empty($lang)) ? $lang : null; + $this->render_language_select($lang); + + if ($lang !== null) + { + $this->language->set_user_language($lang, true); + } + } + + /** + * Set default template variables + * + * @param string $page_title Title of the page + * @param bool $selected_language True to enable language selector it, false otherwise + */ + protected function page_header($page_title, $selected_language = false) + { + $this->template->assign_vars(array( + 'L_CHANGE' => $this->language->lang('CHANGE'), + 'L_COLON' => $this->language->lang('COLON'), + 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), + 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), + 'L_SKIP' => $this->language->lang('SKIP'), + 'PAGE_TITLE' => $this->language->lang($page_title), + 'T_IMAGE_PATH' => htmlspecialchars($this->phpbb_admin_path) . 'images/', + 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . 'assets/javascript/jquery.min.js', + 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . 'adm/style', + 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . 'assets/', + + 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), + 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_LANG_SELECT' => $selected_language, + + 'S_USER_LANG' => $this->language->lang('USER_LANG'), + ) + ); + + $this->render_navigation(); + } + + + + /** + * Render navigation + */ + protected function render_navigation() + { + // Get navigation items + $nav_array = $this->navigation_provider->get(); + $nav_array = $this->sort_navigation_level($nav_array); + + $active_main_menu = $this->get_active_main_menu($nav_array); + + // Pass navigation to template + foreach ($nav_array as $key => $entry) { + $this->template->assign_block_vars('t_block1', array( + 'L_TITLE' => $this->language->lang($entry['label']), + 'S_SELECTED' => ($active_main_menu === $key), + 'U_TITLE' => $this->route($entry['route']), + )); + + if (is_array($entry[0]) && $active_main_menu === $key) { + $entry[0] = $this->sort_navigation_level($entry[0]); + + foreach ($entry[0] as $name => $sub_entry) { + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } else { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } + } + } + } + } + + /** + * Render language select form + * + * @param string $selected_language + */ + protected function render_language_select($selected_language = null) { $langs = $this->lang_helper->get_available_languages(); - // @todo Implement language change option + foreach ($langs as $lang) + { + $this->template->assign_block_vars('language_select_item', array( + 'VALUE' => $lang['iso'], + 'NAME' => $lang['local_name'], + 'SELECTED' => ($lang['iso'] === $selected_language), + )); + } } /** diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index b3103c8284..da806948fb 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -189,7 +189,7 @@ class install 'TITLE' => $this->language->lang('INSTALL_INTRO'), 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), )); - return $this->controller_helper->render('installer_install.html', 'INSTALL'); + return $this->controller_helper->render('installer_install.html', 'INSTALL', true); } // @todo: implement no js controller logic diff --git a/phpBB/phpbb/install/controller/installer_index.php b/phpBB/phpbb/install/controller/installer_index.php index 3d5224f1be..0a1855f4e5 100644 --- a/phpBB/phpbb/install/controller/installer_index.php +++ b/phpBB/phpbb/install/controller/installer_index.php @@ -74,6 +74,6 @@ class installer_index 'BODY' => $body, )); - return $this->helper->render('install_main.html', $title); + return $this->helper->render('install_main.html', $title, true); } } diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php index b2b9f5ce12..44131e3da3 100644 --- a/phpBB/phpbb/language/language.php +++ b/phpBB/phpbb/language/language.php @@ -109,25 +109,27 @@ class language /** * Function to set user's language to display. * - * @param string $user_lang_iso ISO code of the User's language + * @param string $user_lang_iso ISO code of the User's language + * @param bool $reload Whether or not to reload language files */ - public function set_user_language($user_lang_iso) + public function set_user_language($user_lang_iso, $reload = false) { $this->user_language = $user_lang_iso; - $this->set_fallback_array(); + $this->set_fallback_array($reload); } /** * Function to set the board's default language to display. * * @param string $default_lang_iso ISO code of the board's default language + * @param bool $reload Whether or not to reload language files */ - public function set_default_language($default_lang_iso) + public function set_default_language($default_lang_iso, $reload = false) { $this->default_language = $default_lang_iso; - $this->set_fallback_array(); + $this->set_fallback_array($reload); } /** @@ -508,9 +510,11 @@ class language /** * Returns language fallback data * + * @param bool $reload Whether or not to reload language files + * * @return array */ - protected function set_fallback_array() + protected function set_fallback_array($reload = false) { $fallback_array = array(); @@ -527,6 +531,11 @@ class language $fallback_array[] = self::FALLBACK_LANGUAGE; $this->language_fallback = $fallback_array; + + if ($reload) + { + $this->reload_language_files(); + } } /** @@ -563,4 +572,31 @@ class language $this->loader->load_extension($extension_name, $component, $this->language_fallback, $this->lang); $this->loaded_language_sets['ext'][$extension_name][$component] = true; } + + /** + * Reload language files + */ + protected function reload_language_files() + { + $loaded_files = $this->loaded_language_sets; + $this->loaded_language_sets = array( + 'core' => array(), + 'ext' => array(), + ); + + // Reload core files + foreach ($loaded_files['core'] as $component => $value) + { + $this->load_core_file($component); + } + + // Reload extension files + foreach ($loaded_files['ext'] as $ext_name => $ext_info) + { + foreach ($ext_info as $ext_component => $value) + { + $this->load_extension($ext_name, $ext_component); + } + } + } } From 0c49b88dde77894a91145314d2d3bf4388082075 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 22 Jul 2015 04:01:52 +0200 Subject: [PATCH 54/75] [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 5fd0abf9c7..f3400e6ef0 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -233,8 +233,6 @@ class helper $this->render_navigation(); } - - /** * Render navigation */ @@ -247,25 +245,31 @@ class helper $active_main_menu = $this->get_active_main_menu($nav_array); // Pass navigation to template - foreach ($nav_array as $key => $entry) { + foreach ($nav_array as $key => $entry) + { $this->template->assign_block_vars('t_block1', array( 'L_TITLE' => $this->language->lang($entry['label']), 'S_SELECTED' => ($active_main_menu === $key), 'U_TITLE' => $this->route($entry['route']), )); - if (is_array($entry[0]) && $active_main_menu === $key) { + if (is_array($entry[0]) && $active_main_menu === $key) + { $entry[0] = $this->sort_navigation_level($entry[0]); - foreach ($entry[0] as $name => $sub_entry) { - if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) { + foreach ($entry[0] as $name => $sub_entry) + { + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { $this->template->assign_block_vars('l_block2', array( 'L_TITLE' => $this->language->lang($sub_entry['label']), 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), 'STAGE_NAME' => $name, )); - } else { + } + else + { $this->template->assign_block_vars('l_block1', array( 'L_TITLE' => $this->language->lang($sub_entry['label']), 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), From 3356130ce2adf82248cf64fcaa81a47713ce7987 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Wed, 22 Jul 2015 12:43:17 +0200 Subject: [PATCH 55/75] [ticket/13740] Separate new installer style templates PHPBB3-13740 --- phpBB/adm/style/install_header.html | 10 +--- phpBB/adm/style/installer_footer.html | 21 +++++++ phpBB/adm/style/installer_header.html | 57 +++++++++++++++++++ phpBB/adm/style/installer_install.html | 4 +- phpBB/adm/style/installer_main.html | 6 ++ .../install/controller/installer_index.php | 2 +- 6 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 phpBB/adm/style/installer_footer.html create mode 100644 phpBB/adm/style/installer_header.html create mode 100644 phpBB/adm/style/installer_main.html diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index 9d0f9a56de..8debfc69c0 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -15,14 +15,10 @@

{L_INSTALL_PANEL}

{L_SKIP}

-
+
- + {S_LANG_SELECT}
@@ -47,7 +43,7 @@ id="activemenu">{l_block1.L_TITLE} - id="activemenu"> class="completed" id="installer-stage-{l_block2.STAGE_NAME}">{l_block2.L_TITLE} + id="activemenu"> class="completed">{l_block2.L_TITLE}
diff --git a/phpBB/adm/style/installer_footer.html b/phpBB/adm/style/installer_footer.html new file mode 100644 index 0000000000..2c70d4d5d3 --- /dev/null +++ b/phpBB/adm/style/installer_footer.html @@ -0,0 +1,21 @@ +
+
+
+
+
+ + +
+ + + + + +{$SCRIPTS} + + + diff --git a/phpBB/adm/style/installer_header.html b/phpBB/adm/style/installer_header.html new file mode 100644 index 0000000000..ada6553aec --- /dev/null +++ b/phpBB/adm/style/installer_header.html @@ -0,0 +1,57 @@ + + + + + + {META} + {PAGE_TITLE} + + + + + +
+ + +
+
+ +
+ +
+
+ + +
+
diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html index 7700c79036..175c6eac67 100644 --- a/phpBB/adm/style/installer_install.html +++ b/phpBB/adm/style/installer_install.html @@ -1,4 +1,4 @@ - +

{TITLE}

{CONTENT}

@@ -10,4 +10,4 @@ - + diff --git a/phpBB/adm/style/installer_main.html b/phpBB/adm/style/installer_main.html new file mode 100644 index 0000000000..ed65da8a68 --- /dev/null +++ b/phpBB/adm/style/installer_main.html @@ -0,0 +1,6 @@ + + +

{TITLE}

+

{BODY}

+ + diff --git a/phpBB/phpbb/install/controller/installer_index.php b/phpBB/phpbb/install/controller/installer_index.php index 0a1855f4e5..8e1874984b 100644 --- a/phpBB/phpbb/install/controller/installer_index.php +++ b/phpBB/phpbb/install/controller/installer_index.php @@ -74,6 +74,6 @@ class installer_index 'BODY' => $body, )); - return $this->helper->render('install_main.html', $title, true); + return $this->helper->render('installer_main.html', $title, true); } } From 98d9d92aa7794316239fbda2a15a91618aef0879 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 04:27:31 +0200 Subject: [PATCH 56/75] [ticket/13740] Secure installer config against corrupted config data PHPBB3-13740 --- phpBB/phpbb/install/helper/config.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index 457b64b301..38376da82a 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -224,11 +224,19 @@ class config $file_content = @file_get_contents($this->install_config_file); $serialized_data = trim(substr($file_content, 8)); - $unserialized_data = unserialize($serialized_data); - $this->installer_config = $unserialized_data['installer_config']; - $this->progress_data = $unserialized_data['progress_data']; - $this->navigation_data = $unserialized_data['navigation_data']; + $this->installer_config = array(); + $this->progress_data = array(); + $this->navigation_data = array(); + + if (!empty($serialized_data)) + { + $unserialized_data = unserialize($serialized_data); + + $this->installer_config = (is_array($unserialized_data['installer_config'])) ? $unserialized_data['installer_config'] : array(); + $this->progress_data = (is_array($unserialized_data['progress_data'])) ? $unserialized_data['progress_data'] : array(); + $this->navigation_data = (is_array($unserialized_data['navigation_data'])) ? $unserialized_data['navigation_data'] : array(); + } } /** From dd31020fb3dd4ab96b48dd1854f73190900319b1 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 16:43:20 +0200 Subject: [PATCH 57/75] [ticket/13740] Enhance server output buffer bypass PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index da806948fb..469e2608a4 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -167,6 +167,9 @@ class install $installer->run(); }); + // Try to bypass any server output buffers + $response->headers->set('X-Accel-Buffering', 'no'); + return $response; } else From fbd5929606169d3f780f0a59760c171b20bd906d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 20:50:33 +0200 Subject: [PATCH 58/75] [ticket/13740] Login admin when install finished PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 18 ++++++++ .../install/helper/container_factory.php | 5 +++ .../helper/iohandler/ajax_iohandler.php | 23 +++++++++++ .../helper/iohandler/cli_iohandler.php | 7 ++++ .../helper/iohandler/iohandler_interface.php | 8 ++++ .../install_finish/task/notify_user.php | 41 +++++++++++++++---- phpBB/phpbb/session.php | 6 +++ 7 files changed, 101 insertions(+), 7 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 91e8eb4797..4640d03de7 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -165,6 +165,19 @@ } } + // Set cookies + function setCookies(cookies) { + var cookie; + + for (var i = 0; i < cookies.length; i++) { + // Set cookie name and value + cookie = encodeURIComponent(cookies[i].name) + '=' + encodeURIComponent(cookies[i].value); + // Set path + cookie += '; path=/'; + document.cookie = cookie; + } + } + /** * Parse messages from the response object * @@ -199,6 +212,10 @@ if (responseObject.hasOwnProperty('nav')) { updateNavbarStatus(responseObject.nav); } + + if (responseObject.hasOwnProperty('cookies')) { + setCookies(responseObject.cookies); + } } /** @@ -321,6 +338,7 @@ $contentWrapper.append($spinner); } + // Submits a form function submitForm($form, $submitBtn) { $form.css('display', 'none'); diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index eb44b470b7..e09e43be34 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -13,6 +13,7 @@ namespace phpbb\install\helper; +use phpbb\cache\driver\dummy; use phpbb\install\exception\cannot_build_container_exception; class container_factory @@ -152,6 +153,10 @@ class container_factory // this container $this->container->register('request')->setSynthetic(true); $this->container->set('request', $this->request); + + // Replace cache service, as config gets cached, and we don't want that + $this->container->register('cache.driver')->setSynthetic(true); + $this->container->set('cache.driver', new dummy()); $this->container->compile(); // Restore super globals to previous state diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index ce1112c7a1..fa628f3365 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -43,6 +43,11 @@ class ajax_iohandler extends iohandler_base */ protected $nav_data; + /** + * @var array + */ + protected $cookies; + /** * Constructor * @@ -55,6 +60,7 @@ class ajax_iohandler extends iohandler_base $this->template = $template; $this->form = ''; $this->nav_data = array(); + $this->cookies = array(); parent::__construct(); } @@ -214,6 +220,12 @@ class ajax_iohandler extends iohandler_base $this->request_client_refresh = false; } + if (!empty($this->cookies)) + { + $json_array['cookies'] = $this->cookies; + $this->cookies = array(); + } + return $json_array; } @@ -252,6 +264,17 @@ class ajax_iohandler extends iohandler_base $this->send_response(); } + /** + * {@inheritdoc} + */ + public function set_cookie($cookie_name, $cookie_value) + { + $this->cookies[] = array( + 'name' => $cookie_name, + 'value' => $cookie_value + ); + } + /** * Callback function for language replacing * diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php index bf68f363c3..c5b2bb06bc 100644 --- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php @@ -255,4 +255,11 @@ class cli_iohandler extends iohandler_base public function set_finished_stage_menu($menu_path) { } + + /** + * {@inheritdoc} + */ + public function set_cookie($cookie_name, $cookie_value) + { + } } diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php index 44b409bb0a..5f5f8499d6 100644 --- a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php +++ b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php @@ -163,4 +163,12 @@ interface iohandler_interface * @param string $message_lang_key Language key for the message */ public function finish_progress($message_lang_key); + + /** + * Sends and sets cookies + * + * @param string $cookie_name Name of the cookie to set + * @param string $cookie_value Value of the cookie to set + */ + public function set_cookie($cookie_name, $cookie_value); } diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php index baffaf2228..a433d342d0 100644 --- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -12,6 +12,7 @@ */ namespace phpbb\install\module\install_finish\task; +use phpbb\config\db; /** * Logs installation and sends an email to the admin @@ -73,11 +74,17 @@ class notify_user extends \phpbb\install\task_base $this->iohandler = $iohandler; $this->auth = $container->get('auth'); - $this->config = $container->get('config'); $this->log = $container->get('log'); $this->user = $container->get('user'); $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; + + // We need to reload config for cases when it doesn't have all values + $this->config = new db( + $container->get('dbal.conn'), + $container->get('cache.driver'), + $container->get_parameter('tables.config') + ); } /** @@ -85,11 +92,8 @@ class notify_user extends \phpbb\install\task_base */ public function run() { - // @todo Login user after installation has been finished - //$this->user->setup('common'); - - //$this->user->session_begin(); - //$this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_pass1'), false, true, true); + $this->user->session_begin(); + $this->user->setup('common'); if ($this->config['email_enable']) { @@ -106,8 +110,31 @@ class notify_user extends \phpbb\install\task_base $messenger->send(NOTIFY_EMAIL); } - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version'])); + // Login admin + // Ugly but works + $this->auth->login( + $this->install_config->get('admin_name'), + $this->install_config->get('admin_passwd'), + false, + true, + true + ); + $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id); + $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']); + $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']); + + // Create log + $this->log->add( + 'admin', + $this->user->data['user_id'], + $this->user->ip, + 'LOG_INSTALL_INSTALLED', + false, + array($this->config['version']) + ); + + // Remove install_lock @unlink($this->phpbb_root_path . 'cache/install_lock'); } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 6154f384f3..91b657262c 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1076,6 +1076,12 @@ class session { global $config; + // If headers are already set, we just return + if (headers_sent()) + { + return; + } + $name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata); $expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime); $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain']; From e08f1341127792e378580a10bbb0bdeafe93ff8d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 22:55:31 +0200 Subject: [PATCH 59/75] [ticket/13740] Fix is_phpbb_installed() method PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 2 +- phpBB/phpbb/install/helper/install_helper.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 469e2608a4..904f5920c2 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -111,7 +111,7 @@ class install { if ($this->install_helper->is_phpbb_installed()) { - throw new http_exception(404, 'PAGE_NOT_FOUND'); + die ('phpBB is already installed'); } $this->template->assign_vars(array( diff --git a/phpBB/phpbb/install/helper/install_helper.php b/phpBB/phpbb/install/helper/install_helper.php index c1506de5bf..ffe36cd645 100644 --- a/phpBB/phpbb/install/helper/install_helper.php +++ b/phpBB/phpbb/install/helper/install_helper.php @@ -47,14 +47,14 @@ class install_helper */ public function is_phpbb_installed() { - $config_path = $this->phpbb_root_path . 'config' . $this->php_ext; + $config_path = $this->phpbb_root_path . 'config.' . $this->php_ext; $install_lock_path = $this->phpbb_root_path . 'cache/install_lock'; - if (file_exists($config_path) && !file_exists($install_lock_path)) + if (file_exists($config_path) && !file_exists($install_lock_path) && filesize($config_path)) { - include_once $config_path; + return true; } - return defined('PHPBB_INSTALLED'); + return false; } } From 115029b6012d4adf11f773a31463c8f8daf9529e Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 23:23:06 +0200 Subject: [PATCH 60/75] [ticket/13740] Fix $script_path in obtain_data PHPBB3-13740 --- .../install/module/obtain_data/task/obtain_server_data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php index 2d1e37b10e..654b5534a9 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_server_data.php @@ -73,7 +73,7 @@ class obtain_server_data extends \phpbb\install\task_base implements \phpbb\inst } $script_path = str_replace(array('\\', '//'), '/', $script_path); - $script_path = trim(dirname(dirname($script_path))); + $script_path = trim(dirname(dirname(dirname($script_path)))); // Because we are in install/app.php/route_name // Server data $cookie_secure = $this->io_handler->get_input('cookie_secure', $cookie_secure); From 3840882b93e96f8f510d4086d650bb9df55873ca Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 23:35:20 +0200 Subject: [PATCH 61/75] [ticket/13740] Add success message when install finished PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 10 +++++++++- phpBB/language/en/install_new.php | 2 ++ phpBB/phpbb/install/installer.php | 29 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 4640d03de7..da30f136bd 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -52,7 +52,7 @@ if (messages[i].hasOwnProperty('description')) { $description = $(document.createElement('p')); - $description.text(messages[i].description); + $description.html(messages[i].description); $msgElement.append($description); } @@ -69,6 +69,10 @@ $msgElement.addClass('log'); $logContainer.append($msgElement); break; + case 'success': + $msgElement.addClass('successbox'); + $errorContainer.prepend($msgElement); + break; } } } @@ -201,6 +205,10 @@ addMessage('log', responseObject.logs); } + if (responseObject.hasOwnProperty('success')) { + addMessage('success', responseObject.success); + } + if (responseObject.hasOwnProperty('form')) { addForm(responseObject.form); } diff --git a/phpBB/language/en/install_new.php b/phpBB/language/en/install_new.php index 607565fcd0..923601b110 100644 --- a/phpBB/language/en/install_new.php +++ b/phpBB/language/en/install_new.php @@ -80,6 +80,8 @@ $lang = array_merge($lang, array(

Only those databases supported on your server will be displayed.', + + 'ACP_LINK' => 'Take me to the ACP', )); // Requirements translation diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 0e19129247..cb4ddb8783 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -18,6 +18,7 @@ use phpbb\install\exception\installer_config_not_writable_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\iohandler_interface; class installer @@ -171,6 +172,34 @@ class installer // Installation finished $install_finished = true; + + if ($this->iohandler instanceof cli_iohandler) + { + $this->iohandler->add_success_message('INSTALLER_FINISHED'); + } + else + { + global $SID; + + // Construct ACP url + $acp_url = $protocol = $this->install_config->get('server_protocol'); + $acp_url .= $this->install_config->get('server_name'); + $port = $this->install_config->get('server_port'); + + if (!((strpos($protocol, 'https:') === 0 && $port === 443) + || (strpos($protocol, 'http:') === 0 && $port === 80))) + { + $acp_url .= ':' . $port; + } + + $acp_url .= $this->install_config->get('script_path'); + $acp_url .= '/adm/index.php' . $SID; + + $this->iohandler->add_success_message('INSTALLER_FINISHED', array( + 'ACP_LINK', + $acp_url, + )); + } } catch (user_interaction_required_exception $e) { From 27d2d58e0529172de7d0403292bc10842a45ef98 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 23 Jul 2015 23:46:36 +0200 Subject: [PATCH 62/75] [ticket/13740] Use tabs instead of spaces in JS file PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 660 +++++++++++++-------------- 1 file changed, 330 insertions(+), 330 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index da30f136bd..4e44e2755c 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -3,398 +3,398 @@ */ (function($) { // Avoid conflicts with other libraries - 'use strict'; + 'use strict'; - // Installer variables - var pollTimer = null; - var nextReadPosition = 0; - var progressBarTriggered = false; - var progressTimer = null; - var currentProgress = 0; + // Installer variables + var pollTimer = null; + var nextReadPosition = 0; + var progressBarTriggered = false; + var progressTimer = null; + var currentProgress = 0; - // Template related variables - var $contentWrapper = $('.install-body').find('.main'); + // Template related variables + var $contentWrapper = $('.install-body').find('.main'); - // Intercept form submits - interceptFormSubmit($('#install_install')); + // Intercept form submits + interceptFormSubmit($('#install_install')); - /** - * Creates an XHR object - * - * jQuery cannot be used as the response is streamed, and - * as of now, jQuery does not provide access to the response until - * the connection is not closed. - * - * @return XMLHttpRequest - */ - function createXhrObject() { - return new XMLHttpRequest(); - } + /** + * Creates an XHR object + * + * jQuery cannot be used as the response is streamed, and + * as of now, jQuery does not provide access to the response until + * the connection is not closed. + * + * @return XMLHttpRequest + */ + function createXhrObject() { + return new XMLHttpRequest(); + } - /** - * Displays error, warning and log messages - * - * @param type - * @param messages - */ - function addMessage(type, messages) { - // Get message containers - var $errorContainer = $('#error-container'); - var $warningContainer = $('#warning-container'); - var $logContainer = $('#log-container'); + /** + * Displays error, warning and log messages + * + * @param type + * @param messages + */ + function addMessage(type, messages) { + // Get message containers + var $errorContainer = $('#error-container'); + var $warningContainer = $('#warning-container'); + var $logContainer = $('#log-container'); - var $title, $description, $msgElement, arraySize = messages.length; - for (var i = 0; i < arraySize; i++) { - $msgElement = $('

'); - $title = $(document.createElement('strong')); - $title.text(messages[i].title); - $msgElement.append($title); + var $title, $description, $msgElement, arraySize = messages.length; + for (var i = 0; i < arraySize; i++) { + $msgElement = $('
'); + $title = $(document.createElement('strong')); + $title.text(messages[i].title); + $msgElement.append($title); - if (messages[i].hasOwnProperty('description')) { - $description = $(document.createElement('p')); - $description.html(messages[i].description); - $msgElement.append($description); - } + if (messages[i].hasOwnProperty('description')) { + $description = $(document.createElement('p')); + $description.html(messages[i].description); + $msgElement.append($description); + } - switch (type) { - case 'error': - $msgElement.addClass('errorbox'); - $errorContainer.append($msgElement); - break; - case 'warning': - $msgElement.addClass('warningbox'); - $warningContainer.append($msgElement); - break; - case 'log': - $msgElement.addClass('log'); - $logContainer.append($msgElement); - break; - case 'success': - $msgElement.addClass('successbox'); - $errorContainer.prepend($msgElement); - break; - } - } - } + switch (type) { + case 'error': + $msgElement.addClass('errorbox'); + $errorContainer.append($msgElement); + break; + case 'warning': + $msgElement.addClass('warningbox'); + $warningContainer.append($msgElement); + break; + case 'log': + $msgElement.addClass('log'); + $logContainer.append($msgElement); + break; + case 'success': + $msgElement.addClass('successbox'); + $errorContainer.prepend($msgElement); + break; + } + } + } - /** - * Displays a form from the response - * - * @param formHtml - */ - function addForm(formHtml) { - var $formContainer = $('#content-container'); - $formContainer.html(formHtml); - var $form = $('#install_install'); - interceptFormSubmit($form); - } + /** + * Displays a form from the response + * + * @param formHtml + */ + function addForm(formHtml) { + var $formContainer = $('#content-container'); + $formContainer.html(formHtml); + var $form = $('#install_install'); + interceptFormSubmit($form); + } - /** - * Handles navigation status updates - * - * @param navObj - */ - function updateNavbarStatus(navObj) { - var navID, $stage, $stageListItem, $active; - $active = $('#activemenu'); + /** + * Handles navigation status updates + * + * @param navObj + */ + function updateNavbarStatus(navObj) { + var navID, $stage, $stageListItem, $active; + $active = $('#activemenu'); - if (navObj.hasOwnProperty('finished')) { - // This should be an Array - var navItems = navObj.finished; + if (navObj.hasOwnProperty('finished')) { + // This should be an Array + var navItems = navObj.finished; - for (var i = 0; i < navItems.length; i++) { - navID = 'installer-stage-' + navItems[i]; - $stage = $('#' + navID); - $stageListItem = $stage.parent(); + for (var i = 0; i < navItems.length; i++) { + navID = 'installer-stage-' + navItems[i]; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); - if ($active.length && $active.is($stageListItem)) { - $active.removeAttr('id'); - } + if ($active.length && $active.is($stageListItem)) { + $active.removeAttr('id'); + } - $stage.addClass('completed'); - } - } + $stage.addClass('completed'); + } + } - if (navObj.hasOwnProperty('active')) { - navID = 'installer-stage-' + navObj.active; - $stage = $('#' + navID); - $stageListItem = $stage.parent(); + if (navObj.hasOwnProperty('active')) { + navID = 'installer-stage-' + navObj.active; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); - if ($active.length && !$active.is($stageListItem)) { - $active.removeAttr('id'); - } + if ($active.length && !$active.is($stageListItem)) { + $active.removeAttr('id'); + } - $stageListItem.attr('id', 'activemenu'); - } - } + $stageListItem.attr('id', 'activemenu'); + } + } - /** - * Renders progress bar - * - * @param progressObject - */ - function setProgress(progressObject) { - var $statusText, $progressBar, $progressText, $progressFiller; + /** + * Renders progress bar + * + * @param progressObject + */ + function setProgress(progressObject) { + var $statusText, $progressBar, $progressText, $progressFiller; - if (progressObject.task_name.length) { - if (!progressBarTriggered) { - // Create progress bar - var $contentContainer = $('#content-container'); + if (progressObject.task_name.length) { + if (!progressBarTriggered) { + // Create progress bar + var $contentContainer = $('#content-container'); - // Create progress bar elements - $progressBar = $('
'); - $progressBar.attr('id', 'progress-bar'); - $progressText = $('

'); - $progressText.attr('id', 'progress-bar-text'); - $progressFiller = $(''); - $progressFiller.attr('id', 'progress-bar-filler'); + // Create progress bar elements + $progressBar = $('

'); + $progressBar.attr('id', 'progress-bar'); + $progressText = $('

'); + $progressText.attr('id', 'progress-bar-text'); + $progressFiller = $(''); + $progressFiller.attr('id', 'progress-bar-filler'); - $statusText = $('

'); - $statusText.attr('id', 'progress-status-text'); + $statusText = $('

'); + $statusText.attr('id', 'progress-status-text'); - $progressBar.append($progressFiller); - $progressBar.append($progressText); + $progressBar.append($progressFiller); + $progressBar.append($progressText); - $contentContainer.append($statusText); - $contentContainer.append($progressBar); + $contentContainer.append($statusText); + $contentContainer.append($progressBar); - progressBarTriggered = true; - } else { - $statusText = $('#progress-status-text'); - } + progressBarTriggered = true; + } else { + $statusText = $('#progress-status-text'); + } - // Update progress bar - $statusText.text(progressObject.task_name + '…'); - incrementProgressBar(Math.round(progressObject.task_num / progressObject.task_count * 100)); - } - } + // Update progress bar + $statusText.text(progressObject.task_name + '…'); + incrementProgressBar(Math.round(progressObject.task_num / progressObject.task_count * 100)); + } + } - // Set cookies - function setCookies(cookies) { - var cookie; + // Set cookies + function setCookies(cookies) { + var cookie; - for (var i = 0; i < cookies.length; i++) { - // Set cookie name and value - cookie = encodeURIComponent(cookies[i].name) + '=' + encodeURIComponent(cookies[i].value); - // Set path - cookie += '; path=/'; - document.cookie = cookie; - } - } + for (var i = 0; i < cookies.length; i++) { + // Set cookie name and value + cookie = encodeURIComponent(cookies[i].name) + '=' + encodeURIComponent(cookies[i].value); + // Set path + cookie += '; path=/'; + document.cookie = cookie; + } + } - /** - * Parse messages from the response object - * - * @param messageJSON - */ - function parseMessage(messageJSON) { - $('#loading_indicator').css('display', 'none'); + /** + * Parse messages from the response object + * + * @param messageJSON + */ + function parseMessage(messageJSON) { + $('#loading_indicator').css('display', 'none'); - var responseObject = JSON.parse(messageJSON); + var responseObject = JSON.parse(messageJSON); - // Parse object - if (responseObject.hasOwnProperty('errors')) { - addMessage('error', responseObject.errors); - } + // Parse object + if (responseObject.hasOwnProperty('errors')) { + addMessage('error', responseObject.errors); + } - if (responseObject.hasOwnProperty('warnings')) { - addMessage('warning', responseObject.warnings); - } + if (responseObject.hasOwnProperty('warnings')) { + addMessage('warning', responseObject.warnings); + } - if (responseObject.hasOwnProperty('logs')) { - addMessage('log', responseObject.logs); - } + if (responseObject.hasOwnProperty('logs')) { + addMessage('log', responseObject.logs); + } - if (responseObject.hasOwnProperty('success')) { - addMessage('success', responseObject.success); - } + if (responseObject.hasOwnProperty('success')) { + addMessage('success', responseObject.success); + } - if (responseObject.hasOwnProperty('form')) { - addForm(responseObject.form); - } + if (responseObject.hasOwnProperty('form')) { + addForm(responseObject.form); + } - if (responseObject.hasOwnProperty('progress')) { - setProgress(responseObject.progress); - } + if (responseObject.hasOwnProperty('progress')) { + setProgress(responseObject.progress); + } - if (responseObject.hasOwnProperty('nav')) { - updateNavbarStatus(responseObject.nav); - } + if (responseObject.hasOwnProperty('nav')) { + updateNavbarStatus(responseObject.nav); + } - if (responseObject.hasOwnProperty('cookies')) { - setCookies(responseObject.cookies); - } - } + if (responseObject.hasOwnProperty('cookies')) { + setCookies(responseObject.cookies); + } + } - /** - * Process updates in streamed response - * - * @param xhReq XHR object - */ - function pollContent(xhReq) { - var messages = xhReq.responseText; - var msgSeparator = '}\n\n'; - var unprocessed, messageEndIndex, endOfMessageIndex, message; + /** + * Process updates in streamed response + * + * @param xhReq XHR object + */ + function pollContent(xhReq) { + var messages = xhReq.responseText; + var msgSeparator = '}\n\n'; + var unprocessed, messageEndIndex, endOfMessageIndex, message; - do { - unprocessed = messages.substring(nextReadPosition); - messageEndIndex = unprocessed.indexOf(msgSeparator); + do { + unprocessed = messages.substring(nextReadPosition); + messageEndIndex = unprocessed.indexOf(msgSeparator); - if (messageEndIndex !== -1) { - endOfMessageIndex = messageEndIndex + msgSeparator.length; - message = unprocessed.substring(0, endOfMessageIndex); - parseMessage(message); - nextReadPosition += endOfMessageIndex; - } - } while (messageEndIndex !== -1); + if (messageEndIndex !== -1) { + endOfMessageIndex = messageEndIndex + msgSeparator.length; + message = unprocessed.substring(0, endOfMessageIndex); + parseMessage(message); + nextReadPosition += endOfMessageIndex; + } + } while (messageEndIndex !== -1); - if (xhReq.readyState === 4) { - $('#loading_indicator').css('display', 'none'); - resetPolling(); - } - } + if (xhReq.readyState === 4) { + $('#loading_indicator').css('display', 'none'); + resetPolling(); + } + } - /** - * Animates the progress bar - * - * @param $progressText - * @param $progressFiller - * @param progressLimit - */ - function incrementFiller($progressText, $progressFiller, progressLimit) { - if (currentProgress >= progressLimit || currentProgress >= 100) { - clearInterval(progressTimer); - return; - } + /** + * Animates the progress bar + * + * @param $progressText + * @param $progressFiller + * @param progressLimit + */ + function incrementFiller($progressText, $progressFiller, progressLimit) { + if (currentProgress >= progressLimit || currentProgress >= 100) { + clearInterval(progressTimer); + return; + } - currentProgress++; - $progressText.text(currentProgress + '%'); - $progressFiller.css('width', currentProgress + '%'); - } + currentProgress++; + $progressText.text(currentProgress + '%'); + $progressFiller.css('width', currentProgress + '%'); + } - /** - * Wrapper function for progress bar rendering and animating - * - * @param progressLimit - */ - function incrementProgressBar(progressLimit) { - var $progressFiller = $('#progress-bar-filler'); - var $progressText = $('#progress-bar-text'); - var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; - currentProgress = Math.floor(progressStart); + /** + * Wrapper function for progress bar rendering and animating + * + * @param progressLimit + */ + function incrementProgressBar(progressLimit) { + var $progressFiller = $('#progress-bar-filler'); + var $progressText = $('#progress-bar-text'); + var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; + currentProgress = Math.floor(progressStart); - clearInterval(progressTimer); - progressTimer = setInterval(function() { - incrementFiller($progressText, $progressFiller, progressLimit); - }, 10); - } + clearInterval(progressTimer); + progressTimer = setInterval(function() { + incrementFiller($progressText, $progressFiller, progressLimit); + }, 10); + } - /** - * Resets the polling timer - */ - function resetPolling() { - clearInterval(pollTimer); - nextReadPosition = 0; - } + /** + * Resets the polling timer + */ + function resetPolling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } - /** - * Sets up timer for processing the streamed HTTP response - * - * @param xhReq - */ - function startPolling(xhReq) { - resetPolling(); - pollTimer = setInterval(function () { - pollContent(xhReq); - }, 250); - } + /** + * Sets up timer for processing the streamed HTTP response + * + * @param xhReq + */ + function startPolling(xhReq) { + resetPolling(); + pollTimer = setInterval(function () { + pollContent(xhReq); + }, 250); + } - /** - * Renders the AJAX UI layout - */ - function setupAjaxLayout() { - // Clear content - $contentWrapper.html(''); + /** + * Renders the AJAX UI layout + */ + function setupAjaxLayout() { + // Clear content + $contentWrapper.html(''); - var $header = $('

'); - $header.attr('id', 'header-container'); - $contentWrapper.append($header); + var $header = $('
'); + $header.attr('id', 'header-container'); + $contentWrapper.append($header); - var $description = $('
'); - $description.attr('id', 'description-container'); - $contentWrapper.append($description); + var $description = $('
'); + $description.attr('id', 'description-container'); + $contentWrapper.append($description); - var $errorContainer = $('
'); - $errorContainer.attr('id', 'error-container'); - $contentWrapper.append($errorContainer); + var $errorContainer = $('
'); + $errorContainer.attr('id', 'error-container'); + $contentWrapper.append($errorContainer); - var $warningContainer = $('
'); - $warningContainer.attr('id', 'warning-container'); - $contentWrapper.append($warningContainer); + var $warningContainer = $('
'); + $warningContainer.attr('id', 'warning-container'); + $contentWrapper.append($warningContainer); - var $installerContentWrapper = $('
'); - $installerContentWrapper.attr('id', 'content-container'); - $contentWrapper.append($installerContentWrapper); + var $installerContentWrapper = $('
'); + $installerContentWrapper.attr('id', 'content-container'); + $contentWrapper.append($installerContentWrapper); - var $logContainer = $('
'); - $logContainer.attr('id', 'log-container'); - $contentWrapper.append($logContainer); + var $logContainer = $('
'); + $logContainer.attr('id', 'log-container'); + $contentWrapper.append($logContainer); - var $spinner = $('
'); - $spinner.attr('id', 'loading_indicator'); - $spinner.html(' '); - $contentWrapper.append($spinner); - } + var $spinner = $('
'); + $spinner.attr('id', 'loading_indicator'); + $spinner.html(' '); + $contentWrapper.append($spinner); + } - // Submits a form - function submitForm($form, $submitBtn) { - $form.css('display', 'none'); + // Submits a form + function submitForm($form, $submitBtn) { + $form.css('display', 'none'); - var xhReq = createXhrObject(); - xhReq.open('POST', $form.attr('action'), true); - xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhReq.send(getFormFields($form, $submitBtn)); + var xhReq = createXhrObject(); + xhReq.open('POST', $form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhReq.send(getFormFields($form, $submitBtn)); - // Disable language selector - $('#language_selector :input, label').css('display', 'none'); + // Disable language selector + $('#language_selector :input, label').css('display', 'none'); - // Clear content - setupAjaxLayout(); - $('#loading_indicator').css('display', 'block'); + // Clear content + setupAjaxLayout(); + $('#loading_indicator').css('display', 'block'); - startPolling(xhReq); - } + startPolling(xhReq); + } - /** - * Add submit button to the POST information - * - * @param $form - * @param $submitBtn - * - * @returns {*} - */ - function getFormFields($form, $submitBtn) { - var formData = $form.serialize(); - formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; - formData += encodeURIComponent($submitBtn.attr('value')); + /** + * Add submit button to the POST information + * + * @param $form + * @param $submitBtn + * + * @returns {*} + */ + function getFormFields($form, $submitBtn) { + var formData = $form.serialize(); + formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; + formData += encodeURIComponent($submitBtn.attr('value')); - return formData; - } + return formData; + } - /** - * Intercept form submit events and determine the submit button used - * - * @param $form - */ - function interceptFormSubmit($form) { - if (!$form.length) { - return; - } + /** + * Intercept form submit events and determine the submit button used + * + * @param $form + */ + function interceptFormSubmit($form) { + if (!$form.length) { + return; + } - $form.find(':submit').bind('click', function (event) { - event.preventDefault(); - submitForm($form, $(this)); - }); - } + $form.find(':submit').bind('click', function (event) { + event.preventDefault(); + submitForm($form, $(this)); + }); + } })(jQuery); // Avoid conflicts with other libraries From cb593c0e04fc9f3318443fe42b596d27498729c3 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 00:04:40 +0200 Subject: [PATCH 63/75] [ticket/13740] Filter basic directory change attempts in lang change PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index f3400e6ef0..8530a0defe 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -191,7 +191,8 @@ class helper $this->language_cookie = $lang; } - $lang = (!empty($lang)) ? $lang : null; + $lang = (!empty($lang) && strpos($lang, '/')) ? $lang : null; + $this->render_language_select($lang); if ($lang !== null) From 22786a5b6fcdab1610b609ae069065c5d6691496 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 02:37:00 +0200 Subject: [PATCH 64/75] [ticket/13740] Fix CS PHPBB3-13740 --- phpBB/phpbb/install/controller/install.php | 1 - phpBB/phpbb/install/module/install_finish/task/notify_user.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 904f5920c2..c21b0d831b 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -13,7 +13,6 @@ namespace phpbb\install\controller; -use phpbb\exception\http_exception; use phpbb\install\helper\config; use phpbb\install\helper\install_helper; use phpbb\install\helper\navigation\navigation_provider; diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php index a433d342d0..0af76f6f60 100644 --- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -12,6 +12,7 @@ */ namespace phpbb\install\module\install_finish\task; + use phpbb\config\db; /** From b4552a8ba303881d53995d334cc22aa175d5c46f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 08:33:02 +0200 Subject: [PATCH 65/75] [ticket/13740] Replace more spaces with tabs PHPBB3-13740 --- phpBB/adm/style/admin.css | 38 +++++------ phpBB/adm/style/install_header.html | 4 +- phpBB/adm/style/installer_footer.html | 20 +++--- phpBB/adm/style/installer_form.html | 86 ++++++++++++------------ phpBB/adm/style/installer_header.html | 92 +++++++++++++------------- phpBB/adm/style/installer_install.html | 8 +-- phpBB/adm/style/installer_main.html | 4 +- 7 files changed, 126 insertions(+), 126 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index ca5daf5bc5..992af0997f 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -1801,7 +1801,7 @@ li.pagination ul { } .warningbox { - background-color: #fca600; + background-color: #fca600; } .successbox h3, .errorbox h3 { @@ -2523,28 +2523,28 @@ fieldset.permissions .padding { } #progress-bar { - position: relative; - width: 90%; - height: 25px; - margin: 20px auto; - border: 1px solid #cecece; + position: relative; + width: 90%; + height: 25px; + margin: 20px auto; + border: 1px solid #cecece; } #progress-bar #progress-bar-text { - position: absolute; - top: 0; - width: 100%; - text-align: center; - line-height: 25px; - font-weight: bold; + position: absolute; + top: 0; + width: 100%; + text-align: center; + line-height: 25px; + font-weight: bold; } #progress-bar #progress-bar-filler { - display: block; - position: relative; - top: 0; - left: 0; - background-color: #3c84ad; - width: 0; - height: 25px; + display: block; + position: relative; + top: 0; + left: 0; + background-color: #3c84ad; + width: 0; + height: 25px; } diff --git a/phpBB/adm/style/install_header.html b/phpBB/adm/style/install_header.html index 8debfc69c0..6f7f129d39 100644 --- a/phpBB/adm/style/install_header.html +++ b/phpBB/adm/style/install_header.html @@ -18,7 +18,7 @@
- {S_LANG_SELECT} + {S_LANG_SELECT}
@@ -43,7 +43,7 @@ id="activemenu">{l_block1.L_TITLE} - id="activemenu"> class="completed">{l_block2.L_TITLE} + id="activemenu"> class="completed">{l_block2.L_TITLE}
diff --git a/phpBB/adm/style/installer_footer.html b/phpBB/adm/style/installer_footer.html index 2c70d4d5d3..617d3dc254 100644 --- a/phpBB/adm/style/installer_footer.html +++ b/phpBB/adm/style/installer_footer.html @@ -1,14 +1,14 @@ -
-
-
-
-
+
+
+
+
+
- +
diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html index 3cb4185bc6..669f7aa834 100644 --- a/phpBB/adm/style/installer_form.html +++ b/phpBB/adm/style/installer_form.html @@ -4,53 +4,53 @@
- - - -
+ + + + -
- - {options.LEGEND} - +
+ + {options.LEGEND} + - -
-

{options.TITLE_EXPLAIN}
-
- - - - - - - - - - - - - - - checked /> {options.OPTIONS.label} - - -
-
- + +
+

{options.TITLE_EXPLAIN}
+
+ + + + + + + + + + + + + + + checked /> {options.OPTIONS.label} + + +
+
+
-
- {L_SUBMIT} - -
- - - +
+ {L_SUBMIT} + +
+ + + diff --git a/phpBB/adm/style/installer_header.html b/phpBB/adm/style/installer_header.html index ada6553aec..775caa7c67 100644 --- a/phpBB/adm/style/installer_header.html +++ b/phpBB/adm/style/installer_header.html @@ -1,57 +1,57 @@ - - - {META} - {PAGE_TITLE} + + + {META} + {PAGE_TITLE} - +
- + -
-
- -
+
+
+ +
-
-
- +
+
+ -
-
+
+
diff --git a/phpBB/adm/style/installer_install.html b/phpBB/adm/style/installer_install.html index 175c6eac67..53a91f2700 100644 --- a/phpBB/adm/style/installer_install.html +++ b/phpBB/adm/style/installer_install.html @@ -3,10 +3,10 @@

{CONTENT}

-
- {L_SUBMIT} - -
+
+ {L_SUBMIT} + +
diff --git a/phpBB/adm/style/installer_main.html b/phpBB/adm/style/installer_main.html index ed65da8a68..f14fe4da70 100644 --- a/phpBB/adm/style/installer_main.html +++ b/phpBB/adm/style/installer_main.html @@ -1,6 +1,6 @@ -

{TITLE}

-

{BODY}

+

{TITLE}

+

{BODY}

From 0d88b3f9e9f8d845044febce3c5df4f7e73b61f6 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 11:06:50 +0200 Subject: [PATCH 66/75] [ticket/13740] Fix message element creation in JS PHPBB3-13740 --- phpBB/assets/javascript/installer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/assets/javascript/installer.js b/phpBB/assets/javascript/installer.js index 4e44e2755c..56bfd6aea9 100644 --- a/phpBB/assets/javascript/installer.js +++ b/phpBB/assets/javascript/installer.js @@ -46,12 +46,12 @@ var $title, $description, $msgElement, arraySize = messages.length; for (var i = 0; i < arraySize; i++) { $msgElement = $('
'); - $title = $(document.createElement('strong')); + $title = $(''); $title.text(messages[i].title); $msgElement.append($title); if (messages[i].hasOwnProperty('description')) { - $description = $(document.createElement('p')); + $description = $('

'); $description.html(messages[i].description); $msgElement.append($description); } From fc46dec81397ef0183a91aeba795f65a4d755178 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 17:36:04 +0200 Subject: [PATCH 67/75] [ticket/13740] Fix CS in compatibilty_globals.php PHPBB3-13740 --- phpBB/includes/compatibility_globals.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php index fadc879640..ae532c0f13 100644 --- a/phpBB/includes/compatibility_globals.php +++ b/phpBB/includes/compatibility_globals.php @@ -12,7 +12,7 @@ */ /** - */ +*/ if (!defined('IN_PHPBB')) { exit; From be7e1ba7a0d35a86c4b41ab037e82a3a114108cb Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Fri, 24 Jul 2015 18:05:10 +0200 Subject: [PATCH 68/75] [ticket/13740] Use language service in console application PHPBB3-13740 --- phpBB/bin/phpbbcli.php | 3 ++- phpBB/phpbb/console/application.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index c847b884e0..18657aed0a 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -68,7 +68,8 @@ require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); $user = $phpbb_container->get('user'); $user->add_lang('acp/common'); $user->add_lang('cli'); +$lang = $phpbb_container->get('language'); -$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $user); +$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $lang); $application->register_container_commands($phpbb_container->get('console.command_collection')); $application->run($input); diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index 0943e8a4b8..2c69a3cc73 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -26,18 +26,18 @@ class application extends \Symfony\Component\Console\Application protected $in_shell = false; /** - * @var \phpbb\user User object + * @var \phpbb\language\language User object */ - protected $user; + protected $language; /** - * @param string $name The name of the application - * @param string $version The version of the application - * @param \phpbb\user $user The user which runs the application (used for translation) + * @param string $name The name of the application + * @param string $version The version of the application + * @param \phpbb\language\language $language The user which runs the application (used for translation) */ - public function __construct($name, $version, $user) + public function __construct($name, $version, \phpbb\language\language $language) { - $this->user = $user; + $this->language = $language; parent::__construct($name, $version); } @@ -53,7 +53,7 @@ class application extends \Symfony\Component\Console\Application 'safe-mode', null, InputOption::VALUE_NONE, - $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + $this->language->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') )); return $input_definition; @@ -80,7 +80,7 @@ class application extends \Symfony\Component\Console\Application '--shell', '-s', InputOption::VALUE_NONE, - $this->user->lang('CLI_DESCRIPTION_OPTION_SHELL') + $this->language->lang('CLI_DESCRIPTION_OPTION_SHELL') )); return parent::getHelp(); From 04186e8498c78d16f8eb5402c19d70e9e7795e83 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 25 Jul 2015 14:42:17 +0200 Subject: [PATCH 69/75] [ticket/13740] Fix comment PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 8530a0defe..6d591786c4 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -183,7 +183,7 @@ class helper } } - // Retrive language from cookie + // Retrieve language from cookie $lang_cookie = $this->phpbb_request->variable('lang', '', false, request_interface::COOKIE); if (empty($lang) && !empty($lang_cookie)) { From 723337d2f68940eff64586cc91151fad2c40ea6e Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 25 Jul 2015 14:42:37 +0200 Subject: [PATCH 70/75] [ticket/13740] Use JSON for installer config PHPBB3-13740 --- phpBB/phpbb/install/helper/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index 38376da82a..b0480e7e5b 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -231,7 +231,7 @@ class config if (!empty($serialized_data)) { - $unserialized_data = unserialize($serialized_data); + $unserialized_data = json_decode($serialized_data, true); $this->installer_config = (is_array($unserialized_data['installer_config'])) ? $unserialized_data['installer_config'] : array(); $this->progress_data = (is_array($unserialized_data['progress_data'])) ? $unserialized_data['progress_data'] : array(); @@ -259,7 +259,7 @@ class config // Create file content $file_content = ' Date: Sat, 25 Jul 2015 14:43:54 +0200 Subject: [PATCH 71/75] [ticket/13740] Deduplicate container builder's checks PHPBB3-13740 --- .../install/helper/container_factory.php | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index e09e43be34..dab16b81fd 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -73,16 +73,7 @@ class container_factory // Check if container was built, if not try to build it if ($this->container === null) { - // Check whether container can be built - // We need config.php for that so let's check if it has been set up yet - if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) - { - $this->build_container(); - } - else - { - throw new cannot_build_container_exception(); - } + $this->build_container(); } return ($service_name === null) ? $this->container : $this->container->get($service_name); @@ -102,16 +93,7 @@ class container_factory // Check if container was built, if not try to build it if ($this->container === null) { - // Check whether container can be built - // We need config.php for that so let's check if it has been set up yet - if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) - { - $this->build_container(); - } - else - { - throw new cannot_build_container_exception(); - } + $this->build_container(); } return $this->container->getParameter($param_name); @@ -119,6 +101,8 @@ class container_factory /** * Build dependency injection container + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built */ protected function build_container() { @@ -129,6 +113,17 @@ class container_factory return; } + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + $this->build_container(); + } + else + { + throw new cannot_build_container_exception(); + } + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); From 0befa9f10900238a2be2c3e50d85de3de9c5edec Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 25 Jul 2015 14:44:39 +0200 Subject: [PATCH 72/75] [ticket/13740] Move default data settings out of constructors PHPBB3-13740 --- phpBB/phpbb/install/helper/database.php | 173 +++++++++--------- .../module/install_data/task/add_bots.php | 169 +++++++++-------- .../module/install_data/task/add_modules.php | 172 +++++++++-------- 3 files changed, 251 insertions(+), 263 deletions(-) diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 27cb2dc828..627e9ea9b0 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -33,7 +33,91 @@ class database /** * @var array */ - protected $supported_dbms; + protected $supported_dbms = array( + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. + 'mysqli' => array( + 'LABEL' => 'MySQL with MySQLi Extension', + 'SCHEMA' => 'mysql_41', + 'MODULE' => 'mysqli', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysqli', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mysql' => array( + 'LABEL' => 'MySQL', + 'SCHEMA' => 'mysql', + 'MODULE' => 'mysql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql' => array( + 'LABEL' => 'MS SQL Server 2000+', + 'SCHEMA' => 'mssql', + 'MODULE' => 'mssql', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql_odbc'=> array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'odbc', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => 'GO', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'oracle' => array( + 'LABEL' => 'Oracle', + 'SCHEMA' => 'oracle', + 'MODULE' => 'oci8', + 'DELIM' => '/', + 'DRIVER' => 'phpbb\db\driver\oracle', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 8.3+', + 'SCHEMA' => 'postgres', + 'MODULE' => 'pgsql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\postgres', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'sqlite' => array( + 'LABEL' => 'SQLite', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + ); /** * Constructor @@ -45,93 +129,6 @@ class database { $this->filesystem = $filesystem; $this->phpbb_root_path = $phpbb_root_path; - - // DBMS supported by phpBB - $this->supported_dbms = array( - // Note: php 5.5 alpha 2 deprecated mysql. - // Keep mysqli before mysql in this list. - 'mysqli' => array( - 'LABEL' => 'MySQL with MySQLi Extension', - 'SCHEMA' => 'mysql_41', - 'MODULE' => 'mysqli', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\mysqli', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mysql' => array( - 'LABEL' => 'MySQL', - 'SCHEMA' => 'mysql', - 'MODULE' => 'mysql', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\mysql', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssql' => array( - 'LABEL' => 'MS SQL Server 2000+', - 'SCHEMA' => 'mssql', - 'MODULE' => 'mssql', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssql', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssql_odbc'=> array( - 'LABEL' => 'MS SQL Server [ ODBC ]', - 'SCHEMA' => 'mssql', - 'MODULE' => 'odbc', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssql_odbc', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'mssqlnative' => array( - 'LABEL' => 'MS SQL Server 2005+ [ Native ]', - 'SCHEMA' => 'mssql', - 'MODULE' => 'sqlsrv', - 'DELIM' => 'GO', - 'DRIVER' => 'phpbb\db\driver\mssqlnative', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - 'oracle' => array( - 'LABEL' => 'Oracle', - 'SCHEMA' => 'oracle', - 'MODULE' => 'oci8', - 'DELIM' => '/', - 'DRIVER' => 'phpbb\db\driver\oracle', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - 'postgres' => array( - 'LABEL' => 'PostgreSQL 8.3+', - 'SCHEMA' => 'postgres', - 'MODULE' => 'pgsql', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\postgres', - 'AVAILABLE' => true, - '2.0.x' => true, - ), - 'sqlite' => array( - 'LABEL' => 'SQLite', - 'SCHEMA' => 'sqlite', - 'MODULE' => 'sqlite', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\sqlite', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - 'sqlite3' => array( - 'LABEL' => 'SQLite3', - 'SCHEMA' => 'sqlite', - 'MODULE' => 'sqlite3', - 'DELIM' => ';', - 'DRIVER' => 'phpbb\db\driver\sqlite3', - 'AVAILABLE' => true, - '2.0.x' => false, - ), - ); } /** diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php index c31700e97f..b45d3808db 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_bots.php +++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php @@ -16,9 +16,91 @@ namespace phpbb\install\module\install_data\task; class add_bots extends \phpbb\install\task_base { /** + * A list of the web-crawlers/bots we recognise by default + * + * Candidates but not included: + * 'Accoona [Bot]' 'Accoona-AI-Agent/' + * 'ASPseek [Crawler]' 'ASPseek/' + * 'Boitho [Crawler]' 'boitho.com-dc/' + * 'Bunnybot [Bot]' 'powered by www.buncat.de' + * 'Cosmix [Bot]' 'cfetch/' + * 'Crawler Search [Crawler]' '.Crawler-Search.de' + * 'Findexa [Crawler]' 'Findexa Crawler (' + * 'GBSpider [Spider]' 'GBSpider v' + * 'genie [Bot]' 'genieBot (' + * 'Hogsearch [Bot]' 'oegp v. 1.3.0' + * 'Insuranco [Bot]' 'InsurancoBot' + * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' + * 'ISC Systems [Bot]' 'ISC Systems iRc Search' + * 'Jyxobot [Bot]' 'Jyxobot/' + * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' + * 'LinkWalker' 'LinkWalker' + * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' + * 'Naver [Bot]' 'nhnbot@naver.com)' + * 'NetResearchServer' 'NetResearchServer/' + * 'Nimble [Crawler]' 'NimbleCrawler' + * 'Ocelli [Bot]' 'Ocelli/' + * 'Onsearch [Bot]' 'onCHECK-Robot' + * 'Orange [Spider]' 'OrangeSpider' + * 'Sproose [Bot]' 'http://www.sproose.com/bot' + * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' + * 'Tbot [Bot]' 'Tbot/' + * 'Thumbshots [Capture]' 'thumbshots-de-Bot' + * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' + * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' + * 'WissenOnline [Bot]' 'WissenOnline-Bot' + * 'WWWeasel [Bot]' 'WWWeasel Robot v' + * 'Xaldon [Spider]' 'Xaldon WebSpider' + * * @var array */ - protected $bot_list; + protected $bot_list = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); /** * @var \phpbb\db\driver\driver_interface @@ -75,91 +157,6 @@ class add_bots extends \phpbb\install\task_base $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - - /** - * A list of the web-crawlers/bots we recognise by default - * - * Candidates but not included: - * 'Accoona [Bot]' 'Accoona-AI-Agent/' - * 'ASPseek [Crawler]' 'ASPseek/' - * 'Boitho [Crawler]' 'boitho.com-dc/' - * 'Bunnybot [Bot]' 'powered by www.buncat.de' - * 'Cosmix [Bot]' 'cfetch/' - * 'Crawler Search [Crawler]' '.Crawler-Search.de' - * 'Findexa [Crawler]' 'Findexa Crawler (' - * 'GBSpider [Spider]' 'GBSpider v' - * 'genie [Bot]' 'genieBot (' - * 'Hogsearch [Bot]' 'oegp v. 1.3.0' - * 'Insuranco [Bot]' 'InsurancoBot' - * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' - * 'ISC Systems [Bot]' 'ISC Systems iRc Search' - * 'Jyxobot [Bot]' 'Jyxobot/' - * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' - * 'LinkWalker' 'LinkWalker' - * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' - * 'Naver [Bot]' 'nhnbot@naver.com)' - * 'NetResearchServer' 'NetResearchServer/' - * 'Nimble [Crawler]' 'NimbleCrawler' - * 'Ocelli [Bot]' 'Ocelli/' - * 'Onsearch [Bot]' 'onCHECK-Robot' - * 'Orange [Spider]' 'OrangeSpider' - * 'Sproose [Bot]' 'http://www.sproose.com/bot' - * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' - * 'Tbot [Bot]' 'Tbot/' - * 'Thumbshots [Capture]' 'thumbshots-de-Bot' - * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' - * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' - * 'WissenOnline [Bot]' 'WissenOnline-Bot' - * 'WWWeasel [Bot]' 'WWWeasel Robot v' - * 'Xaldon [Spider]' 'Xaldon WebSpider' - */ - $this->bot_list = array( - 'AdsBot [Google]' => array('AdsBot-Google', ''), - 'Alexa [Bot]' => array('ia_archiver', ''), - 'Alta Vista [Bot]' => array('Scooter/', ''), - 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), - 'Baidu [Spider]' => array('Baiduspider', ''), - 'Bing [Bot]' => array('bingbot/', ''), - 'Exabot [Bot]' => array('Exabot', ''), - 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), - 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), - 'Francis [Bot]' => array('http://www.neomo.de/', ''), - 'Gigabot [Bot]' => array('Gigabot/', ''), - 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), - 'Google Desktop' => array('Google Desktop', ''), - 'Google Feedfetcher' => array('Feedfetcher-Google', ''), - 'Google [Bot]' => array('Googlebot', ''), - 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), - 'Heritrix [Crawler]' => array('heritrix/1.', ''), - 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), - 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), - 'ichiro [Crawler]' => array('ichiro/', ''), - 'Majestic-12 [Bot]' => array('MJ12bot/', ''), - 'Metager [Bot]' => array('MetagerBot/', ''), - 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), - 'MSN [Bot]' => array('msnbot/', ''), - 'MSNbot Media' => array('msnbot-media/', ''), - 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), - 'Online link [Validator]' => array('online link validator', ''), - 'psbot [Picsearch]' => array('psbot/0', ''), - 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), - 'SEO Crawler' => array('SEO search Crawler/', ''), - 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), - 'SEOSearch [Crawler]' => array('SEOsearch/', ''), - 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), - 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), - 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), - 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), - 'Voyager [Bot]' => array('voyager/', ''), - 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), - 'W3C [Linkcheck]' => array('W3C-checklink/', ''), - 'W3C [Validator]' => array('W3C_Validator', ''), - 'YaCy [Bot]' => array('yacybot', ''), - 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), - 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), - 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), - 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), - ); } /** diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php index 8ca2b6b215..bfbe6282bc 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_modules.php +++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php @@ -41,17 +41,97 @@ class add_modules extends \phpbb\install\task_base * * @var array */ - protected $module_categories; + protected $module_categories = array( + 'acp' => array( + 'ACP_CAT_GENERAL' => array( + 'ACP_QUICK_ACCESS', + 'ACP_BOARD_CONFIGURATION', + 'ACP_CLIENT_COMMUNICATION', + 'ACP_SERVER_CONFIGURATION', + ), + 'ACP_CAT_FORUMS' => array( + 'ACP_MANAGE_FORUMS', + 'ACP_FORUM_BASED_PERMISSIONS', + ), + 'ACP_CAT_POSTING' => array( + 'ACP_MESSAGES', + 'ACP_ATTACHMENTS', + ), + 'ACP_CAT_USERGROUP' => array( + 'ACP_CAT_USERS', + 'ACP_GROUPS', + 'ACP_USER_SECURITY', + ), + 'ACP_CAT_PERMISSIONS' => array( + 'ACP_GLOBAL_PERMISSIONS', + 'ACP_FORUM_BASED_PERMISSIONS', + 'ACP_PERMISSION_ROLES', + 'ACP_PERMISSION_MASKS', + ), + 'ACP_CAT_CUSTOMISE' => array( + 'ACP_STYLE_MANAGEMENT', + 'ACP_EXTENSION_MANAGEMENT', + 'ACP_LANGUAGE', + ), + 'ACP_CAT_MAINTENANCE' => array( + 'ACP_FORUM_LOGS', + 'ACP_CAT_DATABASE', + ), + 'ACP_CAT_SYSTEM' => array( + 'ACP_AUTOMATION', + 'ACP_GENERAL_TASKS', + 'ACP_MODULE_MANAGEMENT', + ), + 'ACP_CAT_DOT_MODS' => null, + ), + 'mcp' => array( + 'MCP_MAIN' => null, + 'MCP_QUEUE' => null, + 'MCP_REPORTS' => null, + 'MCP_NOTES' => null, + 'MCP_WARN' => null, + 'MCP_LOGS' => null, + 'MCP_BAN' => null, + ), + 'ucp' => array( + 'UCP_MAIN' => null, + 'UCP_PROFILE' => null, + 'UCP_PREFS' => null, + 'UCP_PM' => null, + 'UCP_USERGROUPS' => null, + 'UCP_ZEBRA' => null, + ), + ); /** * @var array */ - protected $module_categories_basenames; + protected $module_categories_basenames = array( + 'UCP_PM' => 'ucp_pm', + ); /** * @var array */ - protected $module_extras; + protected $module_extras = array( + 'acp' => array( + 'ACP_QUICK_ACCESS' => array( + 'ACP_MANAGE_USERS', + 'ACP_GROUPS_MANAGE', + 'ACP_MANAGE_FORUMS', + 'ACP_MOD_LOGS', + 'ACP_BOTS', + 'ACP_PHP_INFO', + ), + 'ACP_FORUM_BASED_PERMISSIONS' => array( + 'ACP_FORUM_PERMISSIONS', + 'ACP_FORUM_PERMISSIONS_COPY', + 'ACP_FORUM_MODERATORS', + 'ACP_USERS_FORUM_PERMISSIONS', + 'ACP_GROUPS_FORUM_PERMISSIONS', + ), + ), + ); /** * Constructor @@ -68,92 +148,6 @@ class add_modules extends \phpbb\install\task_base $this->module_manager = $container->get('module.manager'); parent::__construct(true); - - $this->module_categories = array( - 'acp' => array( - 'ACP_CAT_GENERAL' => array( - 'ACP_QUICK_ACCESS', - 'ACP_BOARD_CONFIGURATION', - 'ACP_CLIENT_COMMUNICATION', - 'ACP_SERVER_CONFIGURATION', - ), - 'ACP_CAT_FORUMS' => array( - 'ACP_MANAGE_FORUMS', - 'ACP_FORUM_BASED_PERMISSIONS', - ), - 'ACP_CAT_POSTING' => array( - 'ACP_MESSAGES', - 'ACP_ATTACHMENTS', - ), - 'ACP_CAT_USERGROUP' => array( - 'ACP_CAT_USERS', - 'ACP_GROUPS', - 'ACP_USER_SECURITY', - ), - 'ACP_CAT_PERMISSIONS' => array( - 'ACP_GLOBAL_PERMISSIONS', - 'ACP_FORUM_BASED_PERMISSIONS', - 'ACP_PERMISSION_ROLES', - 'ACP_PERMISSION_MASKS', - ), - 'ACP_CAT_CUSTOMISE' => array( - 'ACP_STYLE_MANAGEMENT', - 'ACP_EXTENSION_MANAGEMENT', - 'ACP_LANGUAGE', - ), - 'ACP_CAT_MAINTENANCE' => array( - 'ACP_FORUM_LOGS', - 'ACP_CAT_DATABASE', - ), - 'ACP_CAT_SYSTEM' => array( - 'ACP_AUTOMATION', - 'ACP_GENERAL_TASKS', - 'ACP_MODULE_MANAGEMENT', - ), - 'ACP_CAT_DOT_MODS' => null, - ), - 'mcp' => array( - 'MCP_MAIN' => null, - 'MCP_QUEUE' => null, - 'MCP_REPORTS' => null, - 'MCP_NOTES' => null, - 'MCP_WARN' => null, - 'MCP_LOGS' => null, - 'MCP_BAN' => null, - ), - 'ucp' => array( - 'UCP_MAIN' => null, - 'UCP_PROFILE' => null, - 'UCP_PREFS' => null, - 'UCP_PM' => null, - 'UCP_USERGROUPS' => null, - 'UCP_ZEBRA' => null, - ), - ); - - $this->module_categories_basenames = array( - 'UCP_PM' => 'ucp_pm', - ); - - $this->module_extras = array( - 'acp' => array( - 'ACP_QUICK_ACCESS' => array( - 'ACP_MANAGE_USERS', - 'ACP_GROUPS_MANAGE', - 'ACP_MANAGE_FORUMS', - 'ACP_MOD_LOGS', - 'ACP_BOTS', - 'ACP_PHP_INFO', - ), - 'ACP_FORUM_BASED_PERMISSIONS' => array( - 'ACP_FORUM_PERMISSIONS', - 'ACP_FORUM_PERMISSIONS_COPY', - 'ACP_FORUM_MODERATORS', - 'ACP_USERS_FORUM_PERMISSIONS', - 'ACP_GROUPS_FORUM_PERMISSIONS', - ), - ), - ); } /** From f7641cd506bd8ad98e923ce84f9f39960a938a69 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sat, 25 Jul 2015 15:41:10 +0200 Subject: [PATCH 73/75] [ticket/13740] Fix infinite config.php check loop PHPBB3-13740 --- phpBB/phpbb/install/helper/container_factory.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index dab16b81fd..dc0eef6485 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -115,11 +115,7 @@ class container_factory // Check whether container can be built // We need config.php for that so let's check if it has been set up yet - if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) - { - $this->build_container(); - } - else + if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) { throw new cannot_build_container_exception(); } From 495c0c6fb32ac0b720fccfeb640a0b3d5a32b98f Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 26 Jul 2015 22:20:32 +0200 Subject: [PATCH 74/75] [ticket/13740] Move handle_language_select calls to the controllers PHPBB3-13740 --- phpBB/phpbb/install/controller/helper.php | 4 +--- phpBB/phpbb/install/controller/install.php | 2 ++ phpBB/phpbb/install/controller/installer_index.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index 6d591786c4..fdfa6821ed 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -114,8 +114,6 @@ class helper $this->router = $router; $this->phpbb_root_path = $phpbb_root_path; $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; - - $this->handle_language_select(); } /** @@ -167,7 +165,7 @@ class helper /** * Handles language selector form */ - protected function handle_language_select() + public function handle_language_select() { $lang = null; diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index c21b0d831b..80f6651a39 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -176,6 +176,8 @@ class install // Determine whether the installation was started or not if (true) { + $this->controller_helper->handle_language_select(); + // Set active stage $this->menu_provider->set_nav_property( array('install', 0, 'introduction'), diff --git a/phpBB/phpbb/install/controller/installer_index.php b/phpBB/phpbb/install/controller/installer_index.php index 8e1874984b..c2d9572284 100644 --- a/phpBB/phpbb/install/controller/installer_index.php +++ b/phpBB/phpbb/install/controller/installer_index.php @@ -53,6 +53,8 @@ class installer_index public function handle($mode) { + $this->helper->handle_language_select(); + switch ($mode) { case "intro": From 11dfe503aac699b88a333967a1d0e594998414ae Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Sun, 26 Jul 2015 23:00:40 +0200 Subject: [PATCH 75/75] [ticket/13740] Reduce number of references in nav provider PHPBB3-13740 --- .../helper/navigation/navigation_provider.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/phpBB/phpbb/install/helper/navigation/navigation_provider.php b/phpBB/phpbb/install/helper/navigation/navigation_provider.php index 1f58cbea83..d52aec8999 100644 --- a/phpBB/phpbb/install/helper/navigation/navigation_provider.php +++ b/phpBB/phpbb/install/helper/navigation/navigation_provider.php @@ -58,7 +58,7 @@ class navigation_provider public function register(navigation_interface $navigation) { $nav_arry = $navigation->get(); - $this->merge($nav_arry, $this->menu_collection); + $this->menu_collection = $this->merge($nav_arry, $this->menu_collection); } /** @@ -79,7 +79,7 @@ class navigation_provider $array_pointer = $property_array; - $this->merge($array_root_pointer, $this->menu_collection); + $this->menu_collection = $this->merge($array_root_pointer, $this->menu_collection); } /** @@ -90,26 +90,32 @@ class navigation_provider * * @param array $array_to_merge * @param array $array_to_merge_into + * + * @return array Merged array */ - private function merge(&$array_to_merge, &$array_to_merge_into) + private function merge($array_to_merge, $array_to_merge_into) { + $merged_array = $array_to_merge_into; + foreach ($array_to_merge as $key => $value) { if (isset($array_to_merge_into[$key])) { if (is_array($array_to_merge_into[$key]) && is_array($value)) { - $this->merge($value, $array_to_merge_into[$key]); + $merged_array[$key] = $this->merge($value, $array_to_merge_into[$key]); } else { - $array_to_merge_into[$key] = $value; + $merged_array[$key] = $value; } } else { - $array_to_merge_into[$key] = $value; + $merged_array[$key] = $value; } } + + return $merged_array; } }