Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/sitemaps
File: sitemap-builder.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* Build the sitemap tree.
[2] Fix | Delete
*
[3] Fix | Delete
* @package automattic/jetpack
[4] Fix | Delete
* @since 4.8.0
[5] Fix | Delete
* @author Automattic
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[9] Fix | Delete
exit( 0 );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
/* Include sitemap subclasses, if not already, and include proper buffer based on phpxml's availability. */
[13] Fix | Delete
require_once __DIR__ . '/sitemap-constants.php';
[14] Fix | Delete
require_once __DIR__ . '/sitemap-buffer.php';
[15] Fix | Delete
[16] Fix | Delete
if ( ! class_exists( 'DOMDocument' ) ) {
[17] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-fallback.php';
[18] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-image-fallback.php';
[19] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-master-fallback.php';
[20] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-news-fallback.php';
[21] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-page-fallback.php';
[22] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-video-fallback.php';
[23] Fix | Delete
} else {
[24] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-image.php';
[25] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-master.php';
[26] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-news.php';
[27] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-page.php';
[28] Fix | Delete
require_once __DIR__ . '/sitemap-buffer-video.php';
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
require_once __DIR__ . '/sitemap-librarian.php';
[32] Fix | Delete
require_once __DIR__ . '/sitemap-finder.php';
[33] Fix | Delete
require_once __DIR__ . '/sitemap-state.php';
[34] Fix | Delete
[35] Fix | Delete
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
[36] Fix | Delete
require_once __DIR__ . '/sitemap-logger.php';
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Simple class for rendering an empty sitemap with a short TTL
[41] Fix | Delete
*/
[42] Fix | Delete
class Jetpack_Sitemap_Buffer_Empty extends Jetpack_Sitemap_Buffer {
[43] Fix | Delete
/**
[44] Fix | Delete
* Jetpack_Sitemap_Buffer_Empty constructor.
[45] Fix | Delete
*/
[46] Fix | Delete
public function __construct() {
[47] Fix | Delete
parent::__construct( JP_SITEMAP_MAX_ITEMS, JP_SITEMAP_MAX_BYTES, '1970-01-01 00:00:00' );
[48] Fix | Delete
[49] Fix | Delete
$this->doc->appendChild(
[50] Fix | Delete
$this->doc->createComment( "generator='jetpack-" . JETPACK__VERSION . "'" )
[51] Fix | Delete
);
[52] Fix | Delete
[53] Fix | Delete
$this->doc->appendChild(
[54] Fix | Delete
$this->doc->createComment( 'Jetpack_Sitemap_Buffer_Empty' )
[55] Fix | Delete
);
[56] Fix | Delete
[57] Fix | Delete
$this->doc->appendChild(
[58] Fix | Delete
$this->doc->createProcessingInstruction(
[59] Fix | Delete
'xml-stylesheet',
[60] Fix | Delete
'type="text/xsl" href="' . $this->finder->construct_sitemap_url( 'sitemap-index.xsl' ) . '"'
[61] Fix | Delete
)
[62] Fix | Delete
);
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Returns a DOM element for an empty sitemap.
[67] Fix | Delete
*/
[68] Fix | Delete
protected function get_root_element() {
[69] Fix | Delete
if ( ! isset( $this->root ) ) {
[70] Fix | Delete
$this->root = $this->doc->createElement( 'sitemapindex' );
[71] Fix | Delete
$this->root->setAttribute( 'xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9' );
[72] Fix | Delete
$this->doc->appendChild( $this->root );
[73] Fix | Delete
$this->byte_capacity -= strlen( $this->doc->saveXML( $this->root ) );
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
return $this->root;
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* The Jetpack_Sitemap_Builder object handles the construction of
[82] Fix | Delete
* all sitemap files (except the XSL files, which are handled by
[83] Fix | Delete
* Jetpack_Sitemap_Stylist.) Other than the constructor, there are
[84] Fix | Delete
* only two public functions: build_all_sitemaps and news_sitemap_xml.
[85] Fix | Delete
*
[86] Fix | Delete
* @since 4.8.0
[87] Fix | Delete
*/
[88] Fix | Delete
class Jetpack_Sitemap_Builder { // phpcs:ignore Generic.Files.OneObjectStructurePerFile.MultipleFound,Generic.Classes.OpeningBraceSameLine.ContentAfterBrace
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Librarian object for storing and retrieving sitemap data.
[92] Fix | Delete
*
[93] Fix | Delete
* @access private
[94] Fix | Delete
* @since 4.8.0
[95] Fix | Delete
* @var $librarian Jetpack_Sitemap_Librarian
[96] Fix | Delete
*/
[97] Fix | Delete
private $librarian;
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Logger object for reporting debug messages.
[101] Fix | Delete
*
[102] Fix | Delete
* @access private
[103] Fix | Delete
* @since 4.8.0
[104] Fix | Delete
* @var $logger Jetpack_Sitemap_Logger
[105] Fix | Delete
*/
[106] Fix | Delete
private $logger = false;
[107] Fix | Delete
[108] Fix | Delete
/**
[109] Fix | Delete
* Finder object for dealing with sitemap URIs.
[110] Fix | Delete
*
[111] Fix | Delete
* @access private
[112] Fix | Delete
* @since 4.8.0
[113] Fix | Delete
* @var $finder Jetpack_Sitemap_Finder
[114] Fix | Delete
*/
[115] Fix | Delete
private $finder;
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Construct a new Jetpack_Sitemap_Builder object.
[119] Fix | Delete
*
[120] Fix | Delete
* @access public
[121] Fix | Delete
* @since 4.8.0
[122] Fix | Delete
*/
[123] Fix | Delete
public function __construct() {
[124] Fix | Delete
$this->librarian = new Jetpack_Sitemap_Librarian();
[125] Fix | Delete
$this->finder = new Jetpack_Sitemap_Finder();
[126] Fix | Delete
[127] Fix | Delete
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
[128] Fix | Delete
$this->logger = new Jetpack_Sitemap_Logger();
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
update_option(
[132] Fix | Delete
'jetpack_sitemap_post_types',
[133] Fix | Delete
/**
[134] Fix | Delete
* The array of post types to be included in the sitemap.
[135] Fix | Delete
*
[136] Fix | Delete
* Add your custom post type name to the array to have posts of
[137] Fix | Delete
* that type included in the sitemap. The default array includes
[138] Fix | Delete
* 'page' and 'post'.
[139] Fix | Delete
*
[140] Fix | Delete
* The result of this filter is cached in an option, 'jetpack_sitemap_post_types',
[141] Fix | Delete
* so this filter only has to be applied once per generation.
[142] Fix | Delete
*
[143] Fix | Delete
* @since 4.8.0
[144] Fix | Delete
*/
[145] Fix | Delete
apply_filters(
[146] Fix | Delete
'jetpack_sitemap_post_types',
[147] Fix | Delete
array( 'post', 'page' )
[148] Fix | Delete
)
[149] Fix | Delete
);
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* Update the sitemap.
[154] Fix | Delete
*
[155] Fix | Delete
* All we do here is call build_next_sitemap_file a bunch of times.
[156] Fix | Delete
*
[157] Fix | Delete
* @since 4.8.0
[158] Fix | Delete
*/
[159] Fix | Delete
public function update_sitemap() {
[160] Fix | Delete
if ( $this->logger ) {
[161] Fix | Delete
$this->logger->report( '-- Updating...' );
[162] Fix | Delete
if ( ! class_exists( 'DOMDocument' ) ) {
[163] Fix | Delete
$this->logger->report(
[164] Fix | Delete
__(
[165] Fix | Delete
'Jetpack can not load necessary XML manipulation libraries. Please ask your hosting provider to refer to our server requirements at https://jetpack.com/support/server-requirements/ .',
[166] Fix | Delete
'jetpack'
[167] Fix | Delete
),
[168] Fix | Delete
true
[169] Fix | Delete
);
[170] Fix | Delete
}
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
/**
[174] Fix | Delete
* Filters whether to suspend cache addition for the entire sitemap generation.
[175] Fix | Delete
*
[176] Fix | Delete
* @since 15.0
[177] Fix | Delete
*
[178] Fix | Delete
* @param bool|null $suspend_addition Whether to suspend cache addition. Defaults to null.
[179] Fix | Delete
* @return bool|null Whether to suspend cache addition.
[180] Fix | Delete
*/
[181] Fix | Delete
$suspend_addition = apply_filters( 'jetpack_sitemap_suspend_cache_addition', null );
[182] Fix | Delete
[183] Fix | Delete
// Cache the previous state in case something else changed it.
[184] Fix | Delete
$prev_suspend_addition = wp_suspend_cache_addition();
[185] Fix | Delete
[186] Fix | Delete
wp_suspend_cache_addition( $suspend_addition );
[187] Fix | Delete
[188] Fix | Delete
for ( $i = 1; $i <= JP_SITEMAP_UPDATE_SIZE; $i++ ) {
[189] Fix | Delete
if ( true === $this->build_next_sitemap_file() ) {
[190] Fix | Delete
break; // All finished!
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
// Restore previous state.
[195] Fix | Delete
wp_suspend_cache_addition( $prev_suspend_addition );
[196] Fix | Delete
[197] Fix | Delete
if ( $this->logger ) {
[198] Fix | Delete
$this->logger->report( '-- ...done for now.' );
[199] Fix | Delete
$this->logger->time();
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
/**
[204] Fix | Delete
* Generate the next sitemap file.
[205] Fix | Delete
*
[206] Fix | Delete
* Reads the most recent state of the sitemap generation phase,
[207] Fix | Delete
* constructs the next file, and updates the state.
[208] Fix | Delete
*
[209] Fix | Delete
* @since 4.8.0
[210] Fix | Delete
*
[211] Fix | Delete
* @return bool True when finished.
[212] Fix | Delete
*/
[213] Fix | Delete
private function build_next_sitemap_file() {
[214] Fix | Delete
$finished = false; // Initialize finished flag.
[215] Fix | Delete
[216] Fix | Delete
// Get the most recent state, and lock the state.
[217] Fix | Delete
$state = Jetpack_Sitemap_State::check_out();
[218] Fix | Delete
[219] Fix | Delete
// Do nothing if the state was locked.
[220] Fix | Delete
if ( false === $state ) {
[221] Fix | Delete
return false;
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
// Otherwise, branch on the sitemap-type key of $state.
[225] Fix | Delete
switch ( $state['sitemap-type'] ) {
[226] Fix | Delete
case JP_PAGE_SITEMAP_TYPE:
[227] Fix | Delete
$this->build_next_sitemap_of_type(
[228] Fix | Delete
JP_PAGE_SITEMAP_TYPE,
[229] Fix | Delete
array( $this, 'build_one_page_sitemap' ),
[230] Fix | Delete
$state
[231] Fix | Delete
);
[232] Fix | Delete
break;
[233] Fix | Delete
[234] Fix | Delete
case JP_PAGE_SITEMAP_INDEX_TYPE:
[235] Fix | Delete
$this->build_next_sitemap_index_of_type(
[236] Fix | Delete
JP_PAGE_SITEMAP_INDEX_TYPE,
[237] Fix | Delete
JP_IMAGE_SITEMAP_TYPE,
[238] Fix | Delete
$state
[239] Fix | Delete
);
[240] Fix | Delete
break;
[241] Fix | Delete
[242] Fix | Delete
case JP_IMAGE_SITEMAP_TYPE:
[243] Fix | Delete
$this->build_next_sitemap_of_type(
[244] Fix | Delete
JP_IMAGE_SITEMAP_TYPE,
[245] Fix | Delete
array( $this, 'build_one_image_sitemap' ),
[246] Fix | Delete
$state
[247] Fix | Delete
);
[248] Fix | Delete
break;
[249] Fix | Delete
[250] Fix | Delete
case JP_IMAGE_SITEMAP_INDEX_TYPE:
[251] Fix | Delete
$this->build_next_sitemap_index_of_type(
[252] Fix | Delete
JP_IMAGE_SITEMAP_INDEX_TYPE,
[253] Fix | Delete
JP_VIDEO_SITEMAP_TYPE,
[254] Fix | Delete
$state
[255] Fix | Delete
);
[256] Fix | Delete
break;
[257] Fix | Delete
[258] Fix | Delete
case JP_VIDEO_SITEMAP_TYPE:
[259] Fix | Delete
$this->build_next_sitemap_of_type(
[260] Fix | Delete
JP_VIDEO_SITEMAP_TYPE,
[261] Fix | Delete
array( $this, 'build_one_video_sitemap' ),
[262] Fix | Delete
$state
[263] Fix | Delete
);
[264] Fix | Delete
break;
[265] Fix | Delete
[266] Fix | Delete
case JP_VIDEO_SITEMAP_INDEX_TYPE:
[267] Fix | Delete
$this->build_next_sitemap_index_of_type(
[268] Fix | Delete
JP_VIDEO_SITEMAP_INDEX_TYPE,
[269] Fix | Delete
JP_MASTER_SITEMAP_TYPE,
[270] Fix | Delete
$state
[271] Fix | Delete
);
[272] Fix | Delete
break;
[273] Fix | Delete
[274] Fix | Delete
case JP_MASTER_SITEMAP_TYPE:
[275] Fix | Delete
$this->build_master_sitemap( $state['max'] );
[276] Fix | Delete
[277] Fix | Delete
// Reset the state and quit.
[278] Fix | Delete
Jetpack_Sitemap_State::reset(
[279] Fix | Delete
JP_PAGE_SITEMAP_TYPE
[280] Fix | Delete
);
[281] Fix | Delete
[282] Fix | Delete
if ( $this->logger ) {
[283] Fix | Delete
$this->logger->report( '-- Finished.' );
[284] Fix | Delete
$this->logger->time();
[285] Fix | Delete
}
[286] Fix | Delete
$finished = true;
[287] Fix | Delete
[288] Fix | Delete
break;
[289] Fix | Delete
[290] Fix | Delete
default:
[291] Fix | Delete
Jetpack_Sitemap_State::reset(
[292] Fix | Delete
JP_PAGE_SITEMAP_TYPE
[293] Fix | Delete
);
[294] Fix | Delete
$finished = true;
[295] Fix | Delete
[296] Fix | Delete
break;
[297] Fix | Delete
} // End switch.
[298] Fix | Delete
[299] Fix | Delete
// Unlock the state.
[300] Fix | Delete
Jetpack_Sitemap_State::unlock();
[301] Fix | Delete
[302] Fix | Delete
return $finished;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
/**
[306] Fix | Delete
* Build the next sitemap of a given type and update the sitemap state.
[307] Fix | Delete
*
[308] Fix | Delete
* @since 4.8.0
[309] Fix | Delete
*
[310] Fix | Delete
* @param string $sitemap_type The type of the sitemap being generated.
[311] Fix | Delete
* @param callback $build_one A callback which builds a single sitemap file.
[312] Fix | Delete
* @param array $state A sitemap state.
[313] Fix | Delete
*/
[314] Fix | Delete
private function build_next_sitemap_of_type( $sitemap_type, $build_one, $state ) {
[315] Fix | Delete
$index_type = jp_sitemap_index_type_of( $sitemap_type );
[316] Fix | Delete
[317] Fix | Delete
// Try to build a sitemap.
[318] Fix | Delete
$result = call_user_func_array(
[319] Fix | Delete
$build_one,
[320] Fix | Delete
array(
[321] Fix | Delete
$state['number'] + 1,
[322] Fix | Delete
$state['last-added'],
[323] Fix | Delete
)
[324] Fix | Delete
);
[325] Fix | Delete
[326] Fix | Delete
if ( false === $result ) {
[327] Fix | Delete
// If no sitemap was generated, advance to the next type.
[328] Fix | Delete
Jetpack_Sitemap_State::check_in(
[329] Fix | Delete
array(
[330] Fix | Delete
'sitemap-type' => $index_type,
[331] Fix | Delete
'last-added' => 0,
[332] Fix | Delete
'number' => 0,
[333] Fix | Delete
'last-modified' => '1970-01-01 00:00:00',
[334] Fix | Delete
)
[335] Fix | Delete
);
[336] Fix | Delete
[337] Fix | Delete
if ( $this->logger ) {
[338] Fix | Delete
$this->logger->report( "-- Cleaning Up $sitemap_type" );
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
// Clean up old files.
[342] Fix | Delete
$this->librarian->delete_numbered_sitemap_rows_after(
[343] Fix | Delete
$state['number'],
[344] Fix | Delete
$sitemap_type
[345] Fix | Delete
);
[346] Fix | Delete
[347] Fix | Delete
return;
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
// Otherwise, update the state.
[351] Fix | Delete
Jetpack_Sitemap_State::check_in(
[352] Fix | Delete
array(
[353] Fix | Delete
'sitemap-type' => $state['sitemap-type'],
[354] Fix | Delete
'last-added' => $result['last_id'],
[355] Fix | Delete
'number' => $state['number'] + 1,
[356] Fix | Delete
'last-modified' => $result['last_modified'],
[357] Fix | Delete
)
[358] Fix | Delete
);
[359] Fix | Delete
[360] Fix | Delete
if ( true === $result['any_left'] ) {
[361] Fix | Delete
// If there's more work to be done with this type, return.
[362] Fix | Delete
return;
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
// Otherwise, advance state to the next sitemap type.
[366] Fix | Delete
Jetpack_Sitemap_State::check_in(
[367] Fix | Delete
array(
[368] Fix | Delete
'sitemap-type' => $index_type,
[369] Fix | Delete
'last-added' => 0,
[370] Fix | Delete
'number' => 0,
[371] Fix | Delete
'last-modified' => '1970-01-01 00:00:00',
[372] Fix | Delete
)
[373] Fix | Delete
);
[374] Fix | Delete
[375] Fix | Delete
if ( $this->logger ) {
[376] Fix | Delete
$this->logger->report( "-- Cleaning Up $sitemap_type" );
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
// Clean up old files.
[380] Fix | Delete
$this->librarian->delete_numbered_sitemap_rows_after(
[381] Fix | Delete
$state['number'] + 1,
[382] Fix | Delete
$sitemap_type
[383] Fix | Delete
);
[384] Fix | Delete
}
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* Build the next sitemap index of a given type and update the state.
[388] Fix | Delete
*
[389] Fix | Delete
* @since 4.8.0
[390] Fix | Delete
*
[391] Fix | Delete
* @param string $index_type The type of index being generated.
[392] Fix | Delete
* @param string $next_type The next type to generate after this one.
[393] Fix | Delete
* @param array $state A sitemap state.
[394] Fix | Delete
*/
[395] Fix | Delete
private function build_next_sitemap_index_of_type( $index_type, $next_type, $state ) {
[396] Fix | Delete
$sitemap_type = jp_sitemap_child_type_of( $index_type );
[397] Fix | Delete
[398] Fix | Delete
$sitemap_type_exists = isset( $state['max'][ $sitemap_type ] ) && is_array( $state['max'][ $sitemap_type ] );
[399] Fix | Delete
[400] Fix | Delete
// If only 0 or 1 sitemaps were built, advance to the next type and return.
[401] Fix | Delete
if ( $sitemap_type_exists && 1 >= $state['max'][ $sitemap_type ]['number'] ) {
[402] Fix | Delete
Jetpack_Sitemap_State::check_in(
[403] Fix | Delete
array(
[404] Fix | Delete
'sitemap-type' => $next_type,
[405] Fix | Delete
'last-added' => 0,
[406] Fix | Delete
'number' => 0,
[407] Fix | Delete
'last-modified' => '1970-01-01 00:00:00',
[408] Fix | Delete
)
[409] Fix | Delete
);
[410] Fix | Delete
[411] Fix | Delete
if ( $this->logger ) {
[412] Fix | Delete
$this->logger->report( "-- Cleaning Up $index_type" );
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
// There are no indices of this type.
[416] Fix | Delete
$this->librarian->delete_numbered_sitemap_rows_after(
[417] Fix | Delete
0,
[418] Fix | Delete
$index_type
[419] Fix | Delete
);
[420] Fix | Delete
[421] Fix | Delete
return;
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
// Otherwise, try to build a sitemap index.
[425] Fix | Delete
$result = $this->build_one_sitemap_index(
[426] Fix | Delete
$state['number'] + 1,
[427] Fix | Delete
$state['last-added'],
[428] Fix | Delete
$state['last-modified'],
[429] Fix | Delete
$index_type
[430] Fix | Delete
);
[431] Fix | Delete
[432] Fix | Delete
// If no index was built, advance to the next type and return.
[433] Fix | Delete
if ( false === $result ) {
[434] Fix | Delete
Jetpack_Sitemap_State::check_in(
[435] Fix | Delete
array(
[436] Fix | Delete
'sitemap-type' => $next_type,
[437] Fix | Delete
'last-added' => 0,
[438] Fix | Delete
'number' => 0,
[439] Fix | Delete
'last-modified' => '1970-01-01 00:00:00',
[440] Fix | Delete
)
[441] Fix | Delete
);
[442] Fix | Delete
[443] Fix | Delete
if ( $this->logger ) {
[444] Fix | Delete
$this->logger->report( "-- Cleaning Up $index_type" );
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
// Clean up old files.
[448] Fix | Delete
$this->librarian->delete_numbered_sitemap_rows_after(
[449] Fix | Delete
$state['number'],
[450] Fix | Delete
$index_type
[451] Fix | Delete
);
[452] Fix | Delete
[453] Fix | Delete
return;
[454] Fix | Delete
}
[455] Fix | Delete
[456] Fix | Delete
// Otherwise, check in the state.
[457] Fix | Delete
Jetpack_Sitemap_State::check_in(
[458] Fix | Delete
array(
[459] Fix | Delete
'sitemap-type' => $index_type,
[460] Fix | Delete
'last-added' => $result['last_id'],
[461] Fix | Delete
'number' => $state['number'] + 1,
[462] Fix | Delete
'last-modified' => $result['last_modified'],
[463] Fix | Delete
)
[464] Fix | Delete
);
[465] Fix | Delete
[466] Fix | Delete
// If there are still sitemaps left to index, return.
[467] Fix | Delete
if ( true === $result['any_left'] ) {
[468] Fix | Delete
return;
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
// Otherwise, advance to the next type.
[472] Fix | Delete
Jetpack_Sitemap_State::check_in(
[473] Fix | Delete
array(
[474] Fix | Delete
'sitemap-type' => $next_type,
[475] Fix | Delete
'last-added' => 0,
[476] Fix | Delete
'number' => 0,
[477] Fix | Delete
'last-modified' => '1970-01-01 00:00:00',
[478] Fix | Delete
)
[479] Fix | Delete
);
[480] Fix | Delete
[481] Fix | Delete
if ( $this->logger ) {
[482] Fix | Delete
$this->logger->report( "-- Cleaning Up $index_type" );
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
// We're done generating indices of this type.
[486] Fix | Delete
$this->librarian->delete_numbered_sitemap_rows_after(
[487] Fix | Delete
$state['number'] + 1,
[488] Fix | Delete
$index_type
[489] Fix | Delete
);
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
/**
[493] Fix | Delete
* Builds the master sitemap index.
[494] Fix | Delete
*
[495] Fix | Delete
* @param array $max Array of sitemap types with max index and datetime.
[496] Fix | Delete
*
[497] Fix | Delete
* @since 4.8.0
[498] Fix | Delete
*/
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function