diff options
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r-- | phpBB/install/database_update.php | 87 |
1 files changed, 65 insertions, 22 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 10308826e0..fab79e6dc1 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2,13 +2,12 @@ /** * * @package install -* @version $Id$ * @copyright (c) 2006 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ -$updates_to_version = '3.0.9-dev'; +$updates_to_version = '3.1.0-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -60,8 +59,7 @@ if (!empty($load_extensions) && function_exists('dl')) } // Include files -require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx); -require($phpbb_root_path . 'includes/cache.' . $phpEx); +require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/template.' . $phpEx); require($phpbb_root_path . 'includes/session.' . $phpEx); require($phpbb_root_path . 'includes/auth.' . $phpEx); @@ -92,10 +90,21 @@ else define('STRIP', (get_magic_quotes_gpc()) ? true : false); } +$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx); +$class_loader->register(); + +// set up caching +$cache_factory = new phpbb_cache_factory($acm_type); +$cache = $cache_factory->get_service(); +$class_loader->set_cache($cache->get_driver()); + +$request = new phpbb_request(); $user = new user(); -$cache = new cache(); $db = new $sql_db(); +// make sure request_var uses this request instance +request_var('', 0, false, false, $request); // "dependency injection" for a function + // Add own hook handler, if present. :o if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx)) { @@ -118,8 +127,11 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); // We do not need this any longer, unset for safety purposes unset($dbpasswd); -$user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; -$user->ip = (stripos($user->ip, '::ffff:') === 0) ? substr($user->ip, 7) : $user->ip; +$user->ip = ''; +if (!empty($_SERVER['REMOTE_ADDR'])) +{ + $user->ip = (function_exists('phpbb_ip_normalise')) ? phpbb_ip_normalise($_SERVER['REMOTE_ADDR']) : htmlspecialchars($_SERVER['REMOTE_ADDR']); +} $sql = "SELECT config_value FROM " . CONFIG_TABLE . " @@ -152,17 +164,9 @@ include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); $inline_update = (request_var('type', 0)) ? true : false; // To let set_config() calls succeed, we need to make the config array available globally -$config = array(); - -$sql = 'SELECT * - FROM ' . CONFIG_TABLE; -$result = $db->sql_query($sql); - -while ($row = $db->sql_fetchrow($result)) -{ - $config[$row['config_name']] = $row['config_value']; -} -$db->sql_freeresult($result); +$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE); +set_config(null, null, null, $config); +set_config_count(null, null, null, $config); // We do not include DB Tools here, because we can not be sure the file is up-to-date ;) // Instead, this file defines a clean db_tools version (we are also not able to provide a different file, else the database update will not work standalone) @@ -227,7 +231,7 @@ if (empty($config['dbms_version'])) set_config('dbms_version', $db->sql_server_info(true)); } -// Firebird update from Firebord 2.0 to 2.1+ required? +// 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 @@ -511,7 +515,7 @@ function _print_footer() </div> <div id="page-footer"> - Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a> + Powered by <a href="http://www.phpbb.com/">phpBB</a> © phpBB Group </div> </div> @@ -916,6 +920,18 @@ function database_update_info() '3.0.7-PL1' => array(), // No changes from 3.0.8-RC1 to 3.0.8 '3.0.8-RC1' => array(), + + // Changes from 3.0.8 to 3.0.9-RC1 + '3.0.8' => array( + 'change_columns' => array( + BBCODES_TABLE => array( + 'bbcode_id' => array('USINT', 0), + ), + ), + ), + + // No changes from 3.1.0-dev to 3.1.0-A1 + '3.1.0-dev' => array(), ); } @@ -1858,6 +1874,35 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.8-RC1 to 3.0.8 case '3.0.8-RC1': break; + + // Changes from 3.0.8 to 3.0.9-RC1 + case '3.0.8': + // Update file extension group names to use language strings, again. + $sql = 'SELECT group_id, group_name + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE group_name ' . $db->sql_like_expression('EXT_GROUP_' . $db->any_char); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary = array( + 'group_name' => substr($row['group_name'], 10), // Strip off 'EXT_GROUP_' + ); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE group_id = ' . $row['group_id']; + _sql($sql, $errored, $error_ary); + } + $db->sql_freeresult($result); + + $no_updates = false; + break; + + // Changes from 3.1.0-dev to 3.1.0-A1 + case '3.1.0-dev': + set_config('use_system_cron', 0); + break; } } @@ -3802,5 +3847,3 @@ class updater_db_tools return $this->_sql_run_sql($statements); } } - -?> |