Add hook "after_db_upgrade" and flush rewrite rules on the next page load after successful upgrade

git-svn-id: http://svn.automattic.com/wordpress/trunk@10530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-02-09 19:19:38 +00:00
parent e854ecac2e
commit 52d12303ea
2 changed files with 12 additions and 4 deletions

View File

@ -18,7 +18,17 @@ if ( defined('ABSPATH') )
else
require_once('../wp-load.php');
if ( get_option('db_version') != $wp_db_version ) {
if ( get_option('db_version') == 'db_upgraded' ) {
$wp_rewrite->flush_rules();
update_option('db_version', $wp_db_version);
/**
* Runs on the next page load after successful upgrade
*
* @since 2.8
*/
do_action('after_db_upgrade');
} elseif ( get_option('db_version') != $wp_db_version ) {
wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
exit;
}

View File

@ -278,9 +278,7 @@ function upgrade_all() {
maybe_disable_automattic_widgets();
$wp_rewrite->flush_rules();
update_option('db_version', $wp_db_version);
update_option('db_version', 'db_upgraded');
}
/**