Skip to content

Commit dae29d7

Browse files
committed
v.1.0.5
1 parent d08935b commit dae29d7

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

config/easy_xmlsitemap.settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"base_url": "",
44
"sitemap_dir": "easy_xmlsitemap",
55
"rebuild_frequency": "daily",
6-
"last_build_date": 0,
76
"excluded_urls": "",
87
"excluded_langs": []
98
}

easy_xmlsitemap.admin.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
function easy_xmlsitemap_settings_form() {
1414
$config = config('easy_xmlsitemap.settings');
15-
$last_build_date = $config->get('last_build_date');
15+
$last_build_date = state_get('easy_xmlsitemap_last_build_date', 0);
1616

1717
$info = $last_build_date != 0
1818
? t('Sitemap last build time: ') . format_date($last_build_date, 'short')

easy_xmlsitemap.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ package = SEO
44
backdrop = 1.x
55
type = module
66
configure = admin/config/search/easy_xmlsitemap
7-
version = 1.0.4
7+
version = 1.0.5
88

easy_xmlsitemap.install

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ function easy_xmlsitemap_update_1000() {
3636
$config->set('excluded_langs', array());
3737
$config->save();
3838
}
39+
40+
/**
41+
* Remove obsolete variable from config.
42+
*/
43+
function easy_xmlsitemap_update_1001() {
44+
$config = config('easy_xmlsitemap.settings');
45+
$config->clear('last_build_date');
46+
$config->save();
47+
}

easy_xmlsitemap.module

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ function easy_xmlsitemap_build() {
106106
$output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
107107
. "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">";
108108

109+
$frontpage_nid = easy_xmlsitemap_get_frontpage_nid();
110+
109111
foreach ($result as $node) {
110112
if (node_access('view', $node, $account)) {
111113
// skip node if set as frontpage
112-
$frontpage_nid = easy_xmlsitemap_get_frontpage_nid();
113-
114114
if (!empty($frontpage_nid) && $node->nid == $frontpage_nid) {
115115
continue;
116116
}
@@ -358,8 +358,7 @@ function easy_xmlsitemap_file_save($content) {
358358
$success = file_exists($file_path);
359359

360360
if ($success) {
361-
$config->set('last_build_date', time());
362-
$config->save();
361+
state_set('easy_xmlsitemap_last_build_date', time());
363362
watchdog('easy_xmlsitemap', 'Sitemap file saved.');
364363
backdrop_set_message(t('File "sitemap.xml" has been saved successfully.'));
365364
}
@@ -374,7 +373,7 @@ function easy_xmlsitemap_output() {
374373
$config = config('easy_xmlsitemap.settings');
375374
$file_dir = 'public://' . $config->get('sitemap_dir');
376375
$file_path = $file_dir . '/' . 'sitemap.xml';
377-
$last_build_date = $config->get('last_build_date');
376+
$last_build_date = state_get('easy_xmlsitemap_last_build_date', 0);
378377

379378
if (!file_exists($file_path) || !is_readable($file_path)) {
380379
return backdrop_not_found();
@@ -414,7 +413,7 @@ function easy_xmlsitemap_textarea_to_array($raw_string = '') {
414413
*/
415414
function easy_xmlsitemap_cron() {
416415
$config = config('easy_xmlsitemap.settings');
417-
$last_build_date = $config->get('last_build_date');
416+
$last_build_date = state_get('easy_xmlsitemap_last_build_date', 0);
418417
$rebuild_frequency = $config->get('rebuild_frequency');
419418

420419
if ($rebuild_frequency == 'manually') {

0 commit comments

Comments
 (0)