session_begin(); phpbb::$acl->init(phpbb::$user->data); phpbb::$user->setup('install'); if (!phpbb::$user->is_registered) { login_box(); } if (!phpbb::$acl->acl_get('a_board')) { trigger_error('NO_AUTH'); } include PHPBB_ROOT_PATH . 'includes/db/db_tools.' . PHP_EXT; $db_tools = new phpbb_db_tools(phpbb::$db, true); // Define some variables for the database update $inline_update = (request_var('type', 0)) ? true : false; // Only an example, but also commented out $database_update_info = array( // No changes from 3.0.3-RC1 to 3.0.3 '3.0.3-RC1' => array(), ); $error_ary = array(); $errored = false; header('Content-type: text/html; charset=UTF-8'); ?> <?php echo phpbb::$user->lang['UPDATING_TO_LATEST_STABLE']; ?>

lang['UPDATING_TO_LATEST_STABLE']; ?>


lang['DATABASE_TYPE']; ?> :: sql_layer; ?>
destroy('#config'); $config = phpbb_cache::obtain_config(); echo phpbb::$user->lang['PREVIOUS_VERSION'] . ' :: ' . phpbb::$config['version'] . '
'; echo phpbb::$user->lang['UPDATED_VERSION'] . ' :: ' . $updates_to_version . '

'; $current_version = str_replace('rc', 'RC', strtolower(phpbb::$config['version'])); $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); $orig_version = phpbb::$config['version']; // 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) { if ($current_version !== $latest_version) { set_config('version_update_from', $orig_version); } } else { // If not called from the update script, we will actually remove the traces phpbb::$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); } // Schema updates ?>

lang['UPDATE_DATABASE_SCHEMA']; ?>


lang['PROGRESS']; ?> :: = as the version to be updated to next, we will skip the process if (version_compare($version, $current_version, '<') && version_compare($current_version, $next_version, '>=')) { continue; } if (!sizeof($schema_changes)) { continue; } // Get statements for schema updates $statements = $db_tools->sql_schema_changes($schema_changes); if (sizeof($statements)) { $no_updates = false; foreach ($statements as $sql) { _sql($sql, $errored, $error_ary); } } } _write_result($no_updates, $errored, $error_ary); // Data updates $error_ary = array(); $errored = $no_updates = false; ?>

lang['UPDATING_DATA']; ?>


lang['PROGRESS']; ?> :: = as the version to be updated to next, we will skip the process if (version_compare($version, $current_version, '<') && version_compare($current_version, $next_version, '>=')) { continue; } change_database_data($no_updates, $version); } _write_result($no_updates, $errored, $error_ary); $error_ary = array(); $errored = $no_updates = false; ?>

lang['UPDATE_VERSION_OPTIMIZE']; ?>


lang['PROGRESS']; ?> :: dbms_type) { case 'mysql': $sql = 'OPTIMIZE TABLE ' . $table_prefix . 'auth_access, ' . $table_prefix . 'banlist, ' . $table_prefix . 'categories, ' . $table_prefix . 'config, ' . $table_prefix . 'disallow, ' . $table_prefix . 'forum_prune, ' . $table_prefix . 'forums, ' . $table_prefix . 'groups, ' . $table_prefix . 'posts, ' . $table_prefix . 'posts_text, ' . $table_prefix . 'privmsgs, ' . $table_prefix . 'privmsgs_text, ' . $table_prefix . 'ranks, ' . $table_prefix . 'search_results, ' . $table_prefix . 'search_wordlist, ' . $table_prefix . 'search_wordmatch, ' . $table_prefix . 'sessions_keys' . $table_prefix . 'smilies, ' . $table_prefix . 'themes, ' . $table_prefix . 'themes_name, ' . $table_prefix . 'topics, ' . $table_prefix . 'topics_watch, ' . $table_prefix . 'user_group, ' . $table_prefix . 'users, ' . $table_prefix . 'vote_desc, ' . $table_prefix . 'vote_results, ' . $table_prefix . 'vote_voters, ' . $table_prefix . 'words'; _sql($sql, $errored, $error_ary); break; case 'postgresql': _sql("VACUUM ANALYZE", $errored, $error_ary); break; } */ _write_result($no_updates, $errored, $error_ary); ?>

lang['UPDATE_COMPLETED']; ?>


purge(); ?>

lang['UPDATE_FILES_NOTICE']; ?>

lang['COMPLETE_LOGIN_TO_BOARD']; ?>

lang['INLINE_UPDATE_SUCCESSFUL'])) ? phpbb::$user->lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?>

" class="button1">lang['CONTINUE_UPDATE_NOW'])) ? phpbb::$user->lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?>

purge(); ?>
\n{$sql}\n
"; } phpbb::$db->sql_return_on_error(true); $result = phpbb::$db->sql_query($sql); if (phpbb::$db->sql_error_triggered) { $errored = true; $error_ary['sql'][] = phpbb::$db->sql_error_sql; $error_ary['error_code'][] = phpbb::$db->_sql_error(); } phpbb::$db->sql_return_on_error(false); if ($echo_dot) { echo ". \n"; flush(); } return $result; } function _write_result($no_updates, $errored, $error_ary) { if ($no_updates) { echo ' ' . phpbb::$user->lang['NO_UPDATES_REQUIRED'] . '

'; } else { echo ' ' . phpbb::$user->lang['DONE'] . '

' . phpbb::$user->lang['RESULT'] . ' :: '; if ($errored) { echo ' ' . phpbb::$user->lang['SOME_QUERIES_FAILED'] . '

' . phpbb::$user->lang['SQL_FAILURE_EXPLAIN'] . '

'; } else { echo '' . phpbb::$user->lang['NO_ERRORS'] . '

'; } } } ?>