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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat May 6 20:33:53 GMT 2006


Author: jondaley
Date: 2006-05-06 20:33:52 +0000 (Sat, 06 May 2006)
New Revision: 3354

Modified:
   plog/trunk/class/summary/dao/summarystats.class.php
Log:
rev 3234 seems to have broken a bunch of things.  The recent article timestamp checking was wrong - there isn't a timestamp included in the _now variable, only a date, so articles don't show on the summary until the next day.  I fixed the only one that I can test, I imagine they are all broken?  Is there any reason to not use NOW() in the sql query instead of pre-calculating the value?

Modified: plog/trunk/class/summary/dao/summarystats.class.php
===================================================================
--- plog/trunk/class/summary/dao/summarystats.class.php	2006-05-06 18:53:28 UTC (rev 3353)
+++ plog/trunk/class/summary/dao/summarystats.class.php	2006-05-06 20:33:52 UTC (rev 3354)
@@ -39,11 +39,11 @@
             
             // calculate the date limits
             $t = new Timestamp();
-            //$this->_now = $t->getTimestamp(); 
-			$this->_now = $t->getYear().$t->getMonth();
+                //$this->_now = $t->getTimestamp(); 
+            $this->_now = $t->getYear().$t->getMonth();
 			if( $t->getDay() < 10 )
 				$this->_now .= "0";
-			$this->_now .= $t->getDay();			
+			$this->_now .= $t->getDay();
             // 7 days ago
             $t->subtractSeconds( 7 * 24 * 60 * 60 );
             //$this->_sevenDaysAgo = $t->getTimestamp();
@@ -251,14 +251,12 @@
             include_once( PLOG_CLASS_PATH . "class/data/timestamp.class.php" );
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
 
-            $t      = new Timestamp();
-            $date   = $t->getTimestamp();
 			$prefix = $this->getPrefix();
 
 			$query = "SELECT a.*
 					  FROM {$prefix}articles a, 
 					       {$prefix}blogs b
-					  WHERE a.date >= ".$this->_sevenDaysAgo." AND a.date <= ".$this->_now."
+					  WHERE a.date >= ".$this->_sevenDaysAgo." AND a.date <= NOW()
 					        AND a.blog_id = b.id
 					        AND b.status = ".BLOG_STATUS_ACTIVE."
 					        AND a.status = ".POST_STATUS_PUBLISHED."
@@ -312,8 +310,6 @@
             include_once( PLOG_CLASS_PATH . "class/data/timestamp.class.php" );
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
 
-            $t      = new Timestamp();
-            $date   = $t->getTimestamp();
 			$prefix = $this->getPrefix();
 
 			$query = "SELECT a.id as id, MAX(a.date) as date
@@ -352,8 +348,6 @@
             include_once( PLOG_CLASS_PATH . "class/data/timestamp.class.php" );
             include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
 
-            $t      = new Timestamp();
-            $date   = $t->getTimestamp();
 			$prefix = $this->getPrefix();
 
 			$query = "SELECT a.*



More information about the pLog-svn mailing list