Commit 99c0add1 authored by andrei.dincu's avatar andrei.dincu
Browse files

Issue #2249723 by andrei.dincu: Remove xmlsitemap state variables in hook_uninstall()

parent 5ca1e313
......@@ -72,9 +72,9 @@ function xmlsitemap_requirements($phase) {
$max_chunks = -1;
$max_filesize = -1;
foreach ($sitemaps as $sitemap) {
$max_links = max(array($max_links,$sitemap->getLinks()));
$max_chunks = max(array($max_chunks,$sitemap->getChunks()));
$max_filesize = max(array($max_filesize,$sitemap->getMaxFileSize()));
$max_links = max(array($max_links, $sitemap->getLinks()));
$max_chunks = max(array($max_chunks, $sitemap->getChunks()));
$max_filesize = max(array($max_filesize, $sitemap->getMaxFileSize()));
}
// The maximum number of links in a sitemap.
$max_links_limit = XMLSITEMAP_MAX_SITEMAP_LINKS * XMLSITEMAP_MAX_SITEMAP_LINKS;
......@@ -361,7 +361,7 @@ function xmlsitemap_install() {
$sitemap = $sitemap->setLabel(\Drupal::state()->get('base_url'));
$sitemap->save();
\Drupal::state()->setMultiple(array(
'base_url'=> url(NULL, array('absolute' => TRUE)),
'base_url' => url(NULL, array('absolute' => TRUE)),
'developer_mode' => 0,
'xmlsitemap_entity_menu' => FALSE,
'xmlsitemap_entity_node' => FALSE,
......@@ -386,12 +386,16 @@ function xmlsitemap_enable() {
* Implements hook_uninstall().
*/
function xmlsitemap_uninstall() {
// Remove variables.
// Remove config variables.
$variables = array_keys(xmlsitemap_variables());
foreach ($variables as $variable) {
\Drupal::config('xmlsitemap.settings')->clear($variable);
}
// Remove state variables.
\Drupal::state()->deleteMultiple(array('base_url', 'developer_mode', 'xmlsitemap_entity_menu',
'xmlsitemap_entity_node', 'xmlsitemap_entity_taxonomy', 'xmlsitemap_entity_user'));
// Remove the file cache directory.
xmlsitemap_clear_directory(NULL, TRUE);
}
......
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