1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Destroy notifications properly from bin/remove destroy

Summary: Fixes T8237. This table is unusual and doesn't have an `id` column, so `delete()` doesn't actually know how to delete records and fails.

Test Plan:
  - Used `bin/remove destroy` to destroy an object with notifications, as per T8237.
  - Applied patch.
  - Used `bin/remove destroy` to get a clean delete.
  - Verified related notifications vanished from notification menu.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8237

Differential Revision: https://secure.phabricator.com/D12907
This commit is contained in:
epriestley 2015-05-18 12:29:32 -07:00
parent 107d6db1e8
commit 4250719d10

View file

@ -116,13 +116,14 @@ final class PhabricatorDestructionEngine extends Phobject {
}
private function destroyNotifications($object_phid) {
$notifications = id(new PhabricatorFeedStoryNotification())->loadAllWhere(
'primaryObjectPHID = %s',
$object_phid);
$table = id(new PhabricatorFeedStoryNotification());
$conn_w = $table->establishConnection('w');
foreach ($notifications as $notification) {
$notification->delete();
}
queryfx(
$conn_w,
'DELETE FROM %T WHERE primaryObjectPHID = %s',
$table->getTableName(),
$object_phid);
}
}