From 92fc628b042a1d7103461a978cc078826cf5f0b4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 27 Jun 2016 17:07:03 -0700 Subject: [PATCH] Better destruction of PhameBlog, BadgesBadge Summary: Allows proper destruction of Badge Awards and Phame Posts. Test Plan: bin/remove destroy PHID... Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16182 --- .../badges/storage/PhabricatorBadgesBadge.php | 2 +- src/applications/phame/storage/PhameBlog.php | 8 +++++--- src/applications/phame/storage/PhamePost.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/applications/badges/storage/PhabricatorBadgesBadge.php b/src/applications/badges/storage/PhabricatorBadgesBadge.php index 91ed3cf34d..be83c8404f 100644 --- a/src/applications/badges/storage/PhabricatorBadgesBadge.php +++ b/src/applications/badges/storage/PhabricatorBadgesBadge.php @@ -186,7 +186,7 @@ final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO ->execute(); foreach ($awards as $award) { - $engine->destroyObjectPermanently($award); + $engine->destroyObject($award); } $this->openTransaction(); diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index 6d9c51071a..23ab671552 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -322,10 +322,12 @@ final class PhameBlog extends PhameDAO $this->openTransaction(); - $posts = id(new PhamePost()) - ->loadAllWhere('blogPHID = %s', $this->getPHID()); + $posts = id(new PhamePostQuery()) + ->setViewer($engine->getViewer()) + ->withBlogPHIDs(array($this->getPHID())) + ->execute(); foreach ($posts as $post) { - $post->delete(); + $engine->destroyObject($post); } $this->delete(); diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index 2d8fc887c5..8078c5055c 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -258,15 +258,15 @@ final class PhamePost extends PhameDAO return $timeline; } + /* -( PhabricatorDestructibleInterface )----------------------------------- */ + public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { $this->openTransaction(); - $this->delete(); - $this->saveTransaction(); }