diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2018-03-12 22:57:42 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2018-03-12 22:57:42 +0100 |
commit | a8c22829d8e8845cd4ddf4ef8b61a1ed79edfffc (patch) | |
tree | f0ae554b863266fbe523582d1be09216436c7472 /debian/maint-patches/007_database_update_php.diff |
Imported from the SVN repository
http://svn.wolffelaar.nl/wsvn/phpbb/branches/jessie/
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'debian/maint-patches/007_database_update_php.diff')
-rw-r--r-- | debian/maint-patches/007_database_update_php.diff | 306 |
1 files changed, 306 insertions, 0 deletions
diff --git a/debian/maint-patches/007_database_update_php.diff b/debian/maint-patches/007_database_update_php.diff new file mode 100644 index 0000000..d0c4275 --- /dev/null +++ b/debian/maint-patches/007_database_update_php.diff @@ -0,0 +1,306 @@ +--- ../install/database_update.php 2013-09-28 14:36:35.462359564 -0400 ++++ database_update_debian.php 2013-09-28 16:04:35.046507402 -0400 +@@ -1,3 +1,4 @@ ++#!/usr/bin/php5 + <?php + /** + * +@@ -34,7 +35,7 @@ + define('PHPBB_ROOT_PATH', '/usr/share/phpbb3/www/'); + + $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +-$phpEx = substr(strrchr(__FILE__, '.'), 1); ++$phpEx = 'php'; + + if (!function_exists('phpbb_require_updated')) + { +@@ -69,7 +70,7 @@ + + if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) + { +- die("Make sure you have a running board before trying to upgrade anything."); ++ exit(1); + } + + // Load Extensions +@@ -165,7 +166,7 @@ + //set_error_handler('msg_handler'); + + // Define some variables for the database update +-$inline_update = (request_var('type', 0)) ? true : false; ++$inline_update = true; + + // To let set_config() calls succeed, we need to make the config array available globally + $config = array(); +@@ -189,50 +190,11 @@ + $error_ary = array(); + $errored = false; + +-header('Content-type: text/html; charset=UTF-8'); +- +-?> +-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +-<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>"> +-<head> +- +-<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> +-<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" /> +-<meta http-equiv="content-style-type" content="text/css" /> +-<meta http-equiv="imagetoolbar" content="no" /> +- +-<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title> +- +-<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> +- +-</head> +- +-<body> +-<div id="wrap"> +- <div id="page-header"> </div> +- +- <div id="page-body"> +- <div id="acp"> +- <div class="panel"> +- <span class="corners-top"><span></span></span> +- <div id="content"> +- <div id="main" class="install-body"> +- +- <h1><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></h1> +- +- <br /> +- +- <p><?php echo $lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br /> +-<?php +- + if ($debug_from_version !== false) + { + $config['version'] = $debug_from_version; + } + +-echo $lang['PREVIOUS_VERSION'] . ' :: <strong>' . $config['version'] . '</strong><br />'; +-echo $lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>'; +- + $current_version = str_replace('rc', 'RC', strtolower($config['version'])); + $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); + $orig_version = $config['version']; +@@ -243,79 +205,6 @@ + set_config('dbms_version', $db->sql_server_info(true)); + } + +-// Firebird update from Firebird 2.0 to 2.1+ required? +-if ($db->sql_layer == 'firebird') +-{ +- // We do not trust any PHP5 function enabled, we will simply test for a function new in 2.1 +- $db->sql_return_on_error(true); +- +- $sql = 'SELECT 1 FROM RDB$DATABASE +- WHERE BIN_AND(10, 1) = 0'; +- $result = $db->sql_query($sql); +- +- if (!$result || $db->sql_error_triggered) +- { +- echo '<br /><br />'; +- echo '<h1>' . $lang['ERROR'] . '</h1><br />'; +- +- echo '<p>' . $lang['FIREBIRD_DBMS_UPDATE_REQUIRED'] . '</p>'; +- +- _print_footer(); +- +- exit_handler(); +- exit; +- } +- +- $db->sql_freeresult($result); +- $db->sql_return_on_error(false); +-} +- +-// MySQL update from MySQL 3.x/4.x to > 4.1.x required? +-if ($db->sql_layer == 'mysql' || $db->sql_layer == 'mysql4' || $db->sql_layer == 'mysqli') +-{ +- // Verify by fetching column... if the column type matches the new type we update dbms_version... +- $sql = "SHOW COLUMNS FROM " . CONFIG_TABLE; +- $result = $db->sql_query($sql); +- +- $column_type = ''; +- while ($row = $db->sql_fetchrow($result)) +- { +- $field = strtolower($row['Field']); +- +- if ($field == 'config_value') +- { +- $column_type = strtolower($row['Type']); +- break; +- } +- } +- $db->sql_freeresult($result); +- +- // If column type is blob, but mysql version says we are on > 4.1.3, then the schema needs an update +- if (strpos($column_type, 'blob') !== false && version_compare($db->sql_server_info(true), '4.1.3', '>=')) +- { +- echo '<br /><br />'; +- echo '<h1>' . $lang['ERROR'] . '</h1><br />'; +- +- echo '<p>' . sprintf($lang['MYSQL_SCHEMA_UPDATE_REQUIRED'], $config['dbms_version'], $db->sql_server_info(true)) . '</p>'; +- +- _print_footer(); +- +- exit_handler(); +- exit; +- } +-} +- +-// Now check if the user wants to update from a version we no longer support updates from +-if (version_compare($current_version, $oldest_from_version, '<')) +-{ +- echo '<br /><br /><h1>' . $lang['ERROR'] . '</h1><br />'; +- echo '<p>' . sprintf($lang['DB_UPDATE_NOT_SUPPORTED'], $oldest_from_version, $current_version) . '</p>'; +- +- _print_footer(); +- exit_handler(); +- exit; +-} +- + // If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything. + if ($inline_update) + { +@@ -331,17 +220,6 @@ + } + + // Schema updates +-?> +- <br /><br /> +- +- <h1><?php echo $lang['UPDATE_DATABASE_SCHEMA']; ?></h1> +- +- <br /> +- <p><?php echo $lang['PROGRESS']; ?> :: <strong> +- +-<?php +- +-flush(); + + // We go through the schema changes from the lowest to the highest version + // We try to also include versions 'in-between'... +@@ -385,17 +263,6 @@ + $error_ary = array(); + $errored = $no_updates = false; + +-?> +- +-<br /><br /> +-<h1><?php echo $lang['UPDATING_DATA']; ?></h1> +-<br /> +-<p><?php echo $lang['PROGRESS']; ?> :: <strong> +- +-<?php +- +-flush(); +- + $no_updates = true; + $versions = array_keys($database_update_info); + +@@ -419,17 +286,6 @@ + $error_ary = array(); + $errored = $no_updates = false; + +-?> +- +-<br /><br /> +-<h1><?php echo $lang['UPDATE_VERSION_OPTIMIZE']; ?></h1> +-<br /> +-<p><?php echo $lang['PROGRESS']; ?> :: <strong> +- +-<?php +- +-flush(); +- + if ($debug_from_version === false) + { + // update the version +@@ -468,43 +324,13 @@ + + _write_result($no_updates, $errored, $error_ary); + +-?> +- +-<br /> +-<h1><?php echo $lang['UPDATE_COMPLETED']; ?></h1> +- +-<br /> +- +-<?php +- +-if (!$inline_update) +-{ +-?> +- +- <p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p> +- +- <p><?php echo $lang['COMPLETE_LOGIN_TO_BOARD']; ?></p> +- +-<?php +-} +-else +-{ +-?> +- +- <p><?php echo ((isset($lang['INLINE_UPDATE_SUCCESSFUL'])) ? $lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p> +- +- <p><a href="<?php echo append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode=update&sub=file_check&language=$language"); ?>" class="button1"><?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p> +- +-<?php +-} +- + // Add database update to log + add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version); + + // Now we purge the session table as well as all cache files + $cache->purge(); + +-_print_footer(); ++//_print_footer(); + + garbage_collection(); + +@@ -514,32 +340,9 @@ + } + + /** +-* Print out footer +-*/ +-function _print_footer() +-{ +- echo <<<EOF +- </div> +- </div> +- <span class="corners-bottom"><span></span></span> +- </div> +- </div> +- </div> +- +- <div id="page-footer"> +- Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group +- </div> +-</div> +- +-</body> +-</html> +-EOF; +-} +- +-/** + * Function for triggering an sql statement + */ +-function _sql($sql, &$errored, &$error_ary, $echo_dot = true) ++function _sql($sql, &$errored, &$error_ary, $echo_dot = false) + { + global $db; + +@@ -582,6 +385,7 @@ + + function _write_result($no_updates, $errored, $error_ary) + { ++ return true; + global $lang; + + if ($no_updates) |