[pLog-svn] r3335 - in plog/trunk/class/dao: . userdata
Oscar Renalias
oscar at renalias.net
Fri May 5 05:58:44 GMT 2006
This fix is technically correct, but why is
PlogUserDataProvider::deleteUser (by the way, it's probably a good
time to rename that class to LifeTypeUserDataProvider :)) doing so
much? Currently it is deleting blogs, albums, resources, etc, but
this all should be moved to Users::deleteUser. Providers only deal
with users, nothing else. So the right way is that Users::deleteUser
first calls the provider to delete the user and then, if the
operation succeeds, everyhing else (blogs, resources, etc) is deleted.
On 5 May 2006, at 07:05, mark at devel.lifetype.net wrote:
> Author: mark
> Date: 2006-05-05 04:05:32 +0000 (Fri, 05 May 2006)
> New Revision: 3335
>
> Modified:
> plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
> plog/trunk/class/dao/users.class.php
> Log:
> Fixed the purgeUsers() that Glen reported in mailing list.
>
> Modified: plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
> ===================================================================
> --- plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
> 2006-05-05 03:08:32 UTC (rev 3334)
> +++ plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
> 2006-05-05 04:05:32 UTC (rev 3335)
> @@ -19,7 +19,7 @@
> */
> function PlogUserDataProvider( $providerConfig )
> {
> - $this->BaseUserDataProvider( $providerConfig, true );
> + $this->BaseUserDataProvider( $providerConfig );
>
> $this->table = $this->getPrefix()."users";
> }
> @@ -245,7 +245,7 @@
> function deleteUser( $userId )
> {
> // first, delete all of his/her permissions
> - if( $this->delete( $userId )) {
> + if( $this->delete( "id", $userId )) {
> include_once( PLOG_CLASS_PATH."class/dao/
> userpermissions.class.php" );
> $perms = new UserPermissions();
> $perms->revokeUserPermissions( $userId );
> @@ -284,6 +284,7 @@
> $r_result->Close();
>
> // now delete album
> + include_once( PLOG_CLASS_PATH."class/gallery/dao/
> galleryalbums.class.php" );
> $galleryalbums = new GalleryAlbums();
> $al_query = "SELECT ga.id AS id, ga.owner_id as owner_id
> FROM ".$this->getPrefix()."gallery_albums AS
> ga, ".$this->getPrefix()."blogs AS b, ".$this->getPrefix()."users AS u
> @@ -301,6 +302,7 @@
> // check if the deleted user owns any blog, if they
> does, delete the blog
> // the deleteBlog function will take care of deleting
> articles etc...
> include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
> + include_once( PLOG_CLASS_PATH."class/gallery/dao/
> galleryresourcestorage.class.php" );
> $blogs = new Blogs();
> $userfolder = new GalleryResourceStorage();
>
>
> Modified: plog/trunk/class/dao/users.class.php
> ===================================================================
> --- plog/trunk/class/dao/users.class.php 2006-05-05 03:08:32 UTC
> (rev 3334)
> +++ plog/trunk/class/dao/users.class.php 2006-05-05 04:05:32 UTC
> (rev 3335)
> @@ -156,7 +156,15 @@
> function deleteUser( $userId )
> {
> return( $this->_provider->deleteUser( $userId ));
> - }
> + }
> +
> + /**
> + * Purge users from the database
> + */
> + function purgeUsers()
> + {
> + return( $this->_provider->purgeUsers());
> + }
>
> /**
> * returns the total number of users
>
> _______________________________________________
> 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