From eea94aaf672496dde1293e20cf7da2a18c25a04f Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 1 Aug 2015 15:41:57 -0700 Subject: [PATCH] Update XHProf for handleRequest Summary: Updates XHProf for handleRequest Test Plan: Use XHProf Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13770 --- .../PhabricatorXHProfProfileController.php | 12 +++--------- .../PhabricatorXHProfSampleListController.php | 18 ++++++++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php index 7f3b155cdd..85815d8589 100644 --- a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php +++ b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php @@ -3,22 +3,16 @@ final class PhabricatorXHProfProfileController extends PhabricatorXHProfController { - private $phid; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->phid = $data['phid']; - } - - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { + $phid = $request->getURIData('phid'); $file = id(new PhabricatorFileQuery()) ->setViewer($request->getUser()) - ->withPHIDs(array($this->phid)) + ->withPHIDs(array($phid)) ->executeOne(); if (!$file) { return new Aphront404Response(); diff --git a/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php b/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php index 98f20436e4..65ca5593f3 100644 --- a/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php +++ b/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php @@ -3,24 +3,22 @@ final class PhabricatorXHProfSampleListController extends PhabricatorXHProfController { - private $view; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->view = idx($data, 'view', 'all'); - } + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $view = $request->getURIData('view'); - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + if (!$view) { + $view = 'all'; + } $pager = new PHUIPagerView(); $pager->setOffset($request->getInt('page')); - switch ($this->view) { + switch ($view) { case 'sampled': $clause = 'sampleRate > 0'; $show_type = false; @@ -78,7 +76,7 @@ final class PhabricatorXHProfSampleListController $item->addIcon( 'none', - phabricator_datetime($sample->getDateCreated(), $user)); + phabricator_datetime($sample->getDateCreated(), $viewer)); $list->addItem($item); }