query('SELECT conf_value FROM '.$pun_db->prefix.'config WHERE conf_name=\'o_cur_version\''); $cur_version = $pun_db->result($result); if (version_compare($cur_version, '1.2', '<')) error('Version mismatch. The database \''.$db_name.'\' doesn\'t seem to be running a PunBB database schema supported by this update script.', __FILE__, __LINE__); // If we've already done charset conversion in a previous update, we have to do SET NAMES if (strpos($cur_version, '1.3') === 0) $pun_db->query('SET NAMES \'utf8\'') or error(__FILE__, __LINE__); // If MySQL, make sure it's at least 4.1.2 if ($db_type == 'mysql' || $db_type == 'mysqli') { $result = $pun_db->query('SELECT VERSION()') or error(__FILE__, __LINE__); $mysql_version = $pun_db->result($result); if (version_compare($mysql_version, MIN_MYSQL_VERSION, '<')) error('You are running MySQL version '.$mysql_version.'. PunBB '.UPDATE_TO.' requires at least MySQL '.MIN_MYSQL_VERSION.' to run properly. You must upgrade your MySQL installation before you can continue.'); } // Get the forum config $result = $pun_db->query('SELECT * FROM '.$pun_db->prefix.'config'); while ($cur_config_item = $pun_db->fetch_row($result)) $pun_config[$cur_config_item[0]] = $cur_config_item[1]; // If $base_url isn't set, use o_base_url from config if (!isset($base_url)) $base_url = $pun_config['o_base_url']; // There's no $pun_user, but we need the style element // We default to Oxygen if the default style is invalid (a 1.2 to 1.3 upgrade most likely) if (file_exists(PUN_ROOT.'style/'.$pun_config['o_default_style'].'/'.$pun_config['o_default_style'].'.php')) $pun_user['style'] = $pun_config['o_default_style']; else { $pun_user['style'] = 'Oxygen'; $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value=\'Oxygen\' WHERE conf_name=\'o_default_style\'') or error(__FILE__, __LINE__); } // Make sure the default language exists // We default to English if the default language is invalid (a 1.2 to 1.3 upgrade most likely) if (!file_exists(PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php')) { $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value=\'English\' WHERE conf_name=\'o_default_lang\'') or error(__FILE__, __LINE__); } // // Determines whether $str is UTF-8 encoded or not // function seems_utf8($str) { $str_len = strlen($str); for ($i = 0; $i < $str_len; ++$i) { if (ord($str[$i]) < 0x80) continue; # 0bbbbbbb else if ((ord($str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb else if ((ord($str[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb else if ((ord($str[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb else if ((ord($str[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb else if ((ord($str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b else return false; # Does not match any model for ($j = 0; $j < $n; ++$j) # n bytes matching 10bbbbbb follow ? { if ((++$i == strlen($str)) || ((ord($str[$i]) & 0xC0) != 0x80)) return false; } } return true; } // // Translates the number from an HTML numeric entity into an UTF-8 character // function dcr2utf8($src) { $dest = ''; if ($src < 0) return false; else if ($src <= 0x007f) $dest .= chr($src); else if ($src <= 0x07ff) { $dest .= chr(0xc0 | ($src >> 6)); $dest .= chr(0x80 | ($src & 0x003f)); } else if ($src == 0xFEFF) { // nop -- zap the BOM } else if ($src >= 0xD800 && $src <= 0xDFFF) { // found a surrogate return false; } else if ($src <= 0xffff) { $dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f)); } else if ($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f)); } else { // out of range return false; } return $dest; } // // Attemts to convert $str from $old_charset to UTF-8. Also converts HTML entities (including numeric entities) to UTF-8 characters. // function convert_to_utf8(&$str, $old_charset) { if ($str == '') return false; $save = $str; // Replace literal entities (for non-UTF-8 compliant html_entity_encode) if (version_compare(PHP_VERSION, '5.0.0', '<') && $old_charset == 'ISO-8859-1' || $old_charset == 'ISO-8859-15') $str = html_entity_decode($str, ENT_QUOTES, $old_charset); if (!seems_utf8($str)) { if ($old_charset == 'ISO-8859-1') $str = utf8_encode($str); else if (function_exists('iconv')) $str = iconv($old_charset, 'UTF-8', $str); else if (function_exists('mb_convert_encoding')) $str = mb_convert_encoding($str, 'UTF-8', $old_charset); } // Replace literal entities (for UTF-8 compliant html_entity_encode) if (version_compare(PHP_VERSION, '5.0.0', '>=')) $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); // Replace numeric entities $str = preg_replace_callback('/&#([0-9]+);/', 'utf8_callback_1', $str); $str = preg_replace_callback('/&#x([a-f0-9]+);/i', 'utf8_callback_2', $str); return ($save != $str); } function utf8_callback_1($matches) { return dcr2utf8($matches[1]); } function utf8_callback_2($matches) { return dcr2utf8(hexdec($matches[1])); } // // Tries to determine whether post data in the database is UTF-8 encoded or not // function db_seems_utf8() { global $db_type, $pun_db; $seems_utf8 = true; $result = $pun_db->query('SELECT MIN(id), MAX(id) FROM '.$pun_db->prefix.'posts') or error(__FILE__, __LINE__); list($min_id, $max_id) = $pun_db->fetch_row($result); // Get a random soup of data and check if it appears to be UTF-8 for ($i = 0; $i < 100; ++$i) { $id = ($i == 0) ? $min_id : (($i == 1) ? $max_id : rand($min_id, $max_id)); $result = $pun_db->query('SELECT p.message, p.poster, t.subject, f.forum_name FROM '.$pun_db->prefix.'posts AS p INNER JOIN '.$pun_db->prefix.'topics AS t ON t.id = p.topic_id INNER JOIN '.$pun_db->prefix.'forums AS f ON f.id = t.forum_id WHERE p.id>='.$id.' LIMIT 1') or error(__FILE__, __LINE__); $temp = $pun_db->fetch_row($result); if (!seems_utf8($temp[0].$temp[1].$temp[2].$temp[3])) { $seems_utf8 = false; break; } } return $seems_utf8; } // // Safely converts text type columns into utf8 (MySQL only) // Function based on update_convert_table_utf8() from the Drupal project (http://drupal.org/) // function convert_table_utf8($table) { global $pun_db; $types = array( 'char' => 'binary', 'varchar' => 'varbinary', 'tinytext' => 'tinyblob', 'mediumtext' => 'mediumblob', 'text' => 'blob', 'longtext' => 'longblob' ); $convert_to_binary = array(); $convert_to_utf8 = array(); // Set table default charset to utf8 $pun_db->query('ALTER TABLE `'.$table.'` CHARACTER SET utf8') or error(__FILE__, __LINE__); // Find out which columns need converting and build SQL statements $result = $pun_db->query('SHOW FULL COLUMNS FROM `'.$table.'`') or error(__FILE__, __LINE__); while ($cur_column = $pun_db->fetch_assoc($result)) { list($type) = explode('(', $cur_column['Type']); if (isset($types[$type]) && strpos($cur_column['Collation'], 'utf8') === false) { $names = 'CHANGE `'. $cur_column['Field'] .'` `'. $cur_column['Field'] .'` '; $attributes = $cur_column['Null'] == 'YES' ? ' NULL' : ' NOT NULL'; // Only supply a default value if a default value is specified if ($cur_column['Default'] !== null) $attributes .= ' DEFAULT \''.$pun_db->escape($cur_column['Default']).'\''; $convert_to_binary[] = $names.preg_replace('/'. $type .'/i', $types[$type], $cur_column['Type']) . $attributes; $convert_to_utf8[] = $names.$cur_column['Type'] .' CHARACTER SET utf8'. $attributes; } } if (!empty($convert_to_binary)) { // Convert text columns to binary $pun_db->query('ALTER TABLE `'.$table.'` '.implode(', ', $convert_to_binary)) or error(__FILE__, __LINE__); // Convert binary columns to utf8 $pun_db->query('ALTER TABLE `'.$table.'` '.implode(', ', $convert_to_utf8)) or error(__FILE__, __LINE__); } } header('Content-type: text/html; charset=utf-8'); // Empty all output buffers and stop buffering while (@ob_end_clean()); $stage = isset($_GET['stage']) ? $_GET['stage'] : ''; $old_charset = isset($_GET['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_GET['req_old_charset'])) : 'ISO-8859-1'; $start_at = isset($_GET['start_at']) ? intval($_GET['start_at']) : 0; $query_str = ''; switch ($stage) { // Show form case '': $db_seems_utf8 = db_seems_utf8(); ?> PunBB Database Update
PunBB Database Update
Update database tables of current installation

PunBB Database Update

Perform update of database tables

  • WARNING! This script will update your PunBB forum database. The update procedure might take anything from a few seconds to a few minutes (or in extreme cases, hours) depending on the speed of the server, the size of the forum database and the number of changes required.
  • Do not forget to make a backup of the database before continuing.
  • Did you read the update instructions in the documentation? If not, start there.
  • IMPORTANT! PunBB has detected that this PHP environment does not have support for the encoding mechanisms required to do UTF-8 conversion from character sets other than ISO-8859-1. What this means is that if the current character set is not ISO-8859-1, PunBB won't be able to convert your forum database to UTF-8 and you will have to do it manually. Instructions for doing manual charset conversion can be found in the update instructions.
  • IMPORTANT! Based on a random selection of 100 posts, topic subjects, usernames and forum names from the database, it appears as if text in the database is currently UTF-8 encoded. This is a good thing. Based on this, the update process will not attempt to do charset conversion. If you have reason to believe that the charset conversion is required nonetheless, you can force the conversion to run.

Important! All fields marked (Required) must be completed before submitting this form.

Enable conversion: When enabled this update script will, after it has made the required structural changes to the database, convert all text in the database from the current character set to UTF-8. This conversion is required if you're upgrading from PunBB 1.2 and you are not currently using an UTF-8 language pack.

Current character set: If the primary language in your forum is English, you can leave this at the default value. However, if your forum is non-English, you should enter the character set of the primary language pack used in the forum.

Charset conversion
table_exists($pun_db->prefix.'extensions')) { switch ($db_type) { case 'mysql': case 'mysqli': $sql = 'CREATE TABLE '.$pun_db->prefix."extensions ( id VARCHAR(50) NOT NULL DEFAULT '', title VARCHAR(255) NOT NULL DEFAULT '', version VARCHAR(25) NOT NULL DEFAULT '', description TEXT, author VARCHAR(50) NOT NULL DEFAULT '', uninstall TEXT, uninstall_note TEXT, disabled TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY(id) ) ENGINE = MyISAM CHARACTER SET utf8"; break; case 'pgsql': $sql = 'CREATE TABLE '.$pun_db->prefix."extensions ( id VARCHAR(50) NOT NULL DEFAULT '', title VARCHAR(255) NOT NULL DEFAULT '', version VARCHAR(25) NOT NULL DEFAULT '', description TEXT, author VARCHAR(50) NOT NULL DEFAULT '', uninstall TEXT, uninstall_note TEXT, disabled SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY(id) )"; break; case 'sqlite': $sql = 'CREATE TABLE '.$pun_db->prefix."extensions ( id VARCHAR(50) NOT NULL DEFAULT '', title VARCHAR(255) NOT NULL DEFAULT '', version VARCHAR(25) NOT NULL DEFAULT '', description TEXT, author VARCHAR(50) NOT NULL DEFAULT '', uninstall TEXT, uninstall_note TEXT, disabled INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(id) )"; break; } $pun_db->query($sql) or error(__FILE__, __LINE__); } // Add uninstall_note field to extensions $pun_db->add_field($pun_db->prefix.'extensions', 'uninstall_note', 'TEXT', true, null, 'uninstall'); // Drop uninstall_notes (plural) field $pun_db->drop_field($pun_db->prefix.'extensions', 'uninstall_notes'); // Add disabled field to extensions $pun_db->add_field($pun_db->prefix.'extensions', 'disabled', 'TINYINT(1)', false, 0, 'uninstall_note'); // Add the extension_hooks table if (!$pun_db->table_exists($pun_db->prefix.'extension_hooks')) { switch ($db_type) { case 'mysql': case 'mysqli': $sql = 'CREATE TABLE '.$pun_db->prefix."extension_hooks ( id VARCHAR(50) NOT NULL DEFAULT '', extension_id VARCHAR(50) NOT NULL DEFAULT '', code TEXT, installed INT(10) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(id, extension_id) ) ENGINE = MyISAM CHARACTER SET utf8"; break; case 'pgsql': $sql = 'CREATE TABLE '.$pun_db->prefix."extension_hooks ( id VARCHAR(50) NOT NULL DEFAULT '', extension_id VARCHAR(50) NOT NULL DEFAULT '', code TEXT, installed INT NOT NULL DEFAULT 0, PRIMARY KEY(id, extension_id) )"; break; case 'sqlite': $sql = 'CREATE TABLE '.$pun_db->prefix."extension_hooks ( id VARCHAR(50) NOT NULL DEFAULT '', extension_id VARCHAR(50) NOT NULL DEFAULT '', code TEXT, installed INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(id, extension_id) )"; break; } $pun_db->query($sql) or error(__FILE__, __LINE__); } if ($db_type == 'mysql' || $db_type == 'mysqli') { // Make all e-mail fields VARCHAR(80) $pun_db->query('ALTER TABLE '.$pun_db->prefix.'bans CHANGE email email VARCHAR(80)') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'posts CHANGE poster_email poster_email VARCHAR(80)') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'users CHANGE email email VARCHAR(80)') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'users CHANGE jabber jabber VARCHAR(80)') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'users CHANGE msn msn VARCHAR(80)') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'users CHANGE activate_string activate_string VARCHAR(80)') or error(__FILE__, __LINE__); // Remove NOT NULL from TEXT fields for consistency. See http://dev.punbb.org/changeset/596 $pun_db->query('ALTER TABLE '.$pun_db->prefix.'posts CHANGE message message TEXT') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'reports CHANGE message message TEXT') or error(__FILE__, __LINE__); } // Add the DST option to the users table $pun_db->add_field($pun_db->prefix.'users', 'dst', 'TINYINT(1)', false, 0, 'timezone'); // Add the salt field to the users table $pun_db->add_field($pun_db->prefix.'users', 'salt', 'VARCHAR(12)', true, null, 'password'); // Add the access_keys field to the users table $pun_db->add_field($pun_db->prefix.'users', 'access_keys', 'TINYINT(1)', false, 0, 'show_sig'); // Add the CSRF token field to the online table $pun_db->add_field($pun_db->prefix.'online', 'csrf_token', 'VARCHAR(40)', false, '', null); // Add the prev_url field to the online table $pun_db->add_field($pun_db->prefix.'online', 'prev_url', 'VARCHAR(255)', true, null, null); // Drop use_avatar column from users table $pun_db->drop_field($pun_db->prefix.'users', 'use_avatar'); // Make sure we have o_additional_navlinks (was added in 1.2.1) if (!array_key_exists('o_additional_navlinks', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_additional_navlinks\', \'\')') or error(__FILE__, __LINE__); // Insert new config options o_sef if (!array_key_exists('o_sef', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_sef\', \'Default\')') or error(__FILE__, __LINE__); // Insert new config option o_topic_views if (!array_key_exists('o_topic_views', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_topic_views\', \'1\')') or error(__FILE__, __LINE__); // Insert new config option o_signatures if (!array_key_exists('o_signatures', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_signatures\', \'1\')') or error(__FILE__, __LINE__); // Insert new config option o_smtp_ssl if (!array_key_exists('o_smtp_ssl', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_smtp_ssl\', \'0\')') or error(__FILE__, __LINE__); // Insert new config option o_check_for_updates if (!array_key_exists('o_check_for_updates', $pun_config)) { $check_for_updates = (function_exists('curl_init') || function_exists('fsockopen') || in_array(strtolower(@ini_get('allow_url_fopen')), array('on', 'true', '1'))) ? 1 : 0; $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_check_for_updates\', \''.$check_for_updates.'\')') or error(__FILE__, __LINE__); } // Insert new config option o_announcement_heading if (!array_key_exists('o_announcement_heading', $pun_config)) $pun_db->query('INSERT INTO '.$pun_db->prefix.'config (conf_name, conf_value) VALUES(\'o_announcement_heading\', \'\')') or error(__FILE__, __LINE__); // Server timezone is now simply the default timezone if (!array_key_exists('o_default_timezone', $pun_config)) $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_name=\'o_default_timezone\' WHERE conf_name=\'o_server_timezone\'') or error(__FILE__, __LINE__); // Increase visit timeout to 30 minutes (only if it hasn't been changed from the default) if ($pun_config['o_timeout_visit'] == '600') $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value=\'1800\' WHERE conf_name=\'o_timeout_visit\'') or error(__FILE__, __LINE__); // Remove obsolete g_post_polls permission from groups table if ($pun_db->field_exists($pun_db->prefix.'groups', 'g_post_polls') && $db_type != 'sqlite') // No DROP column in SQLite $pun_db->query('ALTER TABLE '.$pun_db->prefix.'groups DROP g_post_polls') or error(__FILE__, __LINE__); // Make room for multiple moderator groups if (!$pun_db->field_exists($pun_db->prefix.'groups', 'g_moderator')) { // Add g_moderator column to groups table $pun_db->add_field($pun_db->prefix.'groups', 'g_moderator', 'TINYINT(1)', false, 0, 'g_user_title'); // Give the moderator group moderator privileges $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_moderator=1 WHERE g_id=2') or error(__FILE__, __LINE__); // Shuffle the group IDs around a bit $result = $pun_db->query('SELECT MAX(g_id)+1 FROM '.$pun_db->prefix.'groups') or error(__FILE__, __LINE__); $temp_id = $pun_db->result($result); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_id='.$temp_id.' WHERE g_id=2') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_id=2 WHERE g_id=3') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_id=3 WHERE g_id=4') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_id=4 WHERE g_id='.$temp_id) or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id='.$temp_id.' WHERE group_id=2') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id=2 WHERE group_id=3') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id=3 WHERE group_id=4') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id=4 WHERE group_id='.$temp_id) or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'forum_perms SET group_id='.$temp_id.' WHERE group_id=2') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'forum_perms SET group_id=2 WHERE group_id=3') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'forum_perms SET group_id=3 WHERE group_id=4') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'forum_perms SET group_id=4 WHERE group_id='.$temp_id) or error(__FILE__, __LINE__); // Update the default usergroup if it uses the old ID for the members group $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value="3" WHERE conf_name="o_default_user_group" and conf_value="4"') or error(__FILE__, __LINE__); } // Replace obsolete p_mod_edit_users config setting with new per-group permission if (array_key_exists('p_mod_edit_users', $pun_config)) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'config WHERE conf_name=\'p_mod_edit_users\'') or error(__FILE__, __LINE__); $pun_db->add_field($pun_db->prefix.'groups', 'g_mod_edit_users', 'TINYINT(1)', false, 0, 'g_moderator'); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_mod_edit_users='.$pun_config['p_mod_edit_users'].' WHERE g_moderator=1') or error(__FILE__, __LINE__); } // Replace obsolete p_mod_rename_users config setting with new per-group permission if (array_key_exists('p_mod_rename_users', $pun_config)) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'config WHERE conf_name=\'p_mod_rename_users\'') or error(__FILE__, __LINE__); $pun_db->add_field($pun_db->prefix.'groups', 'g_mod_rename_users', 'TINYINT(1)', false, 0, 'g_mod_edit_users'); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_mod_rename_users='.$pun_config['p_mod_rename_users'].' WHERE g_moderator=1') or error(__FILE__, __LINE__); } // Replace obsolete p_mod_change_passwords config setting with new per-group permission if (array_key_exists('p_mod_change_passwords', $pun_config)) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'config WHERE conf_name=\'p_mod_change_passwords\'') or error(__FILE__, __LINE__); $pun_db->add_field($pun_db->prefix.'groups', 'g_mod_change_passwords', 'TINYINT(1)', false, 0, 'g_mod_rename_users'); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_mod_change_passwords='.$pun_config['p_mod_change_passwords'].' WHERE g_moderator=1') or error(__FILE__, __LINE__); } // Replace obsolete p_mod_ban_users config setting with new per-group permission if (array_key_exists('p_mod_ban_users', $pun_config)) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'config WHERE conf_name=\'p_mod_ban_users\'') or error(__FILE__, __LINE__); $pun_db->add_field($pun_db->prefix.'groups', 'g_mod_ban_users', 'TINYINT(1)', false, 0, 'g_mod_change_passwords'); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_mod_ban_users='.$pun_config['p_mod_ban_users'].' WHERE g_moderator=1') or error(__FILE__, __LINE__); } // We need to add a unique index to avoid users having multiple rows in the online table if (!$pun_db->index_exists($pun_db->prefix.'online', $pun_db->prefix.'online_user_id_ident_idx')) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'online') or error(__FILE__, __LINE__); switch ($db_type) { case 'mysql': case 'mysqli': $pun_db->query('ALTER TABLE '.$pun_db->prefix.'online ADD UNIQUE INDEX '.$pun_db->prefix.'online_user_id_ident_idx (user_id, ident(25))') or error(__FILE__, __LINE__); break; default: $pun_db->query('CREATE UNIQUE INDEX '.$pun_db->prefix.'online_user_id_ident_idx ON '.$pun_db->prefix.'online(user_id, ident)') or error(__FILE__, __LINE__); break; } } // Get rid of the old search tables for mysql/mysqli if (($db_type == 'mysql' || $db_type == 'mysqli') && $pun_db->table_exists($pun_db->prefix.'search_cache') && $pun_db->table_exists($pun_db->prefix.'search_matches') && $pun_db->table_exists($pun_db->prefix.'search_words')) $pun_db->query('DROP TABLE '.$pun_db->prefix.'search_cache, '.$pun_db->prefix.'search_matches, '.$pun_db->prefix.'search_words') or error(__FILE__, __LINE__); // Add an index on last_post in the topics table if (!$pun_db->index_exists($pun_db->prefix.'topics', $pun_db->prefix.'topics_last_post_idx')) { switch ($db_type) { case 'mysql': case 'mysqli': $pun_db->query('ALTER TABLE '.$pun_db->prefix.'topics ADD INDEX '.$pun_db->prefix.'topics_last_post_idx(last_post)') or error(__FILE__, __LINE__); break; default: $pun_db->query('CREATE INDEX '.$pun_db->prefix.'topics_last_post_idx ON '.$pun_db->prefix.'topics(last_post)') or error(__FILE__, __LINE__); break; } } // Remove any remnants of the now defunct post approval system $pun_db->drop_field($pun_db->prefix.'forums', 'approval'); $pun_db->drop_field($pun_db->prefix.'groups', 'g_posts_approved'); $pun_db->drop_field($pun_db->prefix.'posts', 'approved'); // Add g_view_users field to groups table $pun_db->add_field($pun_db->prefix.'groups', 'g_view_users', 'TINYINT(1)', false, 1, 'g_read_board'); // Add the time/date format settings to the user table $pun_db->add_field($pun_db->prefix.'users', 'time_format', 'INT(10)', false, 0, 'dst'); $pun_db->add_field($pun_db->prefix.'users', 'date_format', 'INT(10)', false, 0, 'dst'); // Add the last_search column to the users table $pun_db->add_field($pun_db->prefix.'users', 'last_search', 'INT(10)', true, null, 'last_post'); // Add the last_email_sent column to the users table and the g_send_email and // g_email_flood columns to the groups table $pun_db->add_field($pun_db->prefix.'users', 'last_email_sent', 'INT(10)', true, null, 'last_search'); $pun_db->add_field($pun_db->prefix.'groups', 'g_send_email', 'TINYINT(1)', false, 1, 'g_search_users'); $pun_db->add_field($pun_db->prefix.'groups', 'g_email_flood', 'INT(10)', false, 60, 'g_search_flood'); // Set non-default g_send_email and g_flood_email values properly $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_send_email=0 WHERE g_id=2') or error(__FILE__, __LINE__); $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_email_flood=0 WHERE g_id IN (1,2,4)') or error(__FILE__, __LINE__); // Add the auto notify/subscription option to the users table $pun_db->add_field($pun_db->prefix.'users', 'auto_notify', 'TINYINT(1)', false, 0, 'notify_with_post'); // Add the first_post_id column to the topics table if (!$pun_db->field_exists($pun_db->prefix.'topics', 'first_post_id')) { switch ($db_type) { case 'mysql': case 'mysqli': $pun_db->query('ALTER TABLE '.$pun_db->prefix.'topics ADD first_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER posted') or error(__FILE__, __LINE__); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'topics ADD INDEX '.$pun_db->prefix.'topics_first_post_id_idx(first_post_id)') or error(__FILE__, __LINE__); break; default: $pun_db->add_field($pun_db->prefix.'topics', 'first_post_id', 'INT', false, 0, null); $pun_db->query('CREATE INDEX '.$pun_db->prefix.'topics_first_post_id_idx ON '.$pun_db->prefix.'topics(first_post_id)') or error(__FILE__, __LINE__); break; } // Now that we've added the column and indexed it, we need to give it correct data $result = $pun_db->query('SELECT min(id) AS first_post, topic_id FROM '.$pun_db->prefix.'posts GROUP BY topic_id') or error(__FILE__, __LINE__); while ($cur_post = $pun_db->fetch_assoc($result)) { $pun_db->query('UPDATE '.$pun_db->prefix.'topics SET first_post_id = '.$cur_post['first_post'].' WHERE id = '.$cur_post['topic_id']) or error(__FILE__, __LINE__); } } // Move any users with the old unverified status to their new group $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id=0 WHERE group_id=32000') or error(__FILE__, __LINE__); // Add the ban_creator column to the bans table if (!$pun_db->field_exists($pun_db->prefix.'bans', 'ban_creator')) { switch ($db_type) { case 'mysql': case 'mysqli': $pun_db->query('ALTER TABLE '.$pun_db->prefix.'bans ADD ban_creator INT(10) UNSIGNED NOT NULL DEFAULT 0') or error(__FILE__, __LINE__); break; default: $pun_db->add_field($pun_db->prefix.'bans', 'ban_creator', 'INT', false, 0, null); break; } } // Remove any hotfix extensions this update supersedes if (!empty($supersedes_ext)) { $pun_db->query('DELETE FROM '.$pun_db->prefix.'extension_hooks WHERE extension_id IN(\''.implode('\',\'', $supersedes_ext).'\')') or error(__FILE__, __LINE__); $pun_db->query('DELETE FROM '.$pun_db->prefix.'extensions WHERE id IN(\''.implode('\',\'', $supersedes_ext).'\')') or error(__FILE__, __LINE__); } // Should we do charset conversion or not? if (isset($_GET['convert_charset'])) $query_str = '?stage=conv_misc&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; else $query_str = '?stage=conv_tables'; break; // Convert config, categories, forums, groups, ranks and censor words case 'conv_misc': // Convert config echo 'Converting configuration …'."
\n"; foreach ($pun_config as $conf_name => $conf_value) { if (convert_to_utf8($conf_value, $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value=\''.$pun_db->escape($conf_value).'\' WHERE conf_name=\''.$conf_name.'\'') or error(__FILE__, __LINE__); } // Convert categories echo 'Converting categories …'."
\n"; $result = $pun_db->query('SELECT id, cat_name FROM '.$pun_db->prefix.'categories ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { if (convert_to_utf8($cur_item['cat_name'], $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'categories SET cat_name=\''.$pun_db->escape($cur_item['cat_name']).'\' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } // Convert forums echo 'Converting forums …'."
\n"; $result = $pun_db->query('SELECT id, forum_name, forum_desc, moderators FROM '.$pun_db->prefix.'forums ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { $moderators = ($cur_item['moderators'] != '') ? unserialize($cur_item['moderators']) : array(); $moderators_utf8 = array(); foreach ($moderators as $mod_username => $mod_user_id) { convert_to_utf8($mod_username, $old_charset); $moderators_utf8[$mod_username] = $mod_user_id; } if (convert_to_utf8($cur_item['forum_name'], $old_charset) | convert_to_utf8($cur_item['forum_desc'], $old_charset) || $moderators !== $moderators_utf8) { $cur_item['forum_desc'] = $cur_item['forum_desc'] != '' ? '\''.$pun_db->escape($cur_item['forum_desc']).'\'' : 'NULL'; $cur_item['moderators'] = !empty($moderators_utf8) ? '\''.$pun_db->escape(serialize($moderators_utf8)).'\'' : 'NULL'; $pun_db->query('UPDATE '.$pun_db->prefix.'forums SET forum_name=\''.$pun_db->escape($cur_item['forum_name']).'\', forum_desc='.$cur_item['forum_desc'].', moderators='.$cur_item['moderators'].' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } } // Convert groups echo 'Converting groups …'."
\n"; $result = $pun_db->query('SELECT g_id, g_title, g_user_title FROM '.$pun_db->prefix.'groups ORDER BY g_id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { if (convert_to_utf8($cur_item['g_title'], $old_charset) | convert_to_utf8($cur_item['g_user_title'], $old_charset)) { $cur_item['g_user_title'] = $cur_item['g_user_title'] != '' ? '\''.$pun_db->escape($cur_item['g_user_title']).'\'' : 'NULL'; $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_title=\''.$pun_db->escape($cur_item['g_title']).'\', g_user_title='.$cur_item['g_user_title'].' WHERE g_id='.$cur_item['g_id']) or error(__FILE__, __LINE__); } } // Convert ranks echo 'Converting ranks …'."
\n"; $result = $pun_db->query('SELECT id, rank FROM '.$pun_db->prefix.'ranks ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { if (convert_to_utf8($cur_item['rank'], $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'ranks SET rank=\''.$pun_db->escape($cur_item['rank']).'\' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } // Convert censor words echo 'Converting censor words …'."
\n"; $result = $pun_db->query('SELECT id, search_for, replace_with FROM '.$pun_db->prefix.'censoring ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { if (convert_to_utf8($cur_item['search_for'], $old_charset) | convert_to_utf8($cur_item['replace_with'], $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'censoring SET search_for=\''.$pun_db->escape($cur_item['search_for']).'\', replace_with=\''.$pun_db->escape($cur_item['replace_with']).'\' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; break; // Convert reports case 'conv_reports': // Determine where to start if ($start_at == 0) { // Get the first report ID from the db $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'reports ORDER BY id LIMIT 1') or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $start_at = $pun_db->result($result); } $end_at = $start_at + PER_PAGE; // Fetch reports to process this cycle $result = $pun_db->query('SELECT id, message FROM '.$pun_db->prefix.'reports WHERE id>='.$start_at.' AND id<'.$end_at.' ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { echo 'Converting report '.$cur_item['id'].' …
'."\n"; if (convert_to_utf8($cur_item['message'], $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'reports SET message=\''.$pun_db->escape($cur_item['message']).'\' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } // Check if there is more work to do $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'reports WHERE id>='.$end_at) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $query_str = '?stage=conv_reports&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$end_at; else $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; break; // Convert users case 'conv_users': // Determine where to start if ($start_at == 0) $start_at = 2; $end_at = $start_at + PER_PAGE; // Fetch users to process this cycle $result = $pun_db->query('SELECT id, username, title, realname, location, signature, admin_note FROM '.$pun_db->prefix.'users WHERE id>='.$start_at.' AND id<'.$end_at.' ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { echo 'Converting user '.$cur_item['id'].' …
'."\n"; if (convert_to_utf8($cur_item['username'], $old_charset) | convert_to_utf8($cur_item['title'], $old_charset) | convert_to_utf8($cur_item['realname'], $old_charset) | convert_to_utf8($cur_item['location'], $old_charset) | convert_to_utf8($cur_item['signature'], $old_charset) | convert_to_utf8($cur_item['admin_note'], $old_charset)) { $cur_item['title'] = $cur_item['title'] != '' ? '\''.$pun_db->escape($cur_item['title']).'\'' : 'NULL'; $cur_item['realname'] = $cur_item['realname'] != '' ? '\''.$pun_db->escape($cur_item['realname']).'\'' : 'NULL'; $cur_item['location'] = $cur_item['location'] != '' ? '\''.$pun_db->escape($cur_item['location']).'\'' : 'NULL'; $cur_item['signature'] = $cur_item['signature'] != '' ? '\''.$pun_db->escape($cur_item['signature']).'\'' : 'NULL'; $cur_item['admin_note'] = $cur_item['admin_note'] != '' ? '\''.$pun_db->escape($cur_item['admin_note']).'\'' : 'NULL'; $pun_db->query('UPDATE '.$pun_db->prefix.'users SET username=\''.$pun_db->escape($cur_item['username']).'\', title='.$cur_item['title'].', realname='.$cur_item['realname'].', location='.$cur_item['location'].', signature='.$cur_item['signature'].', admin_note='.$cur_item['admin_note'].' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } } // Check if there is more work to do $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'users WHERE id>='.$end_at) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $query_str = '?stage=conv_users&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$end_at; else $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; break; // Convert topics case 'conv_topics': // Determine where to start if ($start_at == 0) { // Get the first topic ID from the db $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'topics ORDER BY id LIMIT 1') or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $start_at = $pun_db->result($result); } $end_at = $start_at + PER_PAGE; // Fetch topics to process this cycle $result = $pun_db->query('SELECT id, poster, subject, last_poster FROM '.$pun_db->prefix.'topics WHERE id>='.$start_at.' AND id<'.$end_at.' ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { echo 'Converting topic '.$cur_item['id'].' …
'."\n"; if (convert_to_utf8($cur_item['poster'], $old_charset) | convert_to_utf8($cur_item['subject'], $old_charset) | convert_to_utf8($cur_item['last_poster'], $old_charset)) $pun_db->query('UPDATE '.$pun_db->prefix.'topics SET poster=\''.$pun_db->escape($cur_item['poster']).'\', subject=\''.$pun_db->escape($cur_item['subject']).'\', last_poster=\''.$pun_db->escape($cur_item['last_poster']).'\' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } // Check if there is more work to do $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'topics WHERE id>='.$end_at) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $query_str = '?stage=conv_topics&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$end_at; else $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE; break; // Convert posts case 'conv_posts': // Determine where to start if ($start_at == 0) { // Get the first post ID from the db $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'posts ORDER BY id LIMIT 1') or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $start_at = $pun_db->result($result); } $end_at = $start_at + PER_PAGE; // Fetch posts to process this cycle $result = $pun_db->query('SELECT id, poster, message, edited_by FROM '.$pun_db->prefix.'posts WHERE id>='.$start_at.' AND id<'.$end_at.' ORDER BY id') or error(__FILE__, __LINE__); while ($cur_item = $pun_db->fetch_assoc($result)) { echo 'Converting post '.$cur_item['id'].' …
'."\n"; if (convert_to_utf8($cur_item['poster'], $old_charset) | convert_to_utf8($cur_item['message'], $old_charset) | convert_to_utf8($cur_item['edited_by'], $old_charset)) { $cur_item['edited_by'] = $cur_item['edited_by'] != '' ? '\''.$pun_db->escape($cur_item['edited_by']).'\'' : 'NULL'; $pun_db->query('UPDATE '.$pun_db->prefix.'posts SET poster=\''.$pun_db->escape($cur_item['poster']).'\', message=\''.$pun_db->escape($cur_item['message']).'\', edited_by='.$cur_item['edited_by'].' WHERE id='.$cur_item['id']) or error(__FILE__, __LINE__); } } // Check if there is more work to do $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'posts WHERE id>='.$end_at) or error(__FILE__, __LINE__); if ($pun_db->num_rows($result)) $query_str = '?stage=conv_posts&req_old_charset='.$old_charset.'&req_per_page='.PER_PAGE.'&start_at='.$end_at; else $query_str = ($db_type == 'mysql' || $db_type == 'mysqli') ? '?stage=conv_tables' : '?stage=finish'; break; // Convert table columns to utf8 (MySQL only) case 'conv_tables': // Do the cumbersome charset conversion of MySQL tables/columns if ($db_type == 'mysql' || $db_type == 'mysqli') { // Drop fulltext indexes to prevent errors in convert_table_utf8() (should only apply to SVN installs) if ($pun_db->index_exists($pun_db->prefix.'topics', $pun_db->prefix.'topics_subject_idx')) $pun_db->query('ALTER TABLE '.$pun_db->prefix.'topics DROP INDEX '.$pun_db->prefix.'topics_subject_idx') or error(__FILE__, __LINE__); if ($pun_db->index_exists($pun_db->prefix.'posts', $pun_db->prefix.'posts_message_idx')) $pun_db->query('ALTER TABLE '.$pun_db->prefix.'posts DROP INDEX '.$pun_db->prefix.'posts_message_idx') or error(__FILE__, __LINE__); echo 'Converting table '.$pun_db->prefix.'bans …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'bans'); echo 'Converting table '.$pun_db->prefix.'categories …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'categories'); echo 'Converting table '.$pun_db->prefix.'censoring …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'censoring'); echo 'Converting table '.$pun_db->prefix.'config …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'config'); echo 'Converting table '.$pun_db->prefix.'extension_hooks …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'extension_hooks'); echo 'Converting table '.$pun_db->prefix.'extensions …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'extensions'); echo 'Converting table '.$pun_db->prefix.'forum_perms …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'forum_perms'); echo 'Converting table '.$pun_db->prefix.'forums …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'forums'); echo 'Converting table '.$pun_db->prefix.'groups …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'groups'); echo 'Converting table '.$pun_db->prefix.'online …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'online'); echo 'Converting table '.$pun_db->prefix.'posts …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'posts'); echo 'Converting table '.$pun_db->prefix.'ranks …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'ranks'); echo 'Converting table '.$pun_db->prefix.'reports …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'reports'); echo 'Converting table '.$pun_db->prefix.'subscriptions …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'subscriptions'); echo 'Converting table '.$pun_db->prefix.'topics …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'topics'); echo 'Converting table '.$pun_db->prefix.'users …
'."\n"; flush(); convert_table_utf8($pun_db->prefix.'users'); } $query_str = '?stage=add_fulltext'; break; // Add fulltext indexes (MySQL only) case 'add_fulltext': if ($db_type == 'mysql' || $db_type == 'mysqli') { // Add topic subject fulltext index if (!$pun_db->index_exists($pun_db->prefix.'topics', $pun_db->prefix.'topics_subject_idx')) { echo 'Adding fulltext index '.$pun_db->prefix.'topics_subject_idx …
'."\n"; flush(); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'topics ADD FULLTEXT '.$pun_db->prefix.'topics_subject_idx(subject)') or error(__FILE__, __LINE__); } // Add post message fulltext index if (!$pun_db->index_exists($pun_db->prefix.'posts', $pun_db->prefix.'posts_message_idx')) { echo 'Adding fulltext index '.$pun_db->prefix.'posts_message_idx …
'."\n"; flush(); $pun_db->query('ALTER TABLE '.$pun_db->prefix.'posts ADD FULLTEXT '.$pun_db->prefix.'posts_message_idx(message)') or error(__FILE__, __LINE__); } } $query_str = '?stage=finish'; break; // Show results page case 'finish': // We update the version number $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value=\''.UPDATE_TO.'\' WHERE conf_name=\'o_cur_version\'') or error(__FILE__, __LINE__); // This feels like a good time to synchronize the forums $result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'forums') or error(__FILE__, __LINE__); while ($row = $pun_db->fetch_row($result)) sync_forum($row[0]); // We'll empty the search cache table as well (using DELETE FROM since SQLite does not support TRUNCATE TABLE) if ($db_type != 'mysql' && $db_type != 'mysqli') $pun_db->query('DELETE FROM '.$pun_db->prefix.'search_cache') or error(__FILE__, __LINE__); // Empty the PHP cache $d = dir(PUN_CACHE_DIR); while (($entry = $d->read()) !== false) { if (substr($entry, strlen($entry)-4) == '.php') @unlink(PUN_CACHE_DIR.$entry); } $d->close(); // Drop Base URL row from database config if (array_key_exists('o_base_url', $pun_config)) { // Generate new config file $new_config = "query('DELETE FROM '.$pun_db->prefix.'config WHERE conf_name=\'o_base_url\'') or error(__FILE__, __LINE__); } ?> PunBB Database Update
PunBB Database Update
Update database tables of current installation

PunBB Database Update

PunBB Database Update completed!

Your forum database was updated successfully.

In order to complete the process, you must now update your config.php script. Copy and paste the text in the text box below into the file called config.php in the root directory of your PunBB installation. The file already exists, so you must edit/overwrite the contents of the old file.

Important! Once the update is completed you should remove this script from the forum root directory and follow the rest of the instructions in the update documentation.

New config.php contents
end_transaction(); $pun_db->close(); if ($query_str != '') exit('
JavaScript seems to be disabled. Click here to continue.');