function xmlsitemap_get_chunk_size in XML sitemap 7.2
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_get_chunk_size()
- 6.2 xmlsitemap.module \xmlsitemap_get_chunk_size()
- 2.x xmlsitemap.module \xmlsitemap_get_chunk_size()
Get the sitemap chunk size.
This function is useful with the chunk size is set to automatic as it will calculate the appropriate value. Use this function instead of
xmlsitemap_var('chunk_size');
when the actual value is needed.
Parameters
bool $reset: A boolean to reset the saved, static result. Defaults to FALSE.
Return value
int An integer with the number of links in each sitemap page.
4 calls to xmlsitemap_get_chunk_size()
- xmlsitemap_generate_chunk in ./
xmlsitemap.generate.inc - Generate chunk.
- xmlsitemap_get_chunk_count in ./
xmlsitemap.module - Get the current number of sitemap chunks.
- xmlsitemap_requirements in ./
xmlsitemap.install - Implements hook_requirements().
- _xmlsitemap_get_optimal_memory_limit in ./
xmlsitemap.generate.inc - Calculate the optimal PHP memory limit for sitemap generation.
File
- ./
xmlsitemap.module, line 1339 - xmlsitemap XML sitemap
Code
function xmlsitemap_get_chunk_size($reset = FALSE) {
static $size;
if (!isset($size) || $reset) {
$size = xmlsitemap_var('chunk_size');
if ($size === 'auto') {
// Prevent divide by zero.
$count = max(xmlsitemap_get_link_count($reset), 1);
$size = min(ceil($count / 10000) * 5000, XMLSITEMAP_MAX_SITEMAP_LINKS);
}
}
return $size;
}