Plugins: Store releases as CPT records#675
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR migrates the Plugin Directory “releases” storage layer from a single releases postmeta array to a private plugin_release custom post type (CPT), while preserving the legacy release array contract consumed by existing cooldown/ZIP/confirmation code paths.
Changes:
- Introduces a headless
Plugin_Releasestorage/compatibility layer backed by a privateplugin_releaseCPT, with lazy backfill from legacyreleasespostmeta and (fallback)tags/SVN metadata. - Replaces
Plugin_Directory::get_release(s),add_release(), andremove_release()to delegate to the new CPT-backed implementation. - Adds PHPUnit coverage for CPT writes, lazy backfill, merge/update semantics, unconfirmed deletion rules, and the
trunk@versionfallback.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php |
Switches the public legacy release APIs to delegate to the new CPT-backed layer and initializes release support. |
wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-release.php |
Adds the CPT storage + legacy compatibility implementation, including lazy migration/backfill logic. |
wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/Plugin_Release_Test.php |
Adds focused tests covering CPT persistence, backfill behavior, updates/merges, deletion rules, and trunk fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public function get_release( $plugin, $tag ) { | ||
| $releases = $this->get_releases( $plugin ); | ||
|
|
||
| $filtered = wp_list_filter( $releases, compact( 'tag' ) ); | ||
| if ( $filtered ) { | ||
| return array_shift( $filtered ); | ||
| } | ||
|
|
||
| $filtered = wp_list_filter( | ||
| $releases, | ||
| array( | ||
| 'tag' => "trunk@{$tag}", | ||
| 'version' => $tag, | ||
| ) | ||
| ); | ||
| if ( $filtered ) { | ||
| return array_shift( $filtered ); | ||
| } | ||
|
|
||
| return false; | ||
| } |
Summary
plugin_releaseCPT from PR Add a release page #407 without the release-page UI/components.Plugin_Directory::get_release(s),add_release(), andremove_release()storage layer with CPT-backed records while preserving the legacy release array shape used by release confirmations, ZIP building, and cooldown code.releasespostmeta, thentagsmetadata/SVN as the existing polyfill path did, and mirrors PR Add a release page #407-style release meta for future UI work.trunk@versionlookup fallback.Testing
php -l wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.phpphp -l wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-release.phpphp -l wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/Plugin_Release_Test.php./vendor/bin/phpcs --standard=wordpress.org/public_html/wp-content/plugins/plugin-directory/phpcs.xml.dist wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-release.php wordpress.org/public_html/wp-content/plugins/plugin-directory/tests/Plugin_Release_Test.phpgit diff --checkTargeted PHPUnit was attempted with
WP_TESTS_DIR=/home/user/wordpress-develop/tests/phpunit ./vendor/bin/phpunit -c wordpress.org/public_html/wp-content/plugins/plugin-directory/phpunit.xml --filter Plugin_Release_Test, but local WordPress bootstrap fails because this PHP runtime has no MySQLi extension.Refs #664, #407.