[pLog-svn] r3908 - plog/trunk/class/dao

Mark Wu markplace at gmail.com
Sun Sep 3 17:05:38 GMT 2006


I just finished my Vacation, too :P

Okay, about this bug, if we save the post from draft to published or we
change a post from published to draft, we never update the post count in
these kind of situation. Therefore the counter number is wrong.

So, it is the bug fix for this bug

Mark 

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Sunday, September 03, 2006 1:43 AM
> To: plog-svn at devel.lifetype.net
> Cc: /var/svn/plog at devel.lifetype.net; 3908 at devel.lifetype.net
> Subject: Re: [pLog-svn] r3908 - plog/trunk/class/dao
> 
> The diff is hard to read, so what was the problem and why do 
> we need a script to fix previous installations? What would it do?
> 
> On 23 Aug 2006, at 20:12, mark at devel.lifetype.net wrote:
> 
> > Author: mark
> > Date: 2006-08-23 17:12:15 +0000 (Wed, 23 Aug 2006) New 
> Revision: 3908
> >
> > Modified:
> >    plog/trunk/class/dao/articles.class.php
> > Log:
> > Fixed a bug of blog post count. We need to write a script to update 
> > the counter in previous installation. :(
> >
> > Modified: plog/trunk/class/dao/articles.class.php
> > ===================================================================
> > --- plog/trunk/class/dao/articles.class.php	2006-08-23 
> 08:24:17 UTC  
> > (rev 3907)
> > +++ plog/trunk/class/dao/articles.class.php	2006-08-23 
> 17:12:15 UTC  
> > (rev 3908)
> > @@ -971,6 +971,19 @@
> >                  return false;
> >  			}
> >
> > +			// update the blog counter
> > +			if( $oldArticle->getStatus() == 
> POST_STATUS_PUBLISHED &&
> > $article->getStatus() != POST_STATUS_PUBLISHED ) {
> > +		    	$blogs = new Blogs();
> > +	    	    $blogInfo = $article->getBlogInfo();
> > +	        	$blogInfo->setTotalPosts( 
> $blogInfo->getTotalPosts() - 1 );
> > +	            $blogs->updateBlog( $blogInfo );
> > +	        } elseif ( $oldArticle->getStatus() !=
> > POST_STATUS_PUBLISHED && $article->getStatus() == 
> > POST_STATUS_PUBLISHED ) {
> > +		    	$blogs = new Blogs();
> > +	    	    $blogInfo = $article->getBlogInfo();
> > +	        	$blogInfo->setTotalPosts( 
> $blogInfo->getTotalPosts() + 1 );
> > +	            $blogs->updateBlog( $blogInfo );
> > +	    	}
> > +
> >              // clean up the cache
> >  			include_once( PLOG_CLASS_PATH."class/dao/ 
> > recentarticles.class.php" );
> >  			
> RecentArticles::resetRecentArticlesCache( $article->getBlogId 
> > ());			
> > @@ -1132,18 +1145,18 @@
> >          	    $this->_cache->removeData( $artId, CACHE_ARTICLES );
> >              }
> >              else {
> > + 				// update the blog counters
> > +				if( $article->getStatus() == 
> POST_STATUS_PUBLISHED ) {
> > +		            $blogs = new Blogs();
> > +	    	        $blogInfo = $article->getBlogInfo();
> > +	        	    $blogInfo->setTotalPosts( 
> $blogInfo->getTotalPosts()
> > - 1 );
> > +	            	$blogs->updateBlog( $blogInfo );
> > +	            }
> > +
> >              	$article->setStatus( POST_STATUS_DELETED );
> >              	$this->updateArticle( $article );
> >              }
> >
> > -			// update the blog counters
> > -			if( $article->getStatus() == 
> POST_STATUS_PUBLISHED ) {
> > -	            $blogs = new Blogs();
> > -    	        $blogInfo = $article->getBlogInfo();
> > -        	    $blogInfo->setTotalPosts( 
> $blogInfo->getTotalPosts()  
> > - 1 );
> > -            	$blogs->updateBlog( $blogInfo );
> > -            }
> > -
> >              return true;
> >          }
> >  		
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list