[pLog-svn] r2873 - plog/trunk

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Jan 29 22:18:21 GMT 2006


Author: oscar
Date: 2006-01-29 22:18:20 +0000 (Sun, 29 Jan 2006)
New Revision: 2873

Modified:
   plog/trunk/wizard.php
Log:
trackbacks were not being counted at all


Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-01-29 22:03:24 UTC (rev 2872)
+++ plog/trunk/wizard.php	2006-01-29 22:18:20 UTC (rev 2873)
@@ -1503,13 +1503,14 @@
         
         function updateArticleCounters()
         {
-            include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );        
+            include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+            include_once( PLOG_CLASS_PATH."class/dao/articlecommentstatus.class.php" );
             
             $numUpdated = 0;
             
             // build the queries
             $query1 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments GROUP BY article_id";
-            $query2 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments WHERE status = ".POST_STATUS_PUBLISHED." GROUP BY article_id";
+            $query2 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."articles_comments WHERE status = ".COMMENT_STATUS_NONSPAM." GROUP BY article_id";
             $query3 = "SELECT article_id, COUNT(*) AS total FROM ".$this->dbPrefix."trackbacks GROUP BY article_id";
             $query4 = "SELECT id FROM ".$this->dbPrefix."articles";
             
@@ -1546,7 +1547,7 @@
             $numTrackbacks = Array();            
             while( $row = $res3->FetchRow()) {
                 $numTrackbacks[$row["article_id"]] = $row["total"];
-            }            
+            }           
             
             // article ids
             $res4 = $this->db->Execute( $query4 );
@@ -1568,7 +1569,7 @@
                 $query = "UPDATE ".$this->dbPrefix."articles SET num_comments = {$totalComments},
                           num_nonspam_comments = {$totalActiveComments},
                           num_trackbacks = {$totalTrackbacks},
-                          num_nonspam_trackbacks = 0,
+                          num_nonspam_trackbacks = {$totalTrackbacks},
                           date = date
                           WHERE id = {$artId}";
                           



More information about the pLog-svn mailing list