Commit 7b3522f6 authored by Dave Reid's avatar Dave Reid Committed by Dave Reid

Issue #2387331 by Dave Reid: Make it possible to disable cron regeneration of...

Issue #2387331 by Dave Reid: Make it possible to disable cron regeneration of sitemaps and only use drush xmlsitemap-regenerate.
parent 64756c74
...@@ -348,6 +348,12 @@ function xmlsitemap_settings_form($form, &$form_state) { ...@@ -348,6 +348,12 @@ function xmlsitemap_settings_form($form, &$form_state) {
'#title' => t('Enable developer mode to expose additional settings.'), '#title' => t('Enable developer mode to expose additional settings.'),
'#default_value' => variable_get('xmlsitemap_developer_mode', 0), '#default_value' => variable_get('xmlsitemap_developer_mode', 0),
); );
$form['advanced']['xmlsitemap_disable_cron_regeneration'] = array(
'#type' => 'checkbox',
'#title' => t('Disable cron generation of sitemap files.'),
'#default_value' => variable_get('xmlsitemap_disable_cron_regeneration', 0),
'#description' => t('This can be disabled if other methods are being used to generate the sitemap files, like <em>drush xmlsitemap-regenerate</em>.'),
);
$form['xmlsitemap_settings'] = array( $form['xmlsitemap_settings'] = array(
'#type' => 'vertical_tabs', '#type' => 'vertical_tabs',
......
...@@ -236,6 +236,10 @@ function xmlsitemap_cron() { ...@@ -236,6 +236,10 @@ function xmlsitemap_cron() {
if (!variable_get('xmlsitemap_regenerate_needed', FALSE)) { if (!variable_get('xmlsitemap_regenerate_needed', FALSE)) {
return; return;
} }
// If cron sitemap file regeneration is disabled, stop.
if (variable_get('xmlsitemap_disable_cron_regeneration', 0)) {
return;
}
// If the minimum sitemap lifetime hasn't been passed, skip. // If the minimum sitemap lifetime hasn't been passed, skip.
$lifetime = REQUEST_TIME - variable_get('xmlsitemap_generated_last', 0); $lifetime = REQUEST_TIME - variable_get('xmlsitemap_generated_last', 0);
...@@ -292,6 +296,7 @@ function xmlsitemap_variables() { ...@@ -292,6 +296,7 @@ function xmlsitemap_variables() {
'xmlsitemap_frontpage_changefreq' => XMLSITEMAP_FREQUENCY_DAILY, 'xmlsitemap_frontpage_changefreq' => XMLSITEMAP_FREQUENCY_DAILY,
'xmlsitemap_lastmod_format' => XMLSITEMAP_LASTMOD_MEDIUM, 'xmlsitemap_lastmod_format' => XMLSITEMAP_LASTMOD_MEDIUM,
'xmlsitemap_gz' => FALSE, 'xmlsitemap_gz' => FALSE,
'xmlsitemap_disable_cron_regeneration' => 0,
// Removed variables are set to NULL so they can still be deleted. // Removed variables are set to NULL so they can still be deleted.
'xmlsitemap_regenerate_last' => NULL, 'xmlsitemap_regenerate_last' => NULL,
'xmlsitemap_custom_links' => NULL, 'xmlsitemap_custom_links' => NULL,
......
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