[pLog-svn] r6456 - plog/trunk/class/gallery/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Wed May 14 02:58:19 EDT 2008


Author: mark
Date: 2008-05-14 02:58:19 -0400 (Wed, 14 May 2008)
New Revision: 6456

Modified:
   plog/trunk/class/gallery/dao/galleryalbums.class.php
Log:
Re-implement deleteUserAlbums, this way will get better performance.

Modified: plog/trunk/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbums.class.php	2008-05-11 11:18:33 UTC (rev 6455)
+++ plog/trunk/class/gallery/dao/galleryalbums.class.php	2008-05-14 06:58:19 UTC (rev 6456)
@@ -300,7 +300,7 @@
             		
             $this->delete( "id", $albumId );
             $this->_cache->removeData( $album->getOwnerId(), DaoCacheConstants::CACHE_USERALBUMS );
-            $this->_cache->removeData( $album->getOwnerId(), DaoCacheConstants::CACHE_USERALBUMS_NESTED );            
+            $this->_cache->removeData( $album->getOwnerId(), DaoCacheConstants::CACHE_USERALBUMS_NESTED );
             //$this->delete( "parent_id", $album->getId());
             
             // update the counters
@@ -321,13 +321,17 @@
         function deleteUserAlbums( $ownerId )
         {
             $userAlbums = $this->getUserAlbums( $ownerId, false, -1);
-
-            // remove resources belong to the owner one by one
-            foreach( $userAlbums as $album ) {
-                $this->deleteAlbum( $album->getId(), $album->getOwnerId() );
-            }
-
-            return true;
+            
+            if( $this->delete( "owner_id", $ownerId ) )
+            {
+	            // remove resources belong to the owner one by one
+	            foreach( $userAlbums as $album ) {
+					$this->_cache->removeData( $album->getOwnerId(), DaoCacheConstants::CACHE_USERALBUMS );
+            		$this->_cache->removeData( $album->getOwnerId(), DaoCacheConstants::CACHE_USERALBUMS_NESTED );
+	            }
+            	return true;
+            } else
+            	return false;
         }
 
 		/**
@@ -441,4 +445,4 @@
             return $album;
 		}
     }
-?>
\ No newline at end of file
+?>



More information about the pLog-svn mailing list