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

Oscar Renalias oscar at renalias.net
Wed Mar 22 06:45:37 GMT 2006


Yes, I think this is correct.

Oscar

On 22 Mar 2006, at 08:09, mark at devel.lifetype.net wrote:

> Author: mark
> Date: 2006-03-22 06:09:01 +0000 (Wed, 22 Mar 2006)
> New Revision: 3093
>
> Modified:
>    plog/trunk/class/dao/articles.class.php
> Log:
> Fix a error if the globalArticleCategory is a null object. Oscar I  
> need you help to review this.
>
> Modified: plog/trunk/class/dao/articles.class.php
> ===================================================================
> --- plog/trunk/class/dao/articles.class.php	2006-03-21 15:19:46 UTC  
> (rev 3092)
> +++ plog/trunk/class/dao/articles.class.php	2006-03-22 06:09:01 UTC  
> (rev 3093)
> @@ -744,15 +744,21 @@
>  			include_once( PLOG_CLASS_PATH."class/dao/ 
> globalarticlecategories.class.php" );
>  			$cats = new GlobalArticleCategories();
>  			$artCategory = $article->getGlobalCategory();
> -			$artCategory->setNumArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$artCategory->getId 
> ()));
> -			$artCategory->setNumActiveArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$artCategory->getId 
> ()." AND status = ".POST_STATUS_PUBLISHED ));
> -			$cats->updateGlobalArticleCategory( $artCategory );
>  			
> +			if ($artCategory) {
> +				$artCategory->setNumArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$artCategory->getId 
> ()));
> +				$artCategory->setNumActiveArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$artCategory->getId 
> ()." AND status = ".POST_STATUS_PUBLISHED ));
> +				$cats->updateGlobalArticleCategory( $artCategory );
> +			}
> +			
>  			if( $oldArticle ) {
>  				$oldCategory = $oldArticle->getGlobalCategory();
> -				$oldCategory->setNumArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$oldCategory->getId 
> ()));
> -				$oldCategory->setNumActiveArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$oldCategory->getId 
> ()." AND status = ".POST_STATUS_PUBLISHED ));
> -				$cats->updateGlobalArticleCategory( $oldCategory );				
> +				if ($oldCategory)
> +				{
> +					$oldCategory->setNumArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$oldCategory->getId 
> ()));
> +					$oldCategory->setNumActiveArticles( $this->getNumItems( $this- 
> >getPrefix()."articles", "global_category_id = ".$oldCategory->getId 
> ()." AND status = ".POST_STATUS_PUBLISHED ));
> +					$cats->updateGlobalArticleCategory( $oldCategory );
> +				}		
>  			}
>  			
>  			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