Making WordPress.org


Ignore:
Timestamp:
08/28/2020 05:36:38 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Add an initial run at Release Confirmation for plugins.

This is currently only enabled for plugin review members, as it needs some testing in production prior to being available to others.

Notably, this requires that a plugin be using tagged releases, it doesn't handle trunk releases (yet), that will be added next.

See: #5352

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r10211 r10214  
    787787
    788788        /**
    789          * Generates a link to self-transfer a plugin..
     789         * Generates a link to self-transfer a plugin.
    790790         *
    791791         * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     
    798798                        array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ),
    799799                        home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/self-transfer' )
     800                );
     801        }
     802
     803        /**
     804         * Generates a link to enable Release Confirmations.
     805         *
     806         * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     807         * @return string URL to enable confirmations.
     808         */
     809        public static function get_enable_release_confirmation_link( $post = null ) {
     810                $post = get_post( $post );
     811
     812                return add_query_arg(
     813                        array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ),
     814                        home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/release-confirmation' )
     815                );
     816        }
     817
     818        /**
     819         * Generates a link to confirm a release.
     820         *
     821         * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     822         * @return string URL to enable confirmations.
     823         */
     824        public static function get_release_confirmation_link( $tag, $post = null) {
     825                $post = get_post( $post );
     826
     827                return add_query_arg(
     828                        array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ),
     829                        home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/release-confirmation/' . $tag )
     830                );
     831        }
     832
     833        /**
     834         * Generates a link to email the release confirmation link.
     835         *
     836         * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     837         * @return string URL to enable confirmations.
     838         */
     839        public static function get_release_confirmation_access_link() {
     840                return add_query_arg(
     841                        array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ),
     842                        home_url( 'wp-json/plugins/v1/release-confirmation-access' )
    800843                );
    801844        }
Note: See TracChangeset for help on using the changeset viewer.