[pLog-svn] r2001 - plog/branches/plog-1.0.1/class/action

jondaley at devel.plogworld.net jondaley at devel.plogworld.net
Fri May 13 04:17:44 GMT 2005


Author: jondaley
Date: 2005-05-13 04:17:43 +0000 (Fri, 13 May 2005)
New Revision: 2001

Modified:
   plog/branches/plog-1.0.1/class/action/viewarticleaction.class.php
Log:
added new updatereferrer methods depending on whether we have an article, a slug or an id.  Also, update referrer even when cached, if config option is set to update article reads, figure they also want referrers updated.  We could add another config option if people wanted it.

Modified: plog/branches/plog-1.0.1/class/action/viewarticleaction.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/action/viewarticleaction.class.php	2005-05-13 04:12:04 UTC (rev 2000)
+++ plog/branches/plog-1.0.1/class/action/viewarticleaction.class.php	2005-05-13 04:17:43 UTC (rev 2001)
@@ -60,13 +60,28 @@
 		
 		/**
 		 * @private
-		 * updates the article referrers
+		 * updates the article referrers given an article
 		 */
-		function _updateArticleReferrers( $article )
-		{
+		function _updateArticleReferrers($article){
+			$this->_updateArticleReferrersById($article->getId());
+		}
+		/**
+		 * @private
+		 * updates the article referrers given an id
+		 */
+		function _updateArticleReferrersById($articleId){
 			$referrers = new Referers();
-			$referrers->addReferer( $_SERVER['HTTP_REFERER'], $article->getId(), $this->_blogInfo->getId());
+			$referrers->addReferer( $_SERVER['HTTP_REFERER'], 
+									$articleId, $this->_blogInfo->getId());
 		}
+		/**
+		 * @private
+		 * updates the article referrers, given a slug
+		 */
+		function _updateArticleReferrersByTitle($slug){
+			$id = $this->articles->getArticleIdFromName($slug);
+			$this->_updateArticleReferrersById($id);
+		}
 		
 		/**
 		 * @private
@@ -96,10 +111,14 @@
 														  
 			if( $this->_view->isCached()) {
 				if( $this->_config->getValue( 'update_cached_article_reads', false )) {
-					if( $this->_articleId ) 
-						$this->articles->updateArticleNumReads( $this->_articleId );
-					else
+					if( $this->_articleId ){
+						$this->articles->updateArticleNumReads(	$this->_articleId );
+                        $this->_updateArticleReferrersById( $this->_articleId );
+                    }
+ 					else{
 						$this->articles->updateArticleNumReadsByName( $this->_articleName );
+                        $this->_updateArticleReferrersByTitle($this->_articleName );
+                    }
 				}
 				
 				return true;




More information about the pLog-svn mailing list