[pLog-svn] r6119 - plog/branches/lifetype-1.2/class/action

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Dec 17 14:06:47 EST 2007


Author: jondaley
Date: 2007-12-17 14:06:46 -0500 (Mon, 17 Dec 2007)
New Revision: 6119

Modified:
   plog/branches/lifetype-1.2/class/action/viewarticleaction.class.php
Log:
don't try to update referrers or numreads by title if we don't have a title

Modified: plog/branches/lifetype-1.2/class/action/viewarticleaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/viewarticleaction.class.php	2007-12-17 19:06:07 UTC (rev 6118)
+++ plog/branches/lifetype-1.2/class/action/viewarticleaction.class.php	2007-12-17 19:06:46 UTC (rev 6119)
@@ -147,13 +147,16 @@
 				if( $this->_config->getValue( 'update_cached_article_reads', false )) {
 					$articles = new Articles();
 					if( $this->_articleId ){
-						$articles->updateArticleNumReads(	$this->_articleId );
+						$articles->updateArticleNumReads( $this->_articleId );
                         $this->_updateArticleReferrersById( $this->_articleId );
                     }
- 					else{
+ 					else if($this->_articleName){
 						$articles->updateArticleNumReadsByName( $this->_articleName );
                         $this->_updateArticleReferrersByTitle($this->_articleName );
                     }
+                    else{
+                            // print "Can't update referrers without an id or a name...";
+                    }
 				}
 				
 				$this->setCommonData();
@@ -198,8 +201,8 @@
 		
             // fetch the article
             // the article identifier can be either its internal id number or its mangled topic
-			$articles = new Articles();
             if( $this->_articleId ) { 
+                $articles = new Articles();
                 $article  = $articles->getBlogArticle( $this->_articleId, 
                                                        $this->_blogInfo->getId(), 
                                                        false, 
@@ -208,7 +211,8 @@
                                                        $this->_userId,
                                                        POST_STATUS_PUBLISHED,
                                                        $this->_maxDate);
-            } else {
+            } else if($this->_articleName){
+                $articles = new Articles();
                 $article  = $articles->getBlogArticleByTitle( $this->_articleName, 
                                                               $this->_blogInfo->getId(), 
                                                               false,
@@ -218,6 +222,10 @@
                                                               POST_STATUS_PUBLISHED,
                                                               $this->_maxDate);
             }
+            else{
+                    // print "No name or ID - fetch by date/category/etc?";
+                $article = null;
+            }
 
             // if the article id doesn't exist, cancel the whole thing...
             if( !$article ) {



More information about the pLog-svn mailing list