[geeklog-hg] geeklog: Staticpage plugin now removes own cache files on add/ed...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Thu Jul 11 19:34:34 EDT 2013
changeset 9174:f41a437f370c
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/f41a437f370c
user: Tom <websitemaster at cogeco.net>
date: Tue Jul 09 15:23:48 2013 -0400
description:
Staticpage plugin now removes own cache files on add/edit/delete instead of lib-template since it is a plugin and not part of the Geeklog Core
diffstat:
plugins/staticpages/services.inc.php | 20 ++++++++++++++++++++
system/lib-template.php | 8 --------
2 files changed, 20 insertions(+), 8 deletions(-)
diffs (88 lines):
diff -r ac353168ba40 -r f41a437f370c plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php Tue Jul 09 15:11:37 2013 -0400
+++ b/plugins/staticpages/services.inc.php Tue Jul 09 15:23:48 2013 -0400
@@ -506,12 +506,20 @@
if (empty($sp_old_id) || ($sp_id == $sp_old_id)) {
if (!$template_flag) {
PLG_itemSaved($sp_id, 'staticpages');
+
+ // Clear Cache
+ $cacheInstance = 'staticpage__' . $sp_id . '__';
+ CACHE_remove_instance($cacheInstance);
} else {
// If template then have to notify of all pages that use this template that a change to the page happened
$sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
$result = DB_query($sql);
while ($A = DB_fetchArray($result)) {
PLG_itemSaved($A['sp_id'], 'staticpages');
+
+ // Clear Cache
+ $cacheInstance = 'staticpage__' . $A['sp_id'] . '__';
+ CACHE_remove_instance($cacheInstance);
}
}
} else {
@@ -520,12 +528,20 @@
array(DB_escapeString($sp_old_id), 'staticpages'));
if (!$template_flag) {
PLG_itemSaved($sp_id, 'staticpages', $sp_old_id);
+
+ // Clear Cache
+ $cacheInstance = 'staticpage__' . $sp_old_id . '__';
+ CACHE_remove_instance($cacheInstance);
} else {
// If template then have to notify of all pages that use this template that a change to the page happened
$sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
$result = DB_query($sql);
while ($A = DB_fetchArray($result)) {
PLG_itemSaved($A['sp_id'], 'staticpages');
+
+ // Clear Cache
+ $cacheInstance = 'staticpage__' . $A['sp_id'] . '__';
+ CACHE_remove_instance($cacheInstance);
}
}
}
@@ -597,6 +613,10 @@
PLG_itemDeleted($sp_id, 'staticpages');
+ // Clear Cache
+ $cacheInstance = 'staticpage__' . $sp_id . '__';
+ CACHE_remove_instance($cacheInstance);
+
return PLG_RET_OK;
}
diff -r ac353168ba40 -r f41a437f370c system/lib-template.php
--- a/system/lib-template.php Tue Jul 09 15:11:37 2013 -0400
+++ b/system/lib-template.php Tue Jul 09 15:23:48 2013 -0400
@@ -233,7 +233,6 @@
$whatsnew = false;
$topicsblock = false;
$topic_tree = false;
- $staticpage = false;
if ($type == 'article' OR $type == 'story') {
$whatsnew = true;
@@ -241,9 +240,6 @@
} elseif ($type == 'topic') {
$topicsblock = true;
$topic_tree = true;
- } elseif ($type == 'staticpages') {
- $whatsnew = true;
- $staticpage = true;
} else {
// hack to see if plugin supports what's new
$fn_head = 'plugin_whatsnewsupported_' . $type;
@@ -266,10 +262,6 @@
$cacheInstance = 'topic_tree__';
CACHE_remove_instance($cacheInstance);
}
- if ($staticpage) {
- $cacheInstance = 'staticpage__' . $id . '__';
- CACHE_remove_instance($cacheInstance);
- }
}
?>
More information about the geeklog-cvs
mailing list