[ticket/11574] Change order of files and database update

PHPBB3-11574
This commit is contained in:
Joas Schilling 2013-07-29 21:30:01 +02:00
parent d8dea63778
commit 5bb08a1ab9
5 changed files with 55 additions and 35 deletions

View file

@ -109,27 +109,14 @@
<!-- ENDIF -->
</fieldset>
<!-- IF not S_UP_TO_DATE -->
<form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}">
<fieldset class="submit-buttons">
<p>{L_UPDATE_DATABASE_EXPLAIN}</p>
<input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" />
</fieldset>
</form>
<!-- ELSE -->
<form id="install_update" method="post" action="{U_ACTION}">
<fieldset class="submit-buttons">
<p>{L_CHECK_FILES_UP_TO_DATE}</p>
<p>{L_CHECK_FILES_EXPLAIN}</p>
<input class="button1" type="submit" name="submit" value="{L_CHECK_FILES}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- ELSEIF S_DB_UPDATE -->
@ -155,6 +142,11 @@
<!-- ELSE -->
<div class="successbox">
<h3>{L_UPDATE_DB_SUCCESS}</h3>
<p>{L_EVERYTHING_UP_TO_DATE}</p>
</div>
<h1>{L_UPDATE_DB_SUCCESS}</h1>
<br /><br />
@ -174,10 +166,18 @@
<!-- IF S_ALL_UP_TO_DATE -->
<div class="successbox">
<h3>{L_UPDATE_SUCCESS}</h3>
<h1>{L_UPDATE_FILE_SUCCESS}</h1>
<p>{L_ALL_FILES_UP_TO_DATE}</p>
</div>
<p>{L_UPDATE_DATABASE_EXPLAIN}</p>
<form id="install_dbupdate" method="post" action="{U_DB_UPDATE_ACTION}">
<fieldset class="submit-buttons">
<input class="button1" type="submit" name="db_update" value="{L_UPDATE_DATABASE}" />
</fieldset>
</form>
<!-- ELSE -->
<h1>{L_COLLECTED_INFORMATION}</h1>

View file

@ -110,6 +110,7 @@ phpbb_require_updated('includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'config.' . $phpEx);
phpbb_require_updated('includes/constants.' . $phpEx);
phpbb_include_updated('includes/utf/utf_normalizer.' . $phpEx);
phpbb_require_updated('includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
@ -305,7 +306,7 @@ echo $user->lang['DATABASE_UPDATE_COMPLETE'] . '<br />';
if ($request->variable('type', 0))
{
echo $user->lang['INLINE_UPDATE_SUCCESSFUL'] . '<br /><br />';
echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&amp;sub=file_check&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
echo '<a href="' . append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update&amp;sub=update_db&amp;language=' . $request->variable('language', 'en')) . '" class="button1">' . $user->lang['CONTINUE_UPDATE_NOW'] . '</a>';
}
else
{

View file

@ -250,7 +250,7 @@ $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, ne
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
$phpbb_style->set_ext_dir_prefix('adm/');
$paths = array($phpbb_admin_path . 'style', $phpbb_root_path . 'install/update/new/adm/style');
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
$phpbb_style->set_custom_style('admin', $paths, array(), '');

View file

@ -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' => ''
);
}
@ -74,6 +74,11 @@ class install_update extends module
global $phpbb_style, $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_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config');
@ -138,7 +143,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');
$phpbb_style->set_custom_style('admin', $paths, array(), '');
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],
@ -267,15 +274,14 @@ 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&amp;mode=$mode&amp;sub=file_check"),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_db"),
'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)
@ -303,6 +309,7 @@ class install_update extends module
'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&amp;language=' . $user->data['user_lang']),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_db"),
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;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&amp;redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
));
break;
@ -470,13 +477,23 @@ 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&amp;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&amp;mode=$mode&amp;sub=file_check"),
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;sub=update_files"),
'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&amp;mode=$mode&amp;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;

View file

@ -374,7 +374,7 @@ $lang = array_merge($lang, array(
// Updater
$lang = array_merge($lang, array(
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> 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 <a href="%2$s">Send statistics</a> module in your ACP.',
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version.',
'ARCHIVE_FILE' => 'Source file within archive',
'BACK' => 'Back',
@ -419,8 +419,9 @@ $lang = array_merge($lang, array(
'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.',
'ERROR' => 'Error',
'EDIT_USERNAME' => 'Edit username',
'ERROR' => 'Error',
'EVERYTHING_UP_TO_DATE' => 'Everything is up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> 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 <a href="%2$s">Send statistics</a> 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.',
@ -570,6 +571,7 @@ $lang = array_merge($lang, array(
'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',