Make WordPress Core

Changeset 60329


Ignore:
Timestamp:
06/19/2025 11:59:01 PM (9 months ago)
Author:
peterwilsoncc
Message:

Database: Reinstate test for MariaDB version in readme.

Updates the test to use the MariaDB REST API endpoint of supported versions. A version is considered EOL if it has passed the listed date or is not included in the API response.

Follow up to [60313].

Props desrosj, johnbillion, skithund.
Fixes #63586.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/readme.php

    r60313 r60329  
    6868        $this->skipOnAutomatedBranches();
    6969
    70         $this->markTestSkipped(
    71             'Temporarily disabled. MariaDB has changed the layout and verbiage of their release documentation pages.'
    72         );
    73 
    7470        $readme = file_get_contents( ABSPATH . 'readme.html' );
    7571
    7672        preg_match( '#Recommendations.*MariaDB</a> version <strong>([0-9.]*)#s', $readme, $matches );
    77         $matches[1] = str_replace( '.', '', $matches[1] );
    7873
    79         $response_body = $this->get_response_body( "https://mariadb.com/kb/en/release-notes-mariadb-{$matches[1]}-series/" );
     74        $response_body = $this->get_response_body( 'https://downloads.mariadb.org/rest-api/mariadb/' );
     75        $releases      = json_decode( $response_body, true );
    8076
    81         // Retrieve the date of the first stable release for the recommended branch.
    82         preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches );
     77        foreach ( $releases['major_releases'] as $release ) {
     78            if ( isset( $release['release_id'] ) && $release['release_id'] === $matches[1] ) {
     79                $mariadb_eol = $release['release_eol_date'];
     80            }
     81        }
    8382
    84         // Per https://mariadb.org/about/#maintenance-policy, MariaDB releases are supported for 5 years.
    85         $mariadb_eol  = gmdate( 'Y-m-d', strtotime( $mariadb_matches[1] . ' +5 years' ) );
     83        // If the release ID is not found the version is unsupported.
     84        if ( ! isset( $mariadb_eol ) ) {
     85            $this->fail( "{$matches[1]} is not included in MariaDB's list of supported versions. Remember to update the WordPress.org Requirements page, too." );
     86        }
     87
    8688        $current_date = gmdate( 'Y-m-d' );
    8789
Note: See TracChangeset for help on using the changeset viewer.