Show the nag we show for a stuck .maintenance file when an auto update failed.

see #25654.


git-svn-id: https://develop.svn.wordpress.org/trunk@25872 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-10-22 21:14:06 +00:00
parent ddbc271329
commit aab4ffb29d

View File

@ -344,8 +344,27 @@ function wp_theme_update_row( $theme_key, $theme ) {
}
function maintenance_nag() {
include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
global $upgrading;
if ( ! isset( $upgrading ) )
$nag = isset( $upgrading );
if ( ! $nag ) {
$failed = get_site_option( 'auto_core_update_failed' );
/*
* If an update failed critically, we may have copied over version.php but not other files.
* In that case, if the install claims we're running the version we attempted, nag.
* This is serious enough to err on the side of nagging.
*
* If we simply failed to update before we tried to copy any files, then assume things are
* OK if they are now running the latest.
*
* This flag is cleared whenever a successful update occurs using Core_Upgrader.
*/
$comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
if ( version_compare( $failed['attempted'], $wp_version, '>=' ) )
$nag = true;
}
if ( ! $nag )
return false;
if ( current_user_can('update_core') )
@ -356,3 +375,4 @@ function maintenance_nag() {
echo "<div class='update-nag'>$msg</div>";
}
add_action( 'admin_notices', 'maintenance_nag' );
add_action( 'network_admin_notices', 'maintenance_nag' );