[geeklog-cvs] geeklog: Auto-deleting a story didn't delete trackbacks for that...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Mar 1 03:10:54 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/80cdeb74d1a6
changeset: 6804:80cdeb74d1a6
user: Dirk Haun <dirk at haun-online.de>
date: Sat Feb 28 19:25:22 2009 +0100
description:
Auto-deleting a story didn't delete trackbacks for that story
diffstat:
3 files changed, 34 insertions(+), 19 deletions(-)
public_html/docs/history | 1 +
public_html/index.php | 8 +++-----
system/lib-story.php | 44 ++++++++++++++++++++++++++++++--------------
diffs (94 lines):
diff -r 0dab4911359a -r 80cdeb74d1a6 public_html/docs/history
--- a/public_html/docs/history Sat Feb 28 18:39:17 2009 +0100
+++ b/public_html/docs/history Sat Feb 28 19:25:22 2009 +0100
@@ -11,6 +11,7 @@
+ (TBD) Comment moderation and editable comments, by Jared Wenerd
Other changes:
+- Auto-deleting a story didn't delete trackbacks for that story [Dirk]
- Ensure consistent template variable names for the Permission Editor [Dirk]
- Added new permission 'group.assign', now required to be able to assign a user
to a group. Part of the Group Admin (not User Admin) permissions by default
diff -r 0dab4911359a -r 80cdeb74d1a6 public_html/index.php
--- a/public_html/index.php Sat Feb 28 18:39:17 2009 +0100
+++ b/public_html/index.php Sat Feb 28 19:25:22 2009 +0100
@@ -215,14 +215,12 @@
while (list ($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetchArray ($expiresql)) {
if ($statuscode == STORY_ARCHIVE_ON_EXPIRE) {
if (!empty ($archivetid) ) {
- COM_errorLOG("Archive Story: $sid, Topic: $archivetid, Title: $title, Expired: $expire");
+ COM_errorLog("Archive Story: $sid, Topic: $archivetid, Title: $title, Expired: $expire");
DB_query ("UPDATE {$_TABLES['stories']} SET tid = '$archivetid', frontpage = '0', featured = '0' WHERE sid='{$sid}'");
}
} else if ($statuscode == STORY_DELETE_ON_EXPIRE) {
- COM_errorLOG("Delete Story and comments: $sid, Topic: $expiretopic, Title: $title, Expired: $expire");
- STORY_deleteImages ($sid);
- DB_query("DELETE FROM {$_TABLES['comments']} WHERE sid='{$sid}' AND type = 'article'");
- DB_query("DELETE FROM {$_TABLES['stories']} WHERE sid='{$sid}'");
+ COM_errorLog("Delete Story and comments: $sid, Topic: $expiretopic, Title: $title, Expired: $expire");
+ STORY_doDeleteThisStoryNow($sid);
}
}
diff -r 0dab4911359a -r 80cdeb74d1a6 system/lib-story.php
--- a/system/lib-story.php Sat Feb 28 18:39:17 2009 +0100
+++ b/system/lib-story.php Sat Feb 28 19:25:22 2009 +0100
@@ -874,6 +874,34 @@
}
/**
+* Delete a story and related data immediately.
+*
+* Note: For internal use only! To delete a story, use STORY_deleteStory (see
+* above), which will do permission checks and eventually end up here.
+*
+* @param string $sid ID of the story to delete
+*
+*/
+function STORY_doDeleteThisStoryNow($sid)
+{
+ global $_TABLES;
+
+ STORY_deleteImages($sid);
+ DB_delete($_TABLES['comments'], array('sid', 'type'),
+ array($sid, 'article'));
+ DB_delete($_TABLES['trackback'], array('sid', 'type'),
+ array($sid, 'article'));
+ DB_delete($_TABLES['stories'], 'sid', $sid);
+
+ // notify plugins
+ PLG_itemDeleted($sid, 'article');
+
+ // update RSS feed and Older Stories block
+ COM_rdfUpToDateCheck();
+ COM_olderStuff();
+}
+
+/**
* Return true since this component supports webservices
*
* @return bool True, if webservices are supported
@@ -1320,21 +1348,9 @@
}
}
- STORY_deleteImages ($sid);
- DB_query("DELETE FROM {$_TABLES['comments']} WHERE sid = '$sid' AND type = 'article'");
- DB_delete ($_TABLES['stories'], 'sid', $sid);
+ STORY_doDeleteStoryNow($sid);
- // delete Trackbacks
- DB_query ("DELETE FROM {$_TABLES['trackback']} WHERE sid = '$sid' AND type = 'article';");
-
- // notify plugins
- PLG_itemDeleted($sid, 'article');
-
- // update RSS feed and Older Stories block
- COM_rdfUpToDateCheck();
- COM_olderStuff();
-
- $output = COM_refresh ($_CONF['site_admin_url'] . '/story.php?msg=10');
+ $output = COM_refresh($_CONF['site_admin_url'] . '/story.php?msg=10');
return PLG_RET_OK;
}
More information about the geeklog-cvs
mailing list