Commit 17447841 authored by voleger's avatar voleger Committed by pifagor

Issue #3099673 by voleger, sidharthap, ilgnerfagundes, salah1, neclimdul,...

Issue #3099673 by voleger, sidharthap, ilgnerfagundes, salah1, neclimdul, pifagor: Replace deprecated file_scan_directory()
parent 0bb3f721
......@@ -422,7 +422,9 @@ function xmlsitemap_sitemap_get_file(XmlSitemapInterface $sitemap, $chunk = 'ind
function xmlsitemap_sitemap_get_max_filesize(XmlSitemapInterface $sitemap) {
$dir = xmlsitemap_get_directory($sitemap);
$sitemap->setMaxFileSize(0);
foreach (file_scan_directory($dir, '/\.xml$/') as $file) {
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
foreach ($file_system->scanDirectory($dir, '/\.xml$/') as $file) {
$sitemap->setMaxFileSize(max($sitemap->getMaxFileSize(), filesize($file->uri)));
}
return $sitemap->getMaxFileSize();
......@@ -572,7 +574,7 @@ function xmlsitemap_directory_move($old_dir, $new_dir, $replace = FileSystemInte
return FALSE;
}
$files = file_scan_directory($old_dir, '/.*/');
$files = $filesystem->scanDirectory($old_dir, '/.*/');
foreach ($files as $file) {
$file->uri_new = $new_dir . '/' . basename($file->filename);
$success &= (bool) $filesystem->move($file->uri, $file->uri_new, $replace);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment