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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Apr 25 05:01:20 EDT 2013


Author: jondaley
Date: 2013-04-25 05:01:20 -0400 (Thu, 25 Apr 2013)
New Revision: 7200

Modified:
   plog/branches/lifetype-1.2/class/action/addcommentaction.class.php
Log:
don't clear the cache if the comment was a spam or moderated, etc.

Modified: plog/branches/lifetype-1.2/class/action/addcommentaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/addcommentaction.class.php	2013-04-25 08:43:42 UTC (rev 7199)
+++ plog/branches/lifetype-1.2/class/action/addcommentaction.class.php	2013-04-25 09:01:20 UTC (rev 7200)
@@ -239,12 +239,12 @@
 			$this->notifyEvent( EVENT_POST_COMMENT_ADD, Array( "comment" => &$comment ));
 
 			//
-			// clear caches. This should be done in a more granular way, because right now
-			// we're either removing *all* of them or none. I guess we should only remove the 
-			// cache whose identifier corresponds with the blog and article that we just removed, 
-			// but let's leave it as it is for the time being...
-			//
-			CacheControl::resetBlogCache( $this->_blogInfo->getId());
+			// clear caches for this blog if the comment has been published
+            // TODO: we don't need to clear the entire blog, if the blog
+            // isn't using a plugin like RecentComments where each post
+            // cares about whether a comment was made on another post
+            if($comment->getStatus() == COMMENT_STATUS_NONSPAM)
+                CacheControl::resetBlogCache( $this->_blogInfo->getId());
 			
 			// clean up the request, there's a parameter called 'userName' also used by
 			// ViewArticleAction but that doesn't have the same meaning so we better remove it



More information about the pLog-svn mailing list