Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -94,7 +94,6 @@ class WPSEO_Post_Type_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
*/
|
||||
public function get_index_links( $max_entries ) {
|
||||
global $wpdb;
|
||||
|
||||
$post_types = WPSEO_Post_Type::get_accessible_post_types();
|
||||
$post_types = array_filter( $post_types, [ $this, 'is_valid_post_type' ] );
|
||||
$last_modified_times = WPSEO_Sitemaps::get_last_modified_gmt( $post_types, true );
|
||||
@@ -118,7 +117,19 @@ class WPSEO_Post_Type_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
if ( $max_pages > 1 ) {
|
||||
$post_statuses = array_map( 'esc_sql', WPSEO_Sitemaps::get_post_statuses( $post_type ) );
|
||||
|
||||
$sql = "
|
||||
if ( version_compare( $wpdb->db_version(), '8.0', '>=' ) ) {
|
||||
$sql = "
|
||||
WITH ordering AS (SELECT ROW_NUMBER() OVER (ORDER BY post_modified_gmt) AS n, post_modified_gmt
|
||||
FROM {$wpdb->posts} USE INDEX ( type_status_date )
|
||||
WHERE post_status IN ('" . implode( "','", $post_statuses ) . "')
|
||||
AND post_type = %s
|
||||
ORDER BY post_modified_gmt)
|
||||
SELECT post_modified_gmt
|
||||
FROM ordering
|
||||
WHERE MOD(n, %d) = 0;";
|
||||
}
|
||||
else {
|
||||
$sql = "
|
||||
SELECT post_modified_gmt
|
||||
FROM ( SELECT @rownum:=0 ) init
|
||||
JOIN {$wpdb->posts} USE INDEX( type_status_date )
|
||||
@@ -127,6 +138,7 @@ class WPSEO_Post_Type_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
AND ( @rownum:=@rownum+1 ) %% %d = 0
|
||||
ORDER BY post_modified_gmt ASC
|
||||
";
|
||||
}
|
||||
|
||||
$all_dates = $wpdb->get_col( $wpdb->prepare( $sql, $post_type, $max_entries ) );
|
||||
}
|
||||
@@ -163,9 +175,8 @@ class WPSEO_Post_Type_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
* @param int $max_entries Entries per sitemap.
|
||||
* @param int $current_page Current page of the sitemap.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws OutOfBoundsException When an invalid page is requested.
|
||||
* @return array
|
||||
*/
|
||||
public function get_sitemap_links( $type, $max_entries, $current_page ) {
|
||||
|
||||
@@ -421,7 +432,7 @@ class WPSEO_Post_Type_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
/**
|
||||
* Filters the first post type links.
|
||||
*
|
||||
* @param array $links The first post type links.
|
||||
* @param array $links The first post type links.
|
||||
* @param string $post_type The post type this archive is for.
|
||||
*/
|
||||
return apply_filters( 'wpseo_sitemap_post_type_first_links', $links, $post_type );
|
||||
|
||||
@@ -540,26 +540,6 @@ class WPSEO_Sitemaps {
|
||||
return YoastSEO()->helpers->date->format( self::get_last_modified_gmt( $post_types ) );
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Argument is kept for documentation purposes.
|
||||
|
||||
/**
|
||||
* Notify search engines of the updated sitemap.
|
||||
*
|
||||
* @deprecated 19.2
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string|null $url Optional URL to make the ping for.
|
||||
*/
|
||||
public static function ping_search_engines( $url = null ) {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO 19.2', 'WPSEO_Sitemaps_Admin::ping_search_engines' );
|
||||
|
||||
$admin = new WPSEO_Sitemaps_Admin();
|
||||
$admin->ping_search_engines();
|
||||
}
|
||||
|
||||
// phpcs:enable
|
||||
|
||||
/**
|
||||
* Get the maximum number of entries per XML sitemap.
|
||||
*
|
||||
|
||||
@@ -287,7 +287,7 @@ class WPSEO_Taxonomy_Sitemap_Provider implements WPSEO_Sitemap_Provider {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( in_array( $taxonomy_name, [ 'link_category', 'nav_menu' ], true ) ) {
|
||||
if ( in_array( $taxonomy_name, [ 'link_category', 'nav_menu', 'wp_pattern_category' ], true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user