Delete the photo entries when a user or contact is removed
This commit is contained in:
parent
cbdaf6298a
commit
7990d08ad6
2 changed files with 6 additions and 2 deletions
|
@ -22,6 +22,7 @@
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +52,8 @@ class ExpireAndRemoveUsers
|
||||||
DBA::delete('contact', ['nurl' => $self['nurl'], 'self' => false]);
|
DBA::delete('contact', ['nurl' => $self['nurl'], 'self' => false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Photo::delete(['uid' => $user['uid']]);
|
||||||
|
|
||||||
DBA::delete('user', ['uid' => $user['uid']]);
|
DBA::delete('user', ['uid' => $user['uid']]);
|
||||||
}
|
}
|
||||||
DBA::close($users);
|
DBA::close($users);
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
use Friendica\Model\Photo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes orphaned data from deleted contacts
|
* Removes orphaned data from deleted contacts
|
||||||
|
@ -33,7 +33,7 @@ class RemoveContact {
|
||||||
public static function execute($id) {
|
public static function execute($id) {
|
||||||
|
|
||||||
// Only delete if the contact is to be deleted
|
// Only delete if the contact is to be deleted
|
||||||
$contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true]);
|
$contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true, 'id' => $id]);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ class RemoveContact {
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
} while (Item::exists($condition));
|
} while (Item::exists($condition));
|
||||||
|
|
||||||
|
Photo::delete(['uid' => $contact['uid'], 'contact-id' => $id]);
|
||||||
DBA::delete('contact', ['id' => $id]);
|
DBA::delete('contact', ['id' => $id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue