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

Oscar Renalias oscar at renalias.net
Sat Mar 17 15:22:36 EDT 2007


Is it really necessary to create a script? Article counters are  
recalculated every time a post is updated or added, so they will  
eventually get the right value.

On 17 Mar 2007, at 21:16, Mark Wu wrote:

> Hi Oscar:
>
> We need to write a small script for user to update the wrong  
> counters. If no
> one do it, I will do it after I get up.
>
> Mark
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
>> mark at devel.lifetype.net
>> Sent: Sunday, March 18, 2007 3:15 AM
>> To: plog-svn at devel.lifetype.net
>> Subject: [pLog-svn] r5126 - plog/branches/lifetype-1.2/class/dao
>>
>> 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 );
>>              }
>>
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>>
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>



More information about the pLog-svn mailing list