[pLog-svn] r1218 - in plog/trunk/class: dao template

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sat Feb 26 22:04:37 GMT 2005


Author: oscar
Date: 2005-02-26 22:04:37 +0000 (Sat, 26 Feb 2005)
New Revision: 1218

Modified:
   plog/trunk/class/dao/blogs.class.php
   plog/trunk/class/template/cachecontrol.class.php
Log:
some more db optimizations, at least now CacheControl does not take forever because it does not load all the data from a blog! If all we need is a list of the blog ids, then let's do so (Blogs::getAllBlogIds())

Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php	2005-02-26 21:50:33 UTC (rev 1217)
+++ plog/trunk/class/dao/blogs.class.php	2005-02-26 22:04:37 UTC (rev 1218)
@@ -312,6 +312,23 @@
 
             return $blogs;
         }
+		
+		/**
+		 * returns only an array with all the blog ids
+		 *
+		 * @return an array with blog ids
+		 */
+		function getAllBlogIds()
+		{
+			$query = "SELECT id FROM ".$this->getPrefix()."blogs";
+			
+			$result = $this->Execute( $query );
+			if( !$result )
+				return Array();
+				
+			// return all the rows straight from adodb
+			return( $result->GetRows());
+		}
 
 		/**
 		 * returns the total number of blogs in the site

Modified: plog/trunk/class/template/cachecontrol.class.php
===================================================================
--- plog/trunk/class/template/cachecontrol.class.php	2005-02-26 21:50:33 UTC (rev 1217)
+++ plog/trunk/class/template/cachecontrol.class.php	2005-02-26 22:04:37 UTC (rev 1218)
@@ -24,11 +24,11 @@
 		{
 			// get a list of all the blogs
 			$blogs = new Blogs();
-			$siteBlogs = $blogs->getAllBlogs();
+			$siteBlogs = $blogs->getAllBlogIds();
 			
 			// and loop through them
-			foreach( $siteBlogs as $blog ) {
-				CacheControl::resetBlogCache( $blog->getId(), false );
+			foreach( $siteBlogs as $blogId ) {
+				CacheControl::resetBlogCache( $blogId, false );
 			}
 			
 			// clear the cache used by the summary




More information about the pLog-svn mailing list