forked from GNUsocial/gnu-social
Ticket #2441: fix deletion of avatars when a profile is deleted.
Code was doing a batch call to $avatar->delete() which fails to properly engage the file deletion code. Calling the existing profile->delete_avatars() function deletes them individually, which makes it all work nice again.
This commit is contained in:
parent
d961925874
commit
4b01dd8b2e
@ -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();
|
||||||
@ -643,9 +651,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));
|
||||||
|
Loading…
Reference in New Issue
Block a user