Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#34415 closed enhancement (fixed)

Force disable WP-API 2.0-beta4 and below

Reported by: danielbachhuber's profile danielbachhuber Owned by: dd32's profile dd32
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch
Focuses: Cc:

Description

Because WP-API 2.0-beta4 and below versions aren't compatible with WP 4.4, we need to force disable these versions of the plugin on upgrade.

Slack conversation: https://wordpress.slack.com/archives/core-restapi/p1445529134000413

Attachments (2)

34415-wp_get_active_and_valid_plugins.diff (880 bytes) - added by swissspidy 9 years ago.
34415.diff (978 bytes) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @swissspidy
9 years ago

Theoretically, deactivating the plugin would be as simple as this (inside upgrade_440()):

<?php
if ( defined( 'REST_API_VERSION' ) && version_compare( REST_API_VERSION, '2.0-beta4', '<=' ) ) {
        deactivate_plugins( array( 'rest-api/plugin.php' ), true );
}

However, I just installed a previous beta on a local 4.3 site, updated it to trunk and immediately got a fatal error.

Deactivation needs to happen earlier, e.g. in wp_get_active_and_valid_plugins(), as can be seen in the attached proof-of-concept. I don't really like that method though.

#2 @dd32
9 years ago

The deactivation will need to occur within wp-admin/includes/update-core.php, see this blog post of mine for a way of testing those changes.

Reasoning: That file is included into the current state of WordPress which then updates it to the new files.

@wonderboymusic
9 years ago

#3 @wonderboymusic
9 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner set to dd32
  • Status changed from new to assigned

34415.diff gets the ball rolling on update-core.php

#4 @dd32
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 35582:

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

#5 @dd32
9 years ago

I tested the patch and it works as expected on upgrading from a version without the rest-api.

Others can test this by upgrading from 4.3.1 to the latest 4.4 nightly with rest api 2.0-beta4 installed & beta tester plugin installed (nightly has been refreshed to include this change)

Note: See TracTickets for help on using tickets.