[pLog-svn] r5126 - plog/branches/lifetype-1.2/class/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Sat Mar 17 15:15:07 EDT 2007


Author: mark
Date: 2007-03-17 15:15:06 -0400 (Sat, 17 Mar 2007)
New Revision: 5126

Modified:
   plog/branches/lifetype-1.2/class/dao/articles.class.php
Log:
Fixed the negative total posts bug. 

The counter already update in updateArticle(), we can not update it again in deleteArticle().

Modified: plog/branches/lifetype-1.2/class/dao/articles.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/articles.class.php	2007-03-17 18:53:47 UTC (rev 5125)
+++ plog/branches/lifetype-1.2/class/dao/articles.class.php	2007-03-17 19:15:06 UTC (rev 5126)
@@ -1098,12 +1098,6 @@
 				// update global article categories
 				$this->updateGlobalArticleCategoriesLink( $article );
 
-				lt_include( PLOG_CLASS_PATH."class/dao/recentarticles.class.php" );
-				RecentArticles::resetRecentArticlesCache( $blogId );                
-    	        $this->_cache->removeData( $blogId, CACHE_ARTICLESPERMONTH );
-        	    $this->_cache->removeData( $artId, CACHE_ARTICLES );                
-            }
-            else {
  				// update the blog counters
 				if( $article->getStatus() == POST_STATUS_PUBLISHED ) {            
 		            $blogs = new Blogs();
@@ -1111,7 +1105,14 @@
 	        	    $blogInfo->setTotalPosts( $blogInfo->getTotalPosts() - 1 );
 	            	$blogs->updateBlog( $blogInfo );
 	            }
- 
+
+	            // remove all related cache
+				lt_include( PLOG_CLASS_PATH."class/dao/recentarticles.class.php" );
+				RecentArticles::resetRecentArticlesCache( $blogId );                
+    	        $this->_cache->removeData( $blogId, CACHE_ARTICLESPERMONTH );
+        	    $this->_cache->removeData( $artId, CACHE_ARTICLES );                
+            }
+            else {
             	$article->setStatus( POST_STATUS_DELETED );
             	$this->updateArticle( $article );
             }



More information about the pLog-svn mailing list