You are here

function _xmlsitemap_set_memory_limit in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.generate.inc \_xmlsitemap_set_memory_limit()

Calculate the optimal memory level for sitemap generation.

Parameters

$new_limit: An optional PHP memory limit in bytes. If not provided, the value of _xmlsitemap_get_optimal_memory_limit() will be used.

1 call to _xmlsitemap_set_memory_limit()
_xmlsitemap_regenerate_before in ./xmlsitemap.generate.inc
Perform operations before rebuilding the sitemap.

File

./xmlsitemap.generate.inc, line 128
Sitemap generation and rebuilding functions for the xmlsitemap module.

Code

function _xmlsitemap_set_memory_limit($new_limit = NULL) {
  $current_limit = @ini_get('memory_limit');
  if ($current_limit && $current_limit != -1) {
    if (!is_null($new_limit)) {
      $new_limit = _xmlsitemap_get_optimal_memory_limit();
    }
    if (parse_size($current_limit) < $new_limit) {
      return @ini_set('memory_limit', $new_limit);
    }
  }
}