Highlights
Adds a third ability to the Core tab introduced in 0.0.11: acrossai-abilities-manager/wp-core-rollback. Rolls back WordPress core to an earlier offered version via WP core's Core_Upgrader::upgrade() — the same class the built-in dashboard uses for forward updates.
Uses only WordPress functions. No bundled updater code, no custom download, no custom integrity verification. Inspired by Andy Fragen's core-rollback plugin (MIT-licensed) — read wp-content/plugins/core-rollback/src/Core.php for the underlying technique.
Key observation superseding Feature 042's out-of-scope statement: Core_Upgrader::upgrade($offer) does NOT inspect whether $offer->version is older or newer than currently-installed. Any well-formed offer works, either direction. WordPress core does not need a WP_Downgrader class — the existing Core_Upgrader handles rollback perfectly given the right offer object.
Ability details
- Input:
version(required, string) — target WordPress version.locale(optional, string) — defaults toget_locale(). - Output:
success,updated,from_version,to_version,message. - Requires: BOTH
manage_optionsANDupdate_core. HonoursDISALLOW_FILE_MODSviaFile_Mods_Guard. Multisite-guarded. - Refuses non-downgrade: if
version_compare($target, $current, '>='), returns a clean error steering the caller towp-core-update. NoCore_Upgraderinvocation happens on the wrong-direction path. - Data source: WP.org Core API 1.7 endpoint (
https://api.wordpress.org/core/version-check/1.7/) viawp_remote_get(). Hardcoded URL as a class constant (no SSRF surface). Per-locale offer list cached inacrossai_abilities_manager_core_offers_{locale}site transient withDAY_IN_SECONDSTTL. 15s HTTP timeout. Standard WordPressUser-Agentheader. WordPress 4.0 floor on cached offers. - Annotations:
destructive=true— rolling WordPress back is a real production operation, and MCP / UI clients should surface it accordingly.
First outbound HTTP request from the plugin
Historically the plugin has made zero outbound HTTP requests on its own; the Add-ons page delegates to the WordPress plugin installer's own contact with WordPress.org, and every other ability operates on the local site. wp-core-rollback introduces the plugin's first direct outbound request — to api.wordpress.org/core/version-check/1.7/. The URL is hardcoded, the request is bounded by a per-locale day-long transient cache (≤ 1 request / day / locale / site regardless of how often the ability is invoked), the HTTP timeout is 15 seconds, and only the sanitized locale is derived from user input.
No breaking changes
No changes to existing abilities, REST endpoints, capability requirements, or database schema. Safe upgrade.
Quality gates
- PHPStan L8 — zero errors
- PHPCS strict (WPCS) — zero errors
- PHPUnit — 163 tests / 531 assertions (up from 153 / 504 on 0.0.11; +10 tests / +27 assertions covering Feature 043)