From 2e4b5b45a20b1ce382712825a57036a063bcf6b2 Mon Sep 17 00:00:00 2001 From: Josh Cox Date: Thu, 15 Sep 2016 20:40:46 -0400 Subject: [PATCH] Update DarkConsole for handleRequest Summary: Ref T8628 Test Plan: Updated DarkConsoleDataController and observed that the darkconsole still works as expected Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley, yelirekim Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D16570 --- .../controller/DarkConsoleDataController.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/applications/console/controller/DarkConsoleDataController.php b/src/applications/console/controller/DarkConsoleDataController.php index 6582189f48..cae183fbae 100644 --- a/src/applications/console/controller/DarkConsoleDataController.php +++ b/src/applications/console/controller/DarkConsoleDataController.php @@ -2,8 +2,6 @@ final class DarkConsoleDataController extends PhabricatorController { - private $key; - public function shouldRequireLogin() { return !PhabricatorEnv::getEnvConfig('darkconsole.always-on'); } @@ -16,19 +14,15 @@ final class DarkConsoleDataController extends PhabricatorController { return true; } - public function willProcessRequest(array $data) { - $this->key = $data['key']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $key = $request->getURIData('key'); $cache = new PhabricatorKeyValueDatabaseCache(); $cache = new PhutilKeyValueCacheProfiler($cache); $cache->setProfiler(PhutilServiceProfiler::getInstance()); - $result = $cache->getKey('darkconsole:'.$this->key); + $result = $cache->getKey('darkconsole:'.$key); if (!$result) { return new Aphront400Response(); } @@ -43,7 +37,7 @@ final class DarkConsoleDataController extends PhabricatorController { return new Aphront400Response(); } - if ($result['user'] != $user->getPHID()) { + if ($result['user'] != $viewer->getPHID()) { return new Aphront400Response(); }