[geeklog-cvs] geeklog: When manually adding or removing plugins in the XMLSite...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jun 7 15:25:27 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/3a4524178456
changeset: 7088:3a4524178456
user: Dirk Haun <dirk at haun-online.de>
date: Sun Jun 07 20:04:45 2009 +0200
description:
When manually adding or removing plugins in the XMLSitemap plugin, automatically add/remove corresponding entries for priority and frequency (part of bug #0000898)
diffstat:
plugins/xmlsitemap/functions.inc | 39 ++++++++++++++++++++++++++++++++++++---
public_html/docs/history | 5 +++++
2 files changed, 41 insertions(+), 3 deletions(-)
diffs (75 lines):
diff -r a257d2843389 -r 3a4524178456 plugins/xmlsitemap/functions.inc
--- a/plugins/xmlsitemap/functions.inc Sun Jun 07 19:07:00 2009 +0200
+++ b/plugins/xmlsitemap/functions.inc Sun Jun 07 20:04:45 2009 +0200
@@ -344,13 +344,14 @@
'weekly', 'monthly', 'yearly', 'never');
if (!is_numeric($key) AND in_array($key, $enabled_plugins)
- AND (in_array($value, $valid_change_freqs))) {
- $valids[$key] = $value;
+ AND in_array($value, $valid_change_freqs)) {
+ $valids[$key] = $value;
}
break;
default:
- trigger_error('XMLSITEMAP_checkChange: "' . $name . '" not implemented');
+ trigger_error('XMLSITEMAP_checkChange: "' . $name
+ . '" not implemented');
break;
}
}
@@ -366,6 +367,38 @@
$config = config::get_instance();
$config->set($name, $valids, 'xmlsitemap');
}
+
+ if ($name == 'types') {
+ /**
+ * The list of plugins in the sitemap changed. Make sure we have
+ * priorities and frequencies for all active plugins and remove
+ * those for inactive plugins.
+ */
+ $priorities = array();
+ $frequencies = array();
+ foreach ($enabled_plugins as $plugin) {
+ if (in_array($plugin, $_XMLSMAP_CONF['types'])) {
+ // plugin is active: ensure we have prio. + freq. entries
+ if (isset($_XMLSMAP_CONF['priorities'][$plugin])) {
+ $priorities[$plugin] = $_XMLSMAP_CONF['priorities'][$plugin];
+ } else {
+ $priorities[$plugin] = 0.5;
+ }
+ if (isset($_XMLSMAP_CONF['frequencies'][$plugin])) {
+ $frequencies[$plugin] = $_XMLSMAP_CONF['frequencies'][$plugin];
+ } else {
+ $frequencies[$plugin] = 'daily';
+ }
+ }
+ }
+
+ require_once $_CONF['path_system'] . 'classes/config.class.php';
+ $config = config::get_instance();
+ ksort($priorities);
+ $config->set('priorities', $priorities, 'xmlsitemap');
+ ksort($frequencies);
+ $config->set('frequencies', $frequencies, 'xmlsitemap');
+ }
}
/**
diff -r a257d2843389 -r 3a4524178456 public_html/docs/history
--- a/public_html/docs/history Sun Jun 07 19:07:00 2009 +0200
+++ b/public_html/docs/history Sun Jun 07 20:04:45 2009 +0200
@@ -29,6 +29,11 @@
become orphaned (part of bug #0000901) [Dirk]
- When deleting a static page, also delete its comments (bug #0000901) [Dirk]
+XMLSitemap plugin
+-----------------
+- When manually adding or removing plugins, automatically add/remove
+ corresponding entries for priority and frequency (part of bug #0000898) [Dirk]
+
May 31, 2009 (1.6.0b2)
------------
More information about the geeklog-cvs
mailing list