You appear to be a bot. Output may be restricted
Description
Build the next sitemap index of a given type and update the state.
Usage
Jetpack_Sitemap_Builder::build_next_sitemap_index_of_type( $index_type, $next_type, $state );
Parameters
- $index_type
- ( string ) required – The type of index being generated.
- $next_type
- ( string ) required – The next type to generate after this one.
- $state
- ( array ) required – A sitemap state.
Returns
void
Source
File name: jetpack/modules/sitemaps/sitemap-builder.php
Lines:
1 to 94 of 94
private function build_next_sitemap_index_of_type( $index_type, $next_type, $state ) { $sitemap_type = jp_sitemap_child_type_of( $index_type ); // If only 0 or 1 sitemaps were built, advance to the next type and return. if ( 1 >= $state['max'][ $sitemap_type ]['number'] ) { Jetpack_Sitemap_State::check_in( array( 'sitemap-type' => $next_type, 'last-added' => 0, 'number' => 0, 'last-modified' => '1970-01-01 00:00:00', ) ); if ( $this->logger ) { $this->logger->report( "-- Cleaning Up $index_type" ); } // There are no indices of this type. $this->librarian->delete_numbered_sitemap_rows_after( 0, $index_type ); return; } // Otherwise, try to build a sitemap index. $result = $this->build_one_sitemap_index( $state['number'] + 1, $state['last-added'], $state['last-modified'], $index_type ); // If no index was built, advance to the next type and return. if ( false === $result ) { Jetpack_Sitemap_State::check_in( array( 'sitemap-type' => $next_type, 'last-added' => 0, 'number' => 0, 'last-modified' => '1970-01-01 00:00:00', ) ); if ( $this->logger ) { $this->logger->report( "-- Cleaning Up $index_type" ); } // Clean up old files. $this->librarian->delete_numbered_sitemap_rows_after( $state['number'], $index_type ); return; } // Otherwise, check in the state. Jetpack_Sitemap_State::check_in( array( 'sitemap-type' => $index_type, 'last-added' => $result['last_id'], 'number' => $state['number'] + 1, 'last-modified' => $result['last_modified'], ) ); // If there are still sitemaps left to index, return. if ( true === $result['any_left'] ) { return; } // Otherwise, advance to the next type. Jetpack_Sitemap_State::check_in( array( 'sitemap-type' => $next_type, 'last-added' => 0, 'number' => 0, 'last-modified' => '1970-01-01 00:00:00', ) ); if ( $this->logger ) { $this->logger->report( "-- Cleaning Up $index_type" ); } // We're done generating indices of this type. $this->librarian->delete_numbered_sitemap_rows_after( $state['number'] + 1, $index_type ); }