You are here

function xmlsitemap_sitemap_get_max_filesize in XML sitemap 7.2

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_sitemap_get_max_filesize()
  2. 6.2 xmlsitemap.module \xmlsitemap_sitemap_get_max_filesize()
  3. 2.x xmlsitemap.module \xmlsitemap_sitemap_get_max_filesize()

Find the maximum file size of all a sitemap's XML files.

Parameters

object $sitemap: The XML sitemap array.

Related topics

2 calls to xmlsitemap_sitemap_get_max_filesize()
xmlsitemap_regenerate_batch_generate in ./xmlsitemap.generate.inc
Batch callback; generate all pages of a sitemap.
xmlsitemap_update_6203 in ./xmlsitemap.install
Implements hook_update_N().

File

./xmlsitemap.module, line 534
xmlsitemap XML sitemap

Code

function xmlsitemap_sitemap_get_max_filesize(stdClass $sitemap) {
  $dir = xmlsitemap_get_directory($sitemap);
  $sitemap->max_filesize = 0;
  foreach (file_scan_directory($dir, '/\\.xml$/') as $file) {
    $sitemap->max_filesize = max($sitemap->max_filesize, filesize($file->uri));
  }
  return $sitemap->max_filesize;
}