diff options
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r-- | phpBB/install/database_update.php | 112 |
1 files changed, 81 insertions, 31 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 79aa57aea0..4507e5c371 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -84,7 +84,6 @@ if (!empty($load_extensions) && function_exists('dl')) // Include files 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); @@ -144,9 +143,9 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); unset($dbpasswd); $user->ip = ''; -if (!empty($_SERVER['REMOTE_ADDR'])) +if ($request->server('REMOTE_ADDR')) { - $user->ip = (function_exists('phpbb_ip_normalise')) ? phpbb_ip_normalise($_SERVER['REMOTE_ADDR']) : htmlspecialchars($_SERVER['REMOTE_ADDR']); + $user->ip = (function_exists('phpbb_ip_normalise')) ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : $request->server('REMOTE_ADDR'); } $sql = "SELECT config_value @@ -1062,6 +1061,24 @@ function database_update_info() 'group_legend' => array('UINT', 0), ), ), + 'drop_columns' => array( + STYLES_TABLE => array( + 'imageset_id', + ), + STYLES_TEMPLATE_TABLE => array( + 'template_storedb', + ), + STYLES_THEME_TABLE => array( + 'theme_storedb', + 'theme_mtime', + 'theme_data', + ), + ), + 'drop_tables' => array( + STYLES_IMAGESET_TABLE, + STYLES_IMAGESET_DATA_TABLE, + STYLES_TEMPLATE_DATA_TABLE, + ), ), ); } @@ -2073,42 +2090,68 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': - set_config('use_system_cron', 0); - - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 1 - WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'ADMINISTRATORS'"; - _sql($sql, $errored, $error_ary); - - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 2 - WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'GLOBAL_MODERATORS'"; - _sql($sql, $errored, $error_ary); - - set_config('legend_sort_groupname', '0'); - set_config('teampage_multiple', '1'); - set_config('teampage_forums', '1'); + if (!isset($config['use_system_cron'])) + { + set_config('use_system_cron', 0); + } - $sql = 'SELECT group_id + $sql = 'SELECT group_teampage FROM ' . GROUPS_TABLE . ' - WHERE group_legend = 1 - ORDER BY group_name ASC'; - $result = $db->sql_query($sql); + WHERE group_teampage > 0'; + $result = $db->sql_query_limit($sql, 1); + $added_groups_teampage = (bool) $db->sql_fetchfield('group_teampage'); + $db->sql_freeresult($result); - $next_legend = 1; - while ($row = $db->sql_fetchrow($result)) + if (!$added_groups_teampage) { $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_legend = ' . $next_legend . ' - WHERE group_id = ' . (int) $row['group_id']; + SET group_teampage = 1 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'ADMINISTRATORS'"; _sql($sql, $errored, $error_ary); - $next_legend++; + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = 2 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'GLOBAL_MODERATORS'"; + _sql($sql, $errored, $error_ary); + } + + if (!isset($config['use_system_cron'])) + { + set_config('legend_sort_groupname', '0'); + set_config('teampage_multiple', '1'); + set_config('teampage_forums', '1'); } + + $sql = 'SELECT group_legend + FROM ' . GROUPS_TABLE . ' + WHERE group_teampage > 1'; + $result = $db->sql_query_limit($sql, 1); + $updated_group_legend = (bool) $db->sql_fetchfield('group_teampage'); $db->sql_freeresult($result); - unset($next_legend); + + if (!$updated_group_legend) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; + $result = $db->sql_query($sql); + + $next_legend = 1; + while ($row = $db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_legend = ' . $next_legend . ' + WHERE group_id = ' . (int) $row['group_id']; + _sql($sql, $errored, $error_ary); + + $next_legend++; + } + $db->sql_freeresult($result); + unset($next_legend); + } // Install modules $modules_to_install = array( @@ -2129,6 +2172,10 @@ function change_database_data(&$no_updates, $version) ); _add_modules($modules_to_install); + + $sql = 'DELETE FROM ' . MODULES_TABLE . " + WHERE module_basename = 'styles' AND module_mode = 'imageset'"; + _sql($sql, $errored, $error_ary); // Localise Global Announcements $sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour @@ -2208,7 +2255,10 @@ function change_database_data(&$no_updates, $version) } // Allow custom profile fields in pm templates - set_config('load_cpf_pm', '0'); + if (!isset($config['load_cpf_pm'])) + { + set_config('load_cpf_pm', '0'); + } $no_updates = false; break; |