From 94ed2c31ba7ab1be23a3c154695f82e57c2940b9 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 9 Nov 2015 01:21:29 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/update-core.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index ac1ac37645..1fe98d24d6 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -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 ); + } +}