You are here

function xmlsitemap_clear_directory in XML sitemap 2.x

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

Clears sitemap directory.

Parameters

\Drupal\xmlsitemap\XmlSitemapInterface $sitemap: Sitemap entity.

bool $delete: If TRUE, delete the path directory afterwards.

Return value

bool Returns TRUE is operation was successful, FALSE otherwise.

4 calls to xmlsitemap_clear_directory()
DirectoryTest::testClearDirectory in tests/src/Kernel/DirectoryTest.php
Test xmlsitemap_clear_directory().
XmlSitemapGenerator::regenerateBatchGenerate in src/XmlSitemapGenerator.php
Batch callback; generate all pages of a sitemap.
XmlSitemapStorage::doDelete in src/XmlSitemapStorage.php
Performs storage-specific entity deletion.
xmlsitemap_uninstall in ./xmlsitemap.install
Implements hook_uninstall().

File

./xmlsitemap.module, line 542
xmlsitemap XML sitemap

Code

function xmlsitemap_clear_directory(XmlSitemapInterface $sitemap = NULL, $delete = FALSE) {
  $directory = xmlsitemap_get_directory($sitemap);
  return _xmlsitemap_delete_recursive($directory, $delete);
}