Commit 3810016b authored by andrei.dincu's avatar andrei.dincu

Issue #2249723 by andrei.dincu: Save config variables after setting them a...

Issue #2249723 by andrei.dincu: Save config variables after setting them a value in xmlsitemap.module
parent be076559
......@@ -272,6 +272,8 @@ function xmlsitemap_cron() {
// Regenerate the sitemap XML files.
module_load_include('generate.inc', 'xmlsitemap');
xmlsitemap_run_unprogressive_batch('xmlsitemap_regenerate_batch');
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', FALSE)->save();
}
/**
......@@ -459,7 +461,7 @@ function xmlsitemap_sitemap_save(XmlSitemapInterface $sitemap) {
xmlsitemap_directory_move($old_dir, $new_dir);
// Mark the sitemaps as needing regeneration.
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE);
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE)->save();
}
$sitemap->save();
......@@ -748,7 +750,7 @@ function _xmlsitemap_check_changed_links(array $conditions = array(), array $upd
$changed = $query->execute()->fetchField();
if ($changed && $flag) {
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE);
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE)->save();
}
return $changed;
......@@ -795,7 +797,7 @@ function _xmlsitemap_check_changed_link(array $link, $original_link = NULL, $fla
}
if ($changed && $flag) {
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE);
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE)->save();
}
return $changed;
......@@ -1094,6 +1096,7 @@ function xmlsitemap_link_type_rename($entity_old, $entity_new, $bundles = NULL)
if (isset($value)) {
$variable_new = str_replace('xmlsitemap_settings_' . $entity_old, 'xmlsitemap_settings_' . $entity_new, $variable);
\Drupal::config('xmlsitemap.settings')->set($variable_new, $value);
\Drupal::config('xmlsitemap.settings')->save();
}
}
......@@ -1301,7 +1304,7 @@ function xmlsitemap_form_submit_flag_regenerate($form, $form_state) {
$value = array_keys(array_filter($value));
}
if ($stored_value != 'not_a_variable' && $stored_value != $value) {
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE);
\Drupal::config('xmlsitemap.settings')->set('regenerate_needed', TRUE)->save();
drupal_set_message(t('XML sitemap settings have been modified and the files should be regenerated. You can <a href="@run-cron">run cron manually</a> to regenerate the cached files.', array('@run-cron' => url('admin/reports/status/run-cron', array('query' => drupal_get_destination())))), 'warning', FALSE);
return;
}
......
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