query('SELECT cur_version FROM '.$db->prefix.'options'); $result2 = $db->query('SELECT conf_value FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_version\''); $cur_version = ($result1) ? $db->result($result1) : (($result2 && $db->num_rows($result2)) ? $db->result($result2) : 'beta'); if (!in_array($cur_version, $update_from)) error('Version mismatch. This script updates version '.implode(', ', $update_from).' to version '.$update_to.'. The database \''.$db_name.'\' doesn\'t seem to be running a supported version.', __FILE__, __LINE__); // Get the forum config $result = $db->query('SELECT * FROM '.$db->prefix.'config'); while ($cur_config_item = $db->fetch_row($result)) $pun_config[$cur_config_item[0]] = $cur_config_item[1]; if (!isset($_POST['form_sent'])) { ?> PunBB Update

PunBB Update

This script will update your current PunBB forum database to PunBB . The update procedure might take anything from a second to a few minutes depending on the speed of the server and the size of the forum database. Don't forget to make a backup of the database before continuing.

Did you read the update instructions in the documentation? If not, start there.

query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_additional_navlinks\', NULL)') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error()); } // We need to add a unique index to avoid users having multiple rows in the online table if ($db_type == 'mysql' || $db_type == 'mysqli') { $result = $db->query('SHOW INDEX FROM '.$db->prefix.'online') or error('Unable to check DB structure.', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result) == 1) $db->query('ALTER TABLE '.$db->prefix.'online ADD UNIQUE INDEX '.$db->prefix.'online_user_id_ident_idx(user_id,ident)') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error()); } // This feels like a good time to synchronize the forums $result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum info.', __FILE__, __LINE__, $db->error()); while ($row = $db->fetch_row($result)) update_forum($row[0]); // We'll empty the search cache table as well (using DELETE FROM since SQLite does not support TRUNCATE TABLE) $db->query('DELETE FROM '.$db->prefix.'search_cache') or error('Unable to flush search results.', __FILE__, __LINE__, $db->error()); // Finally, we update the version number $db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$update_to.'\' WHERE conf_name=\'o_cur_version\'') or error('Unable to update version.', __FILE__, __LINE__, $db->error()); // Delete all .php files in the cache (someone might have visited the forums while we were updating and thus, generated incorrect cache files) $d = dir(PUN_ROOT.'cache'); while (($entry = $d->read()) !== false) { if (substr($entry, strlen($entry)-4) == '.php') @unlink(PUN_ROOT.'cache/'.$entry); } $d->close(); ?> PunBB Update

Update completed

Update successful! Your forum database has now been updated to version . You should now remove this script from the forum root directory and follow the rest of the instructions in the documentation.