[pLog-svn] r3908 - plog/trunk/class/dao
Oscar Renalias
oscar at renalias.net
Sat Sep 2 17:42:37 GMT 2006
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
>
More information about the pLog-svn
mailing list