[geeklog-hg] geeklog: fixed ambiguity with type column (and removed commented...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Fri Jun 29 16:18:27 EDT 2012
changeset 8738:ec8c49d69e8a
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ec8c49d69e8a
user: Dirk Haun <dirk at haun-online.de>
date: Fri Jun 29 22:13:51 2012 +0200
description:
fixed ambiguity with type column (and removed commented-out code)
diffstat:
system/lib-story.php | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diffs (35 lines):
diff -r 73ab2f64edd4 -r ec8c49d69e8a system/lib-story.php
--- a/system/lib-story.php Fri Jun 29 22:07:09 2012 +0200
+++ b/system/lib-story.php Fri Jun 29 22:13:51 2012 +0200
@@ -792,26 +792,21 @@
WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND (c.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere})))
GROUP BY c.sid,type, s.title, s.title, s.sid
ORDER BY 5 DESC LIMIT 15";
-
- /* Original
- $sql['mysql'] = "SELECT DISTINCT COUNT(*) AS dups, type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid, max({$_TABLES['comments']}.date) AS lastdate
- FROM {$_TABLES['comments']} LEFT JOIN {$_TABLES['stories']} ON (({$_TABLES['stories']}.sid = {$_TABLES['comments']}.sid)
- AND type = 'article' " . COM_getPermSQL( 'AND', 0, 2, $_TABLES['stories'] ) . " AND ({$_TABLES['stories']}.draft_flag = 0) AND ({$_TABLES['stories']}.commentcode >= 0)" . $topicsql . COM_getLangSQL( 'sid', 'AND', $_TABLES['stories'] ) . ") WHERE ({$_TABLES['comments']}.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere}))) GROUP BY {$_TABLES['comments']}.sid,type, {$_TABLES['stories']}.title, {$_TABLES['stories']}.title, {$_TABLES['stories']}.sid ORDER BY 5 DESC LIMIT 15";
- */
+
$sql['mysql'] = "SELECT DISTINCT COUNT(*) AS dups, c.type, s.title, s.sid, max(c.date) AS lastdate
FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL('AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND','s') . ")
, {$_TABLES['topic_assignments']} ta
WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND (c.date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) AND ((({$stwhere})))
GROUP BY c.sid, c.type, s.title, s.title, s.sid
ORDER BY 5 DESC LIMIT 15";
-
- $sql['pgsql'] = "SELECT DISTINCT COUNT(*) AS dups, type, s.title, s.sid, max(c.date) AS lastdate
+
+ $sql['pgsql'] = "SELECT DISTINCT COUNT(*) AS dups, c.type, s.title, s.sid, max(c.date) AS lastdate
FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL( 'AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND', 's') . ")
, {$_TABLES['topic_assignments']} ta
WHERE ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1 {$topicsql} AND (c.date >= (NOW()+ INTERVAL '{$_CONF['newcommentsinterval']} SECOND')) AND ((({$stwhere})))
- GROUP BY c.sid,type, s.title, s.title, s.sid
+ GROUP BY c.sid,c.type, s.title, s.title, s.sid
ORDER BY 5 DESC LIMIT 15";
-
+
} else {
$sql = "SELECT s.sid, c.title, cid, UNIX_TIMESTAMP(c.date) AS unixdate
FROM {$_TABLES['comments']} c LEFT JOIN {$_TABLES['stories']} s ON ((s.sid = c.sid) AND type = 'article' " . COM_getPermSQL( 'AND', 0, 2, 's') . " AND (s.draft_flag = 0) AND (s.commentcode >= 0)" . COM_getLangSQL('sid', 'AND', 's') . ")
More information about the geeklog-cvs
mailing list