Make WordPress Core


Ignore:
Timestamp:
07/21/2020 03:27:48 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Sitemaps: Rename 'sitemap' to 'provider' in WP_Sitemaps_Registry class.

This class is for registering sitemap providers, not individual sitemaps.

Props swissspidy.
Fixes #50724.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/sitemaps/sitemaps-index.php

    r48532 r48536  
    1414         * Hence, 3*4*2=24.
    1515         */
    16         $registry->add_sitemap( 'foo', new WP_Sitemaps_Test_Provider( 'foo' ) );
    17         $registry->add_sitemap( 'bar', new WP_Sitemaps_Test_Provider( 'bar' ) );
     16        $registry->add_provider( 'foo', new WP_Sitemaps_Test_Provider( 'foo' ) );
     17        $registry->add_provider( 'bar', new WP_Sitemaps_Test_Provider( 'bar' ) );
    1818
    1919        $sitemap_index = new WP_Sitemaps_Index( $registry );
     
    3030
    3131        // add 3 providers, which combined produce more than the maximum 50000 sitemaps in the index.
    32         $registry->add_sitemap( 'provider_1', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
    33         $registry->add_sitemap( 'provider_2', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
    34         $registry->add_sitemap( 'provider_3', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
     32        $registry->add_provider( 'provider_1', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
     33        $registry->add_provider( 'provider_2', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
     34        $registry->add_provider( 'provider_3', new WP_Sitemaps_Large_Test_Provider( 25000 ) );
    3535
    3636        $count = 0;
    37         foreach ( $registry->get_sitemaps() as $provider ) {
     37        foreach ( $registry->get_providers() as $provider ) {
    3838            $count += count( $provider->get_url_list( 1 ) );
    3939        }
     
    4747        $registry = new WP_Sitemaps_Registry();
    4848
    49         $registry->add_sitemap( 'foo', new WP_Sitemaps_Empty_Test_Provider( 'foo' ) );
     49        $registry->add_provider( 'foo', new WP_Sitemaps_Empty_Test_Provider( 'foo' ) );
    5050
    5151        $sitemap_index = new WP_Sitemaps_Index( $registry );
Note: See TracChangeset for help on using the changeset viewer.