[pLog-svn] r4642 - plog/branches/lifetype-1.1.5/class/summary/dao
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Feb 1 04:34:45 EST 2007
Author: oscar
Date: 2007-02-01 04:34:44 -0500 (Thu, 01 Feb 2007)
New Revision: 4642
Modified:
plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php
Log:
reverted the mostActiveBlogs() changes until we find another solution, since they did not seem to work very well
Modified: plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php
===================================================================
--- plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php 2007-02-01 00:12:11 UTC (rev 4641)
+++ plog/branches/lifetype-1.1.5/class/summary/dao/summarystats.class.php 2007-02-01 09:34:44 UTC (rev 4642)
@@ -179,13 +179,16 @@
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
$prefix = $this->getPrefix();
- $query = "SELECT id, num_posts, last_update_date FROM {$prefix}blogs
- WHERE show_in_summary = '1'
- AND last_update_date >= ".$this->_startTime." AND last_update_date <= ".$this->_now."
- AND status = ".BLOG_STATUS_ACTIVE." AND
- last_update_date > create_date
- ORDER BY last_update_date DESC, num_posts DESC";
-
+ $query = "SELECT COUNT(a.id) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) + 1)) ) as rank, b.id AS blog_id
+ FROM {$prefix}articles AS a
+ INNER JOIN {$prefix}blogs AS b
+ ON b.id = a.blog_id AND b.status = ".BLOG_STATUS_ACTIVE."
+ WHERE a.date >= ".$this->_startTime." AND a.date <= ".$this->_now."
+ AND in_summary_page = '1'
+ AND b.show_in_summary = '1'
+ GROUP BY a.id
+ ORDER BY rank DESC";
+
if( $maxBlogs > 0 )
$query .= " LIMIT 0,".$maxBlogs;
else
@@ -200,7 +203,7 @@
$blogs = Array();
$blogsDao = new Blogs();
while( $row = $result->FetchRow()) {
- $blog = $blogsDao->getBlogInfo( $row["id"] );
+ $blog = $blogsDao->getBlogInfo( $row["blog_id"] );
$blogs[$blog->getId()] = $blog;
}
More information about the pLog-svn
mailing list