[pLog-svn] r3340 - in plog/trunk/class: action/admin daodao/userdata

Mark Wu markplace at gmail.com
Fri May 5 12:26:49 GMT 2006


Hi Jon:

I say it ugly, because we always put those cache clearing code in action,
instead of DAO it self ...

So, "Blogs" is the only one DAO that I put cache clearing code ....

And, as you said, it is make sense that I put those codes there ....

I just hope that does not break our coding guide line :p

(If I put those  cache clearing code in admin cleanup action, it will make
code more ugly ...)

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
> Sent: Friday, May 05, 2006 8:21 PM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r3340 - in plog/trunk/class: 
> action/admin daodao/userdata
> 
>  	I don't understand why this is an "ugly hack"?  It 
> seems reasonable that the blogs should be able to delete 
> their own cache.
> 
> On Fri, 5 May 2006, mark at devel.lifetype.net wrote:
> 
> > Author: mark
> > Date: 2006-05-05 07:53:40 +0000 (Fri, 05 May 2006) New 
> Revision: 3340
> >
> > Modified:
> >   plog/trunk/class/action/admin/admincleanupaction.class.php
> >   plog/trunk/class/dao/blogs.class.php
> >   plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php
> > Log:
> > Remove the cache when we delete blog and users ...
> >
> > ** One ugly hack needed: we have to put the resetBlogCache in blogs 
> > DAO, or I have no idea how to delete those cache after we 
> delete those 
> > blogs.. (unless we use resetAllCache, but it is a stupid 
> choice, if we 
> > have 10000 blogs ...)
> >
> > Modified: plog/trunk/class/action/admin/admincleanupaction.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/action/admin/admincleanupaction.class.php	
> 2006-05-05 06:53:39 UTC (rev 3339)
> > +++ 
> plog/trunk/class/action/admin/admincleanupaction.class.php	
> 2006-05-05 07:53:40 UTC (rev 3340)
> > @@ -102,10 +102,14 @@
> > 				$result = $this->cleanupPosts();
> > 			}
> > 			elseif( $this->_op == "cleanupUsers" ) {
> > +				include_once( 
> > +PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
> > 				$result = $this->cleanupUsers();
> > +				CacheControl::resetSummaryCache();
> > 			}
> > 			elseif( $this->_op == "cleanupBlogs" ) {
> > +				include_once( 
> > +PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
> > 				$result = $this->cleanupBlogs();
> > +				CacheControl::resetSummaryCache();
> > 			}
> >
> > 			// create the view and see if there was 
> a success message
> >
> > Modified: plog/trunk/class/dao/blogs.class.php
> > ===================================================================
> > --- plog/trunk/class/dao/blogs.class.php	2006-05-05 
> 06:53:39 UTC (rev 3339)
> > +++ plog/trunk/class/dao/blogs.class.php	2006-05-05 
> 07:53:40 UTC (rev 3340)
> > @@ -324,7 +324,10 @@
> >             $blog = $this->getBlogInfo( $blogId );
> > 			$this->updateBlogCategoriesLink( $blog );
> >
> > -            // and finally, delete the blog
> > +            // and finally, remove the cache and delete the blog
> > +			$this->_cache->removeData( 
> $blog->getCustomDomain(), CACHE_BLOGIDBYDOMAIN );
> > +			$this->_cache->removeData( 
> $blog->getMangledBlogName(), CACHE_BLOGIDBYNAME );
> > +			$this->_cache->removeData( 
> $blog->getId(), CACHE_BLOGINFOS );
> >             return( $this->delete( "id", $blogId ));
> >         }
> >
> > @@ -340,6 +343,9 @@
> >         	foreach( $disabledBlogs as $blog ) {
> >         		$blogId = $blog->getId();
> >         		$this->deleteBlog( $blogId );
> > +        		// This is a ugly hack, or there is no 
> place the clean these deleted blogs' cache
> > +        		include_once( 
> PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
> > +        		CacheControl::resetBlogCache( $blogId, false );
> >         	}
> >
> >         	return true;
> >
> > Modified: 
> > plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php
> > ===================================================================
> > --- 
> plog/trunk/class/dao/userdata/lifetypeuserdataprovider.cl
> ass.php	2006-05-05 06:53:39 UTC (rev 3339)
> > +++ 
> plog/trunk/class/dao/userdata/lifetypeuserdataprovider.cl
> ass.php	2006-05-05 07:53:40 UTC (rev 3340)
> > @@ -245,11 +245,13 @@
> >         function deleteUser( $userId )
> >         {
> >             // first, delete all of his/her permissions
> > +            $user = $this->getUserInfoFromId( $userId );
> >             if( $this->delete( "id", $userId )) {
> > 	    		include_once( 
> PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
> >     	        $perms = new UserPermissions();
> >         	    $perms->revokeUserPermissions( $userId );
> > -        	    $this->_cache->removeData( $userId, 
> CACHE_USERINFO );
> > +        	    $this->_cache->removeData( $userId, 
> CACHE_USERINFO );
> > +        	    $this->_cache->removeData( $user->getUsername(), 
> > + CACHE_USERIDBYNAME );
> >             }
> >             else
> >             	return( false );
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> 
> **************************************
> Jon Daley
> http://jon.limedaley.com/
> 
> The meanness of another merely provides an excuse to hate,
>    but never a valid reason.
> -- Joseph Girzone
> _______________________________________________
> 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