Skip to content

Commit

Permalink
Update to WordPress 4.8.1 (2/2) - includes bugfix for improved Panthe…
Browse files Browse the repository at this point in the history
…on-specific update notice. For more information, see #131
  • Loading branch information
Pantheon Automation authored and greg-1-anderson committed Aug 14, 2017
1 parent 6d51b33 commit 771b52e
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions wp-content/mu-plugins/pantheon/pantheon-updates.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php
// Disable WordPress ato updates
// Disable WordPress auto updates
if( ! defined('WP_AUTO_UPDATE_CORE')) {
define( 'WP_AUTO_UPDATE_CORE', false );
}
remove_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );

// Remove WordPress core update nag
add_action('admin_menu','_pantheon_hide_update_nag');
// Remove the default WordPress core update nag if on Pantheon
if( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ){
add_action('admin_menu','_pantheon_hide_update_nag');
}

function _pantheon_hide_update_nag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
Expand Down Expand Up @@ -55,15 +58,27 @@ function _pantheon_upstream_update_notice() {
<?php
}

// Register our admin notice
// Register Pantheon specific WordPress update admin notice
add_action( 'admin_init', '_pantheon_register_upstream_update_notice' );
function _pantheon_register_upstream_update_notice(){
// but only if we are on Pantheon and there is a WordPress update available
if( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) && _pantheon_wordpress_update_available() ){
add_action( 'admin_notices', '_pantheon_upstream_update_notice' );
}
}

// Only in Test and Live Environments...
// Return zero updates and current time as last checked time
function _pantheon_disable_wp_updates() {
include ABSPATH . WPINC . '/version.php';
return (object) array(
'updates' => array(),
'version_checked' => $wp_version,
'last_checked' => time(),
);
}

// In the Test and Live environments, clear plugin/theme update notifications.
// Users must check a dev or multidev environment for updates.
if ( in_array( $_ENV['PANTHEON_ENVIRONMENT'], Array('test', 'live') ) ) {

// Disable Plugin Updates
Expand Down

0 comments on commit 771b52e

Please sign in to comment.