[geeklog-cvs] geeklog: Remove sitemap files when uninstalling the XMLSitemap p...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun May 17 14:20:18 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e7480f4ebb74
changeset: 7038:e7480f4ebb74
user: Dirk Haun <dirk at haun-online.de>
date: Sun May 17 20:02:26 2009 +0200
description:
Remove sitemap files when uninstalling the XMLSitemap plugin
diffstat:
2 files changed, 29 insertions(+), 13 deletions(-)
plugins/xmlsitemap/functions.inc | 41 +++++++++++++++++++++++++-------------
public_html/docs/history | 1
diffs (81 lines):
diff -r 664a7d73ef34 -r e7480f4ebb74 plugins/xmlsitemap/functions.inc
--- a/plugins/xmlsitemap/functions.inc Sun May 17 19:41:42 2009 +0200
+++ b/plugins/xmlsitemap/functions.inc Sun May 17 20:02:26 2009 +0200
@@ -130,6 +130,9 @@
/* give all vars with their name */
'vars' => array('xmlsitemap_filename', 'xmlsitemap_mobile'),
);
+
+ XMLSITEMAP_removeSitemapFiles();
+
return $out;
}
@@ -273,8 +276,6 @@
if ($enable) {
/**
- * @note
- *
* At this time, $_XMLSMAP_CONF is visible only in
* PLG_enableStateChange(). So we have to reload them from DB.
*/
@@ -282,17 +283,7 @@
XMLSMAP_update();
} else {
- if ($_XMLSMAP_CONF['sitemap_file'] != '') {
- if (!@unlink($_CONF['path_html'] . $_XMLSMAP_CONF['sitemap_file'])) {
- COM_errorLog('Xmlsitemap: cannot delete a sitemap: ' . $_CONF['path_html'] . $_XMLSMAP_CONF['sitemap_file']);
- }
- }
-
- if (! empty($_XMLSMAP_CONF['mobile_sitemap_file'])) {
- if (!@unlink($_CONF['path_html'] . $_XMLSMAP_CONF['mobile_sitemap_file'])) {
- COM_errorLog('Xmlsitemap: cannot delete a sitemap: ' . $_CONF['path_html'] . $_XMLSMAP_CONF['mobile_sitemap_file']);
- }
- }
+ XMLSITEMAP_removeSitemapFiles();
}
}
@@ -524,4 +515,28 @@
}
}
+/**
+* Remove the sitemap file(s)
+*
+* @return void
+*/
+function XMLSITEMAP_removeSitemapFiles()
+{
+ global $_CONF, $_XMLSMAP_CONF;
+
+ $filenames = array('sitemap_file', 'mobile_sitemap_file');
+
+ foreach ($filenames as $filename) {
+ if (! empty($_XMLSMAP_CONF[$filename])) {
+ $sitemap = $_CONF['path_html'] . $_XMLSMAP_CONF[$filename];
+ if (file_exists($sitemap)) {
+ if (! @unlink($sitemap)) {
+ COM_errorLog('XMLSitemap: cannot delete a sitemap: '
+ . $sitemap);
+ }
+ }
+ }
+ }
+}
+
?>
diff -r 664a7d73ef34 -r e7480f4ebb74 public_html/docs/history
--- a/public_html/docs/history Sun May 17 19:41:42 2009 +0200
+++ b/public_html/docs/history Sun May 17 20:02:26 2009 +0200
@@ -37,6 +37,7 @@
XMLSitemap plugin
-----------------
+- Remove sitemap files when uninstalling the plugin [Dirk]
- Don't include Links in the sitemap.xml automatically [Dirk]
- Fixed "missing argument 2" error when changing config options (reported by
Markus Wollschläger) [Dirk]
More information about the geeklog-cvs
mailing list