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:
parent
e854ecac2e
commit
52d12303ea
|
@ -18,7 +18,17 @@ if ( defined('ABSPATH') )
|
||||||
else
|
else
|
||||||
require_once('../wp-load.php');
|
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']))));
|
wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,9 +278,7 @@ function upgrade_all() {
|
||||||
|
|
||||||
maybe_disable_automattic_widgets();
|
maybe_disable_automattic_widgets();
|
||||||
|
|
||||||
$wp_rewrite->flush_rules();
|
update_option('db_version', 'db_upgraded');
|
||||||
|
|
||||||
update_option('db_version', $wp_db_version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue