mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
Merge remote-tracking branch 'github-phpbb/develop' into ticket/11700
* github-phpbb/develop: (586 commits) [ticket/11735] Display disabled checkbox in subsilver for read notifications [ticket/11735] Display disabled checkbox when notification is already read [ticket/11844] update acp/authentication language var [ticket/11795] Remove PM popup [ticket/11795] Remove outdated comment from forum_fn.js [ticket/11795] Move find user JS to forum_fn [ticket/11795] Replace TWIG with phpBB syntax in ACP [ticket/11795] Move MSN scripts to forum_fn.js [ticket/11795] Use phpBB template syntax instead of TWIG [ticket/11795] Move PM popup JS to forum_fn.js [ticket/11795] Get rid of pagination JS variables [ticket/11795] Get rid of onload_functions [ticket/11795] Use data-reset-on-edit attr to reset elements [ticket/11795] Redo form elements auto-focus [ticket/11811] Remove outline on :focus [ticket/11836] Fix subsilver fatal error [ticket/11837] Replace escaped single quote with utf-8 single quote [ticket/11836] Fix fatal error on unsupported provider for auth link [ticket/11837] Translate UCP_AUTH_LINK_NOT_SUPPORTED [ticket/11809] Ensure code.js is first script included after jQuery ... Conflicts: phpBB/config/services.yml phpBB/develop/create_schema_files.php phpBB/develop/mysql_upgrader.php phpBB/download/file.php phpBB/includes/bbcode.php phpBB/includes/functions_container.php phpBB/install/database_update.php phpBB/install/index.php phpBB/phpbb/controller/helper.php phpBB/phpbb/controller/resolver.php phpBB/phpbb/request/request_interface.php phpBB/phpbb/session.php phpBB/phpbb/style/extension_path_provider.php phpBB/phpbb/style/path_provider.php phpBB/phpbb/style/path_provider_interface.php phpBB/phpbb/style/resource_locator.php phpBB/phpbb/style/style.php phpBB/phpbb/template/locator.php phpBB/phpbb/template/template.php phpBB/phpbb/template/twig/node/includeasset.php phpBB/phpbb/template/twig/node/includecss.php phpBB/phpbb/template/twig/node/includejs.php phpBB/phpbb/template/twig/twig.php tests/controller/helper_url_test.php tests/di/create_container_test.php tests/extension/style_path_provider_test.php tests/notification/notification_test.php tests/session/continue_test.php tests/session/creation_test.php tests/template/template_events_test.php tests/template/template_test_case.php tests/template/template_test_case_with_tree.php tests/test_framework/phpbb_functional_test_case.php
This commit is contained in:
@@ -39,7 +39,7 @@ if (!empty($setmodules))
|
||||
'module_filename' => substr(basename(__FILE__), 0, -strlen($phpEx)-1),
|
||||
'module_order' => 30,
|
||||
'module_subs' => '',
|
||||
'module_stages' => array('INTRO', 'VERSION_CHECK', 'UPDATE_DB', 'FILE_CHECK', 'UPDATE_FILES'),
|
||||
'module_stages' => array('INTRO', 'VERSION_CHECK', 'FILE_CHECK', 'UPDATE_FILES', 'UPDATE_DB'),
|
||||
'module_reqs' => ''
|
||||
);
|
||||
}
|
||||
@@ -57,7 +57,6 @@ class install_update extends module
|
||||
var $new_location;
|
||||
var $latest_version;
|
||||
var $current_version;
|
||||
var $unequal_version;
|
||||
|
||||
var $update_to_version;
|
||||
|
||||
@@ -71,18 +70,22 @@ class install_update extends module
|
||||
|
||||
function main($mode, $sub)
|
||||
{
|
||||
global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
|
||||
global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
|
||||
global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container;
|
||||
|
||||
// We must enable super globals, otherwise creating a new instance of the request class,
|
||||
// using the new container with a dbal connection will fail with the following PHP Notice:
|
||||
// Object of class phpbb_request_deactivated_super_global could not be converted to int
|
||||
$request->enable_super_globals();
|
||||
|
||||
// Create a normal container now
|
||||
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||
$phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config');
|
||||
|
||||
// Writes into global $cache
|
||||
$cache = $phpbb_container->get('cache');
|
||||
|
||||
$this->tpl_name = 'install_update';
|
||||
$this->page_title = 'UPDATE_INSTALLATION';
|
||||
$this->unequal_version = false;
|
||||
|
||||
$this->old_location = $phpbb_root_path . 'install/update/old/';
|
||||
$this->new_location = $phpbb_root_path . 'install/update/new/';
|
||||
@@ -125,7 +128,7 @@ class install_update extends module
|
||||
$config['default_lang'] = $language;
|
||||
$user->data['user_lang'] = $language;
|
||||
|
||||
$user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
|
||||
$user->add_lang(array('common', 'acp/common', 'acp/board', 'install', 'posting'));
|
||||
|
||||
// Reset the default_lang
|
||||
$config['default_lang'] = $config_default_lang;
|
||||
@@ -138,7 +141,9 @@ class install_update extends module
|
||||
}
|
||||
|
||||
// Set custom template again. ;)
|
||||
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
|
||||
$paths = array_filter($paths, 'is_dir');
|
||||
$template->set_custom_style('adm', $paths);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_USER_LANG' => $user->lang['USER_LANG'],
|
||||
@@ -192,8 +197,6 @@ class install_update extends module
|
||||
// Check if the update files are actually meant to update from the current version
|
||||
if ($this->current_version != $this->update_info['version']['from'])
|
||||
{
|
||||
$this->unequal_version = true;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_ERROR' => true,
|
||||
'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']),
|
||||
@@ -201,10 +204,8 @@ class install_update extends module
|
||||
}
|
||||
|
||||
// Check if the update files stored are for the latest version...
|
||||
if ($this->latest_version != $this->update_info['version']['to'])
|
||||
if (version_compare(strtolower($this->latest_version), strtolower($this->update_info['version']['to']), '>'))
|
||||
{
|
||||
$this->unequal_version = true;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_WARNING' => true,
|
||||
'WARNING_MSG' => sprintf($user->lang['OLD_UPDATE_FILES'], $this->update_info['version']['from'], $this->update_info['version']['to'], $this->latest_version))
|
||||
@@ -222,14 +223,15 @@ class install_update extends module
|
||||
|
||||
if ($this->test_update === false)
|
||||
{
|
||||
// Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present
|
||||
if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files']))
|
||||
{
|
||||
$this->tpl_name = '../../install/update/new/adm/style/install_update';
|
||||
}
|
||||
|
||||
// What about the language file? Got it updated?
|
||||
if (in_array('language/en/install.' . $phpEx, $this->update_info['files']))
|
||||
if (in_array('language/' . $language . '/install.' . $phpEx, $this->update_info['files']))
|
||||
{
|
||||
$lang = array();
|
||||
include($this->new_location . 'language/' . $language . '/install.' . $phpEx);
|
||||
// this is the user's language.. just merge it
|
||||
$user->lang = array_merge($user->lang, $lang);
|
||||
}
|
||||
if ($language != 'en' && in_array('language/en/install.' . $phpEx, $this->update_info['files']))
|
||||
{
|
||||
$lang = array();
|
||||
include($this->new_location . 'language/en/install.' . $phpEx);
|
||||
@@ -273,18 +275,17 @@ class install_update extends module
|
||||
$this->page_title = 'STAGE_VERSION_CHECK';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_UP_TO_DATE' => $up_to_date,
|
||||
'S_VERSION_CHECK' => true,
|
||||
|
||||
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
||||
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"),
|
||||
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
||||
|
||||
'S_UP_TO_DATE' => $up_to_date,
|
||||
'LATEST_VERSION' => $this->latest_version,
|
||||
'CURRENT_VERSION' => $this->current_version)
|
||||
);
|
||||
'CURRENT_VERSION' => $this->current_version,
|
||||
));
|
||||
|
||||
// Print out version the update package updates to
|
||||
if ($this->unequal_version)
|
||||
if ($this->latest_version != $this->update_info['version']['to'])
|
||||
{
|
||||
$template->assign_var('PACKAGE_VERSION', $this->update_info['version']['to']);
|
||||
}
|
||||
@@ -302,30 +303,6 @@ class install_update extends module
|
||||
break;
|
||||
|
||||
case 'update_db':
|
||||
|
||||
// Make sure the database update is valid for the latest version
|
||||
$valid = false;
|
||||
$updates_to_version = '';
|
||||
|
||||
if (file_exists($phpbb_root_path . 'install/database_update.' . $phpEx))
|
||||
{
|
||||
include_once($phpbb_root_path . 'install/database_update.' . $phpEx);
|
||||
|
||||
if ($updates_to_version === $this->update_info['version']['to'])
|
||||
{
|
||||
$valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Should not happen at all
|
||||
if (!$valid)
|
||||
{
|
||||
trigger_error($user->lang['DATABASE_UPDATE_INFO_OLD'], E_USER_ERROR);
|
||||
}
|
||||
|
||||
// Just a precaution
|
||||
$cache->purge();
|
||||
|
||||
// Redirect the user to the database update script with some explanations...
|
||||
$template->assign_vars(array(
|
||||
'S_DB_UPDATE' => true,
|
||||
@@ -333,8 +310,14 @@ class install_update extends module
|
||||
'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']),
|
||||
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"),
|
||||
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
||||
'L_EVERYTHING_UP_TO_DATE' => $user->lang('EVERYTHING_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
|
||||
));
|
||||
|
||||
// Do not display incompatible package note after successful update
|
||||
if ($config['version'] == $this->update_info['version']['to'])
|
||||
{
|
||||
$template->assign_var('S_ERROR', false);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'file_check':
|
||||
@@ -500,17 +483,30 @@ class install_update extends module
|
||||
$template->assign_vars(array(
|
||||
'S_FILE_CHECK' => true,
|
||||
'S_ALL_UP_TO_DATE' => $all_up_to_date,
|
||||
'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
|
||||
'S_VERSION_UP_TO_DATE' => $up_to_date,
|
||||
'S_UP_TO_DATE' => $up_to_date,
|
||||
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
||||
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"),
|
||||
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"),
|
||||
));
|
||||
|
||||
// Since some people try to update to RC releases, but phpBB.com tells them the last version is the version they currently run
|
||||
// we are faced with the updater thinking the database schema is up-to-date; which it is, but should be updated none-the-less
|
||||
// We now try to cope with this by triggering the update process
|
||||
if (version_compare(str_replace('rc', 'RC', strtolower($this->current_version)), str_replace('rc', 'RC', strtolower($this->update_info['version']['to'])), '<'))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_UP_TO_DATE' => false,
|
||||
));
|
||||
}
|
||||
|
||||
if ($all_up_to_date)
|
||||
{
|
||||
global $phpbb_container;
|
||||
$phpbb_log = $phpbb_container->get('log');
|
||||
|
||||
// Add database update to log
|
||||
add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version);
|
||||
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UPDATE_PHPBB', time(), array($this->current_version, $this->update_to_version));
|
||||
|
||||
$db->sql_return_on_error(true);
|
||||
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
|
||||
@@ -1089,12 +1085,6 @@ class install_update extends module
|
||||
|
||||
$this->tpl_name = 'install_update_diff';
|
||||
|
||||
// Got the diff template itself updated? If so, we are able to directly use it
|
||||
if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files']))
|
||||
{
|
||||
$this->tpl_name = '../../install/update/new/adm/style/install_update_diff';
|
||||
}
|
||||
|
||||
$this->page_title = 'VIEWING_FILE_DIFF';
|
||||
|
||||
$status = request_var('status', '');
|
||||
|
Reference in New Issue
Block a user