From 664507e450964933a765d6970ca5225d5553a482 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 8 Aug 2014 16:21:53 -0700 Subject: [PATCH] Use ManiphestTaskQuery instead of ad-hoc load in Maniphest reports Summary: Fixes T5829. This stuff is old and busted, but keep it working for now. Test Plan: No more fatal when there are recently closed tasks. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5829 Differential Revision: https://secure.phabricator.com/D10201 --- .../controller/ManiphestReportController.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index dd43b2c043..4f4befb456 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -671,9 +671,9 @@ final class ManiphestReportController extends ManiphestController { $open_status_list[] = json_encode((string)$constant); } - $tasks = queryfx_all( + $rows = queryfx_all( $conn_r, - 'SELECT t.* FROM %T t JOIN %T x ON x.objectPHID = t.phid + 'SELECT t.id FROM %T t JOIN %T x ON x.objectPHID = t.phid WHERE t.status NOT IN (%Ls) AND x.oldValue IN (null, %Ls) AND x.newValue NOT IN (%Ls) @@ -687,7 +687,16 @@ final class ManiphestReportController extends ManiphestController { $window_epoch, $window_epoch); - return id(new ManiphestTask())->loadAllFromArray($tasks); + if (!$rows) { + return array(); + } + + $ids = ipull($rows, 'id'); + + return id(new ManiphestTaskQuery()) + ->setViewer($this->getRequest()->getUser()) + ->withIDs($ids) + ->execute(); } /**