Upgrade: Force disable the rest-api plugin on upgrade to 4.4 unless it's beta5+. Previous versions of the plugin were not configured correctly to gradefully degrade during update which would cause fatal errors.

Props wonderboymusic.
Fixes #34415


git-svn-id: https://develop.svn.wordpress.org/trunk@35582 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-11-09 01:21:29 +00:00
parent c5e342b9f9
commit 94ed2c31ba
1 changed files with 14 additions and 0 deletions

View File

@ -728,6 +728,7 @@ $_new_bundled_files = array(
'themes/twentythirteen/' => '3.6',
'themes/twentyfourteen/' => '3.8',
'themes/twentyfifteen/' => '4.1',
'themes/twentysixteen/' => '4.4',
);
/**
@ -1072,6 +1073,9 @@ function update_core($from, $to) {
// Remove any Genericons example.html's from the filesystem
_upgrade_422_remove_genericons();
// Remove the REST API plugin if its version is Beta 4 or lower
_upgrade_440_force_deactivate_incompatible_plugins();
// Upgrade DB with separate request
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Upgrading database…' ) );
@ -1286,3 +1290,13 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
return $files;
}
/**
* @ignore
* @since 4.4.0
*/
function _upgrade_440_force_deactivate_incompatible_plugins() {
if ( defined( 'REST_API_VERSION' ) && version_compare( REST_API_VERSION, '2.0-beta4', '<=' ) ) {
deactivate_plugins( array( 'rest-api/plugin.php' ), true );
}
}