Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x

This commit is contained in:
Brion Vibber 2010-11-19 12:44:43 -08:00
commit 407663fb40

View File

@ -125,6 +125,14 @@ class Profile extends Memcached_DataObject
return $avatar; return $avatar;
} }
/**
* Delete attached avatars for this user from the database and filesystem.
* This should be used instead of a batch delete() to ensure that files
* get removed correctly.
*
* @param boolean $original true to delete only the original-size file
* @return <type>
*/
function delete_avatars($original=true) function delete_avatars($original=true)
{ {
$avatar = new Avatar(); $avatar = new Avatar();
@ -664,9 +672,11 @@ class Profile extends Memcached_DataObject
$this->_deleteMessages(); $this->_deleteMessages();
$this->_deleteTags(); $this->_deleteTags();
$this->_deleteBlocks(); $this->_deleteBlocks();
$this->delete_avatars();
$related = array('Avatar', // Warning: delete() will run on the batch objects,
'Reply', // not on individual objects.
$related = array('Reply',
'Group_member', 'Group_member',
); );
Event::handle('ProfileDeleteRelated', array($this, &$related)); Event::handle('ProfileDeleteRelated', array($this, &$related));