Commit 1664e98c authored by Dave Reid's avatar Dave Reid

#793510 by Dave Reid: Fixed sitemaps not flagged for regeneration after the context upgrade.

parent eb51936a
......@@ -15,7 +15,7 @@ function xmlsitemap_requirements($phase) {
$requirements = array();
$t = get_t();
if (variable_get('clean_url', 0) && file_exists('./sitemap.xml')) {
if (variable_get('clean_url', 0) && file_exists(DRUPAL_ROOT . '/sitemap.xml')) {
$requirements['xmlsitemap_file'] = array(
'title' => $t('XML sitemap'),
'value' => $t('Existing sitemap.xml file found.'),
......@@ -77,18 +77,18 @@ function xmlsitemap_requirements($phase) {
}
// Check when the cached files were last generated.
$generated_last = xmlsitemap_var('generated_last');
$generated_last = variable_get('xmlsitemap_generated_last', 0);
$generated_ago = REQUEST_TIME - $generated_last;
$requirements['xmlsitemap_generated'] = array(
'title' => $t('XML sitemap'),
'value' => $generated_last ? $t('Last generated on !date (!interval ago).', array('!date' => format_date($generated_last, 'small'), '!interval' => format_interval($generated_ago))) : $t('Cached files have not been generated yet.'),
'severity' => REQUIREMENT_OK,
);
if (xmlsitemap_var('rebuild_needed')) {
if (variable_get('xmlsitemap_rebuild_needed', FALSE)) {
$requirements['xmlsitemap_generated']['severity'] = REQUIREMENT_ERROR;
$requirements['xmlsitemap_generated']['description'] = $t('The XML sitemap data is out of sync and needs to be <a href="@link-rebuild">completely rebuilt<a>.', array('@link-rebuild' => url('admin/config/search/xmlsitemap/rebuild')));
}
elseif (xmlsitemap_var('regenerate_needed')) {
elseif (variable_get('xmlsitemap_regenerate_needed', FALSE)) {
if ($generated_ago >= variable_get('cron_threshold_error', 1209600)) {
$requirements['xmlsitemap_generated']['severity'] = REQUIREMENT_ERROR;
}
......@@ -413,6 +413,10 @@ function xmlsitemap_update_6202() {
// Language variable is no longer needed, so go ahead and delete it.
variable_del('xmlsitemap_languages');
// Ensure that the sitemaps will be refreshed on next cron.
variable_set('xmlsitemap_generated_last', 0);
variable_set('xmlsitemap_regenerate_needed', 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