From babdb92aa998728b58eec1e3f2c036b5f2342492 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 10 Jan 2013 17:25:53 -0600 Subject: [PATCH] [feature/migrations] Remove hardcoded language, use lang instead. PHPBB3-9737 --- phpBB/install/database_update.php | 54 +++++++++++++++---------------- phpBB/language/en/install.php | 3 ++ 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7431c96231..cd43f6065b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -21,26 +21,6 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (!function_exists('phpbb_require_updated')) -{ - function phpbb_require_updated($path, $optional = false) - { - global $phpbb_root_path; - - $new_path = $phpbb_root_path . 'install/update/new/' . $path; - $old_path = $phpbb_root_path . $path; - - if (file_exists($new_path)) - { - require($new_path); - } - else if (!$optional || file_exists($old_path)) - { - require($old_path); - } - } -} - phpbb_require_updated('includes/startup.' . $phpEx); include($phpbb_root_path . 'config.' . $phpEx); @@ -200,7 +180,7 @@ while (!$migrator->finished()) { echo $e; - end_update($cache); + phpbb_end_update($cache); } echo $migrator->last_run_migration['name'] . '
'; @@ -209,10 +189,10 @@ while (!$migrator->finished()) if ((time() - $update_start_time) >= $safe_time_limit) { //echo ''; - echo 'Update not yet completed.
'; - echo 'Continue'; + echo $lang['DATABASE_UPDATE_NOT_COMPLETED'] . '
'; + echo '' . $lang['DATABASE_UPDATE_CONTINUE'] . ''; - end_update($cache); + phpbb_end_update($cache); } } @@ -221,11 +201,31 @@ if ($orig_version != $config['version']) add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $config['version']); } -echo 'Finished'; +echo $lang['DATABASE_UPDATE_COMPLETE']; -end_update($cache); +phpbb_end_update($cache); -function end_update($cache) +if (!function_exists('phpbb_require_updated')) +{ + function phpbb_require_updated($path, $optional = false) + { + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + require($new_path); + } + else if (!$optional || file_exists($old_path)) + { + require($old_path); + } + } +} + +function phpbb_end_update($cache) { $cache->purge(); diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index f7820714e1..7607512eab 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -397,7 +397,10 @@ $lang = array_merge($lang, array( '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',