[pLog-svn] r626 - plog/trunk/class/summary/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Dec 30 16:23:03 GMT 2004


Author: oscar
Date: 2004-12-30 16:23:02 +0000 (Thu, 30 Dec 2004)
New Revision: 626

Modified:
   plog/trunk/class/summary/dao/summarystats.class.php
Log:
fixed a bug in SummaryStats::getMostCommentedArticles(), there was an error in the sql query

Modified: plog/trunk/class/summary/dao/summarystats.class.php
===================================================================
--- plog/trunk/class/summary/dao/summarystats.class.php	2004-12-30 15:50:44 UTC (rev 625)
+++ plog/trunk/class/summary/dao/summarystats.class.php	2004-12-30 16:23:02 UTC (rev 626)
@@ -39,15 +39,17 @@
          */
         function getMostCommentedArticles( $maxPosts = 0, $ignoreTopic = "", $ignoreText = "" ,$date = 0)
         {
-			$query = " SELECT COUNT(*) as total_comments, a.* FROM ".$this->getPrefix()."articles_comments AS c
-       				   INNER JOIN ".$this->getPrefix()."articles AS a ON c.article_id=a.id WHERE a.status = ".POST_STATUS_PUBLISHED;
+			$prefix = $this->getPrefix();
+			$query = " SELECT COUNT(*) as total_comments, a.* 
+					   FROM {$prefix}articles_comments AS c, {$prefix}articles AS a, {$prefix}articles_text t
+       				   WHERE c.article_id = a.id AND t.article_id = a.id AND a.status = ".POST_STATUS_PUBLISHED;
 
 			// ignore certain topics and/or certain texts
 			if( $ignoreTopic != "" )
-				$query .= " AND a.topic NOT LIKE '%".Db::qstr( $ignoreTopic )."%' ";
+				$query .= " AND t.topic NOT LIKE '%".Db::qstr( $ignoreTopic )."%' ";
 
 			if( $ignoreText != "" )
-				$query .= " AND a.text NOT LIKE '%".Db::qstr( $ignoreTopic )."%' ";
+				$query .= " AND t.text NOT LIKE '%".Db::qstr( $ignoreTopic )."%' ";
 
 			$query .= " GROUP BY c.article_id ORDER BY total_comments DESC ";
 




More information about the pLog-svn mailing list