function _xmlsitemap_get_optimal_memory_limit in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.generate.inc \_xmlsitemap_get_optimal_memory_limit()
Calculate the optimal PHP memory limit for sitemap generation.
This function just makes a guess. It does not take into account the currently loaded modules.
1 call to _xmlsitemap_get_optimal_memory_limit()
- _xmlsitemap_set_memory_limit in ./
xmlsitemap.generate.inc - Calculate the optimal memory level for sitemap generation.
File
- ./
xmlsitemap.generate.inc, line 103 - Sitemap generation and rebuilding functions for the xmlsitemap module.
Code
function _xmlsitemap_get_optimal_memory_limit() {
$optimal_limit =& xmlsitemap_static(__FUNCTION__);
if (!isset($optimal_limit)) {
// Set the base memory amount from the provided core constant.
$optimal_limit = parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT);
// Add memory based on the chunk size.
$optimal_limit += xmlsitemap_get_chunk_size() * 500;
// Add memory for storing the url aliases.
if (variable_get('xmlsitemap_prefetch_aliases', 1)) {
$aliases = db_result(db_query("SELECT COUNT(pid) FROM {url_alias}"));
$optimal_limit += $aliases * 250;
}
}
return $optimal_limit;
}