Making WordPress.org

Changeset 12816


Ignore:
Timestamp:
08/08/2023 05:38:53 AM (14 months ago)
Author:
dd32
Message:

Plugin Directory: Release Confirmation: Don't display a version in the 'Previous Versions' download form if the version was never confirmed.

Fixes #5902.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
2 edited

Legend:

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

    r12508 r12816  
    15331533                foreach ( $tags as $tag_version => $tag ) {
    15341534                    self::add_release( $plugin, [
    1535                         'date' => strtotime( $tag['date'] ),
    1536                         'tag'  => $tag['tag'],
    1537                         'version' => $tag_version,
    1538                         'committer' => [ $tag['author'] ],
    1539                         'confirmations_required' => 0, // Old release, assume it's released.
     1535                        'date'                   => strtotime( $tag['date'] ),
     1536                        'tag'                    => $tag['tag'],
     1537                        'version'                => $tag_version,
     1538                        'committer'              => [ $tag['author'] ],
     1539                        'zips_built'             => true, // Old release, assume they were built.
     1540                        'confirmations_required' => 0,    // Old release, assume it's released.
    15401541                    ] );
    15411542                }
     
    15571558
    15581559                    self::add_release( $plugin, [
    1559                         'date' => strtotime( $entry['date'] ),
    1560                         'tag'  => $entry['filename'],
    1561                         'version' => $tag,
    1562                         'committer' => [ $entry['author'] ],
    1563                         'confirmations_required' => 0, // Old release, assume it's released.
     1560                        'date'                   => strtotime( $entry['date'] ),
     1561                        'tag'                    => $entry['filename'],
     1562                        'version'                => $tag,
     1563                        'committer'              => [ $entry['author'] ],
     1564                        'zips_built'             => true, // Old release, assume they were built.
     1565                        'confirmations_required' => 0,    // Old release, assume it's released.
    15641566                    ] );
    15651567                }
     
    15671569
    15681570            $releases = get_post_meta( $plugin->ID, 'releases', true ) ?: [];
     1571        }
     1572
     1573        /**
     1574         * If confirmations weren't required, claim that the ZIPs were built.
     1575         *
     1576         * This is needed for data pre-[12816].
     1577         * @see https://meta.trac.wordpress.org/changeset/12816
     1578         */
     1579        foreach ( $releases as &$release ) {
     1580            if ( ! $release['confirmations_required'] && ! $release['zips_built'] ) {
     1581                $release['zips_built'] = true;
     1582            }
    15691583        }
    15701584
     
    16001614            'tag'                    => '',
    16011615            'version'                => '',
    1602             'zips_built'             => false,
     1616            // Assume zips built if no release confirmation.
     1617            'zips_built'             => ! $plugin->release_confirmation,
    16031618            'confirmations'          => [],
    16041619            // Confirmed by default if no release confiration.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r12813 r12816  
    370370    echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
    371371    foreach ( $tags as $version ) {
    372         $text = ( 'trunk' === $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
    373         printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
     372        // Check the tag against the confirmed releases.
     373        $release = Plugin_Directory::get_release( $post, $version );
     374        if ( $release && ! $release['zips_built'] ) {
     375            continue;
     376        }
     377
     378        $text = $version;
     379        if ( 'trunk' === $version ) {
     380            $text = __( 'Development Version', 'wporg-plugins' );
     381        }
     382
     383        printf(
     384            '<option value="%s">%s</option>',
     385            esc_attr( Template::download_link( $post, $version ) ),
     386            esc_html( $text )
     387        );
    374388    }
    375389    echo '</select> ';
Note: See TracChangeset for help on using the changeset viewer.