1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Decouple some aspects of request routing and construction

Summary:
Ref T5702. This is a forward-looking change which provides some very broad API improvements but does not implement them. In particular:

  - Controllers no longer require `$request` to construct. This is mostly for T5702, directly, but simplifies things in general. Instead, we call `setRequest()` before using a controller. Only a small number of sites activate controllers, so this is less code overall, and more consistent with most constructors not having any parameters or effects.
  - `$request` now offers `getURIData($key, ...)`. This is an alternate way of accessing `$data` which is currently only available on `willProcessRequest(array $data)`. Almost all controllers which implement this method do so in order to read one or two things out of the URI data. Instead, let them just read this data directly when processing the request.
  - Introduce `handleRequest(AphrontRequest $request)` and deprecate (very softly) `processRequest()`. The majority of `processRequest()` calls begin `$request = $this->getRequest()`, which is avoided with the more practical signature.
  - Provide `getViewer()` on `$request`, and a convenience `getViewer()` on `$controller`. This fixes `$viewer = $request->getUser();` into `$viewer = $request->getViewer();`, and converts the `$request + $viewer` two-liner into a single `$this->getViewer()`.

Test Plan:
  - Browsed around in general.
  - Hit special controllers (redirect, 404).
  - Hit AuditList controller (uses new style).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5702

Differential Revision: https://secure.phabricator.com/D10698
This commit is contained in:
epriestley 2014-10-17 05:01:40 -07:00
parent 934eea2ef2
commit 9352c76e81
58 changed files with 111 additions and 117 deletions

View file

@ -28,25 +28,45 @@ abstract class AphrontController extends Phobject {
return $response; return $response;
} }
abstract public function processRequest(); public function handleRequest(AphrontRequest $request) {
if (method_exists($this, 'processRequest')) {
return $this->processRequest();
}
final public function __construct(AphrontRequest $request) { throw new PhutilMethodNotImplementedException(
pht(
'Controllers must implement either handleRequest() (recommended) '.
'or processRequest() (deprecated).'));
}
final public function setRequest(AphrontRequest $request) {
$this->request = $request; $this->request = $request;
return $this;
} }
final public function getRequest() { final public function getRequest() {
if (!$this->request) {
throw new Exception(pht('Call setRequest() before getRequest()!'));
}
return $this->request; return $this->request;
} }
final public function getViewer() {
return $this->getRequest()->getViewer();
}
final public function delegateToController(AphrontController $controller) { final public function delegateToController(AphrontController $controller) {
$request = $this->getRequest();
$controller->setDelegatingController($this); $controller->setDelegatingController($this);
$controller->setRequest($request);
$application = $this->getCurrentApplication(); $application = $this->getCurrentApplication();
if ($application) { if ($application) {
$controller->setCurrentApplication($application); $controller->setCurrentApplication($application);
} }
return $controller->processRequest(); return $controller->handleRequest($request);
} }
final public function setCurrentApplication( final public function setCurrentApplication(

View file

@ -25,12 +25,26 @@ final class AphrontRequest {
private $requestData; private $requestData;
private $user; private $user;
private $applicationConfiguration; private $applicationConfiguration;
private $uriData;
final public function __construct($host, $path) { final public function __construct($host, $path) {
$this->host = $host; $this->host = $host;
$this->path = $path; $this->path = $path;
} }
final public function setURIMap(array $uri_data) {
$this->uriData = $uri_data;
return $this;
}
final public function getURIMap() {
return $this->uriData;
}
final public function getURIData($key, $default = null) {
return idx($this->uriData, $key, $default);
}
final public function setApplicationConfiguration( final public function setApplicationConfiguration(
$application_configuration) { $application_configuration) {
$this->applicationConfiguration = $application_configuration; $this->applicationConfiguration = $application_configuration;
@ -476,6 +490,10 @@ final class AphrontRequest {
return $this->user; return $this->user;
} }
final public function getViewer() {
return $this->user;
}
final public function getRequestURI() { final public function getRequestURI() {
$get = $_GET; $get = $_GET;
unset($get['__path__']); unset($get['__path__']);

View file

@ -239,7 +239,7 @@ abstract class AphrontApplicationConfiguration {
$request = $this->getRequest(); $request = $this->getRequest();
$controller = newv($controller_class, array($request)); $controller = newv($controller_class, array());
if ($current_application) { if ($current_application) {
$controller->setCurrentApplication($current_application); $controller->setCurrentApplication($current_application);
} }

View file

@ -152,13 +152,14 @@ class AphrontDefaultApplicationConfiguration
// //
// Possibly we should add a header here like "you need to login to see // Possibly we should add a header here like "you need to login to see
// the thing you are trying to look at". // the thing you are trying to look at".
$login_controller = new PhabricatorAuthStartController($request); $login_controller = new PhabricatorAuthStartController();
$login_controller->setRequest($request);
$auth_app_class = 'PhabricatorAuthApplication'; $auth_app_class = 'PhabricatorAuthApplication';
$auth_app = PhabricatorApplication::getByClass($auth_app_class); $auth_app = PhabricatorApplication::getByClass($auth_app_class);
$login_controller->setCurrentApplication($auth_app); $login_controller->setCurrentApplication($auth_app);
return $login_controller->processRequest(); return $login_controller->handleRequest($request);
} }
$list = $ex->getMoreInfo(); $list = $ex->getMoreInfo();
@ -272,12 +273,12 @@ class AphrontDefaultApplicationConfiguration
} }
public function build404Controller() { public function build404Controller() {
return array(new Phabricator404Controller($this->getRequest()), array()); return array(new Phabricator404Controller(), array());
} }
public function buildRedirectController($uri, $external) { public function buildRedirectController($uri, $external) {
return array( return array(
new PhabricatorRedirectController($this->getRequest()), new PhabricatorRedirectController(),
array( array(
'uri' => $uri, 'uri' => $uri,
'external' => $external, 'external' => $external,

View file

@ -3,22 +3,13 @@
final class PhabricatorAuditListController final class PhabricatorAuditListController
extends PhabricatorAuditController { extends PhabricatorAuditController {
private $queryKey;
private $name;
private $filterStatus;
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function willProcessRequest(array $data) { public function handleRequest(AphrontRequest $request) {
$this->queryKey = idx($data, 'queryKey'); $controller = id(new PhabricatorApplicationSearchController())
} ->setQueryKey($request->getURIData('queryKey'))
public function processRequest() {
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorCommitSearchEngine()) ->setSearchEngine(new PhabricatorCommitSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -137,11 +137,11 @@ abstract class PhabricatorController extends AphrontController {
if ($this->shouldRequireEnabledUser()) { if ($this->shouldRequireEnabledUser()) {
if ($user->isLoggedIn() && !$user->getIsApproved()) { if ($user->isLoggedIn() && !$user->getIsApproved()) {
$controller = new PhabricatorAuthNeedsApprovalController($request); $controller = new PhabricatorAuthNeedsApprovalController();
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }
if ($user->getIsDisabled()) { if ($user->getIsDisabled()) {
$controller = new PhabricatorDisabledUserController($request); $controller = new PhabricatorDisabledUserController();
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }
} }
@ -166,7 +166,7 @@ abstract class PhabricatorController extends AphrontController {
if (!$this->shouldAllowPartialSessions()) { if (!$this->shouldAllowPartialSessions()) {
if ($user->hasSession() && if ($user->hasSession() &&
$user->getSession()->getIsPartial()) { $user->getSession()->getIsPartial()) {
$login_controller = new PhabricatorAuthFinishController($request); $login_controller = new PhabricatorAuthFinishController();
$this->setCurrentApplication($auth_application); $this->setCurrentApplication($auth_application);
return $this->delegateToController($login_controller); return $this->delegateToController($login_controller);
} }
@ -180,8 +180,7 @@ abstract class PhabricatorController extends AphrontController {
// and require MFA enrollment. // and require MFA enrollment.
$user->updateMultiFactorEnrollment(); $user->updateMultiFactorEnrollment();
if (!$user->getIsEnrolledInMultiFactor()) { if (!$user->getIsEnrolledInMultiFactor()) {
$mfa_controller = new PhabricatorAuthNeedsMultiFactorController( $mfa_controller = new PhabricatorAuthNeedsMultiFactorController();
$request);
$this->setCurrentApplication($auth_application); $this->setCurrentApplication($auth_application);
return $this->delegateToController($mfa_controller); return $this->delegateToController($mfa_controller);
} }
@ -198,7 +197,7 @@ abstract class PhabricatorController extends AphrontController {
// If this controller isn't public, and the user isn't logged in, require // If this controller isn't public, and the user isn't logged in, require
// login. // login.
if (!$allow_public && !$user->isLoggedIn()) { if (!$allow_public && !$user->isLoggedIn()) {
$login_controller = new PhabricatorAuthStartController($request); $login_controller = new PhabricatorAuthStartController();
$this->setCurrentApplication($auth_application); $this->setCurrentApplication($auth_application);
return $this->delegateToController($login_controller); return $this->delegateToController($login_controller);
} }
@ -206,7 +205,7 @@ abstract class PhabricatorController extends AphrontController {
if ($user->isLoggedIn()) { if ($user->isLoggedIn()) {
if ($this->shouldRequireEmailVerification()) { if ($this->shouldRequireEmailVerification()) {
if (!$user->getIsEmailVerified()) { if (!$user->getIsEmailVerified()) {
$controller = new PhabricatorMustVerifyEmailController($request); $controller = new PhabricatorMustVerifyEmailController();
$this->setCurrentApplication($auth_application); $this->setCurrentApplication($auth_application);
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }

View file

@ -22,7 +22,8 @@ final class PhabricatorAccessControlTestCase extends PhabricatorTestCase {
->setApplicationConfiguration($application_configuration) ->setApplicationConfiguration($application_configuration)
->setRequestData(array()); ->setRequestData(array());
$controller = new PhabricatorTestController($request); $controller = new PhabricatorTestController();
$controller->setRequest($request);
$u_public = id(new PhabricatorUser()) $u_public = id(new PhabricatorUser())
->setUsername('public'); ->setUsername('public');

View file

@ -14,8 +14,7 @@ final class PhabricatorCalendarEventListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorCalendarEventSearchEngine()) ->setSearchEngine(new PhabricatorCalendarEventSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNav());

View file

@ -14,8 +14,7 @@ final class PhabricatorConduitListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorConduitSearchEngine()) ->setSearchEngine(new PhabricatorConduitSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorCountdownListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorCountdownSearchEngine()) ->setSearchEngine(new PhabricatorCountdownSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorDashboardListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorDashboardSearchEngine()) ->setSearchEngine(new PhabricatorDashboardSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorDashboardPanelListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorDashboardPanelSearchEngine()) ->setSearchEngine(new PhabricatorDashboardPanelSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class DifferentialRevisionListController extends DifferentialController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DifferentialRevisionSearchEngine()) ->setSearchEngine(new DifferentialRevisionSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -12,7 +12,7 @@ final class DiffusionBrowseMainController extends DiffusionBrowseController {
$grep = $request->getStr('grep'); $grep = $request->getStr('grep');
$find = $request->getStr('find'); $find = $request->getStr('find');
if (strlen($grep) || strlen($find)) { if (strlen($grep) || strlen($find)) {
$controller = new DiffusionBrowseSearchController($request); $controller = new DiffusionBrowseSearchController();
} else { } else {
$results = DiffusionBrowseResultSet::newFromConduit( $results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest( $this->callConduitWithDiffusionRequest(

View file

@ -23,7 +23,7 @@ abstract class DiffusionController extends PhabricatorController {
// "svn checkout". If it is, we jump off into repository serving code to // "svn checkout". If it is, we jump off into repository serving code to
// process the request. // process the request.
if (DiffusionServeController::isVCSRequest($request)) { if (DiffusionServeController::isVCSRequest($request)) {
$serve_controller = id(new DiffusionServeController($request)) $serve_controller = id(new DiffusionServeController())
->setCurrentApplication($this->getCurrentApplication()); ->setCurrentApplication($this->getCurrentApplication());
return $this->delegateToController($serve_controller); return $this->delegateToController($serve_controller);
} }

View file

@ -12,7 +12,7 @@ final class DiffusionLintController extends DiffusionController {
$drequest = $this->diffusionRequest; $drequest = $this->diffusionRequest;
if ($request->getStr('lint') !== null) { if ($request->getStr('lint') !== null) {
$controller = new DiffusionLintDetailsController($request); $controller = new DiffusionLintDetailsController();
$controller->setDiffusionRequest($drequest); $controller->setDiffusionRequest($drequest);
$controller->setCurrentApplication($this->getCurrentApplication()); $controller->setCurrentApplication($this->getCurrentApplication());
return $this->delegateToController($controller); return $this->delegateToController($controller);

View file

@ -14,7 +14,7 @@ final class DiffusionPushLogListController extends DiffusionPushLogController {
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine()) ->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,7 +14,7 @@ final class DiffusionRepositoryListController extends DiffusionController {
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorRepositorySearchEngine()) ->setSearchEngine(new PhabricatorRepositorySearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,7 +14,7 @@ final class DivinerAtomListController extends DivinerController {
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->key) ->setQueryKey($this->key)
->setSearchEngine(new DivinerAtomSearchEngine()) ->setSearchEngine(new DivinerAtomSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,7 +14,7 @@ final class DrydockBlueprintListController extends DrydockBlueprintController {
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockBlueprintSearchEngine()) ->setSearchEngine(new DrydockBlueprintSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class DrydockLeaseListController extends DrydockLeaseController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockLeaseSearchEngine()) ->setSearchEngine(new DrydockLeaseSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class DrydockLogListController extends DrydockLogController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockLogSearchEngine()) ->setSearchEngine(new DrydockLogSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class DrydockResourceListController extends DrydockResourceController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockResourceSearchEngine()) ->setSearchEngine(new DrydockResourceSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PhabricatorFeedListController extends PhabricatorFeedController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorFeedSearchEngine()) ->setSearchEngine(new PhabricatorFeedSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PhabricatorFileListController extends PhabricatorFileController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->key) ->setQueryKey($this->key)
->setSearchEngine(new PhabricatorFileSearchEngine()) ->setSearchEngine(new PhabricatorFileSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PhabricatorFlagListController extends PhabricatorFlagController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorFlagSearchEngine()) ->setSearchEngine(new PhabricatorFlagSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -29,7 +29,7 @@ final class FundBackerListController
} }
} }
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($this->getEngine()) ->setSearchEngine($this->getEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class FundInitiativeListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new FundInitiativeSearchEngine()) ->setSearchEngine(new FundInitiativeSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class HarbormasterBuildableListController extends HarbormasterController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new HarbormasterBuildableSearchEngine()) ->setSearchEngine(new HarbormasterBuildableSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class HarbormasterPlanListController extends HarbormasterPlanController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new HarbormasterBuildPlanSearchEngine()) ->setSearchEngine(new HarbormasterBuildPlanSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class HeraldRuleListController extends HeraldController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new HeraldRuleSearchEngine()) ->setSearchEngine(new HeraldRuleSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -37,8 +37,7 @@ final class HeraldTranscriptListController extends HeraldController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new HeraldTranscriptSearchEngine()) ->setSearchEngine(new HeraldTranscriptSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class LegalpadDocumentListController extends LegalpadController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new LegalpadDocumentSearchEngine()) ->setSearchEngine(new LegalpadDocumentSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNav());

View file

@ -38,7 +38,7 @@ final class LegalpadDocumentSignatureListController extends LegalpadController {
$engine->setDocument($this->document); $engine->setDocument($this->document);
} }
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($engine) ->setSearchEngine($engine)
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNav());

View file

@ -13,8 +13,7 @@ final class PhabricatorMacroListController extends PhabricatorMacroController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->key) ->setQueryKey($this->key)
->setSearchEngine(new PhabricatorMacroSearchEngine()) ->setSearchEngine(new PhabricatorMacroSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorMailingListsListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorMailingListSearchEngine()) ->setSearchEngine(new PhabricatorMailingListSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class ManiphestTaskListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine( ->setSearchEngine(
id(new ManiphestTaskSearchEngine()) id(new ManiphestTaskSearchEngine())

View file

@ -14,8 +14,7 @@ final class PhabricatorApplicationsListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorAppSearchEngine()) ->setSearchEngine(new PhabricatorAppSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -10,8 +10,7 @@ final class PhabricatorNotificationListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorNotificationSearchEngine()) ->setSearchEngine(new PhabricatorNotificationSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorOAuthClientListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorOAuthServerClientSearchEngine()) ->setSearchEngine(new PhabricatorOAuthServerClientSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PassphraseCredentialListController extends PassphraseController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PassphraseCredentialSearchEngine()) ->setSearchEngine(new PassphraseCredentialSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorPasteSearchEngine()) ->setSearchEngine(new PhabricatorPasteSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -18,13 +18,10 @@ final class PhabricatorPeopleListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$this->requireApplicationCapability( $this->requireApplicationCapability(
PeopleBrowseUserDirectoryCapability::CAPABILITY); PeopleBrowseUserDirectoryCapability::CAPABILITY);
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->key) ->setQueryKey($this->key)
->setSearchEngine(new PhabricatorPeopleSearchEngine()) ->setSearchEngine(new PhabricatorPeopleSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -10,8 +10,7 @@ final class PhabricatorPeopleLogsController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorPeopleLogSearchEngine()) ->setSearchEngine(new PhabricatorPeopleLogSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PholioMockListController extends PholioController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PholioMockSearchEngine()) ->setSearchEngine(new PholioMockSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -56,7 +56,7 @@ final class PhortuneCartListController
return new Aphront404Response(); return new Aphront404Response();
} }
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($engine) ->setSearchEngine($engine)
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -38,7 +38,7 @@ final class PhortuneChargeListController
return new Aphront404Response(); return new Aphront404Response();
} }
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($engine) ->setSearchEngine($engine)
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhortuneMerchantListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhortuneMerchantSearchEngine()) ->setSearchEngine(new PhortuneMerchantSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PhrequentListController extends PhrequentController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhrequentSearchEngine()) ->setSearchEngine(new PhrequentSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhrictionListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhrictionSearchEngine()) ->setSearchEngine(new PhrictionSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -13,8 +13,7 @@ final class PonderQuestionListController extends PonderController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PonderQuestionSearchEngine()) ->setSearchEngine(new PonderQuestionSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorProjectListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorProjectSearchEngine()) ->setSearchEngine(new PhabricatorProjectSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -28,7 +28,7 @@ final class ReleephBranchViewController extends ReleephBranchController
} }
$this->setBranch($branch); $this->setBranch($branch);
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setPreface($this->renderPreface()) ->setPreface($this->renderPreface())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($this->getSearchEngine()) ->setSearchEngine($this->getSearchEngine())

View file

@ -13,8 +13,7 @@ final class ReleephProductListController extends ReleephController {
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new ReleephProductSearchEngine()) ->setSearchEngine(new ReleephProductSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -28,7 +28,7 @@ final class ReleephProductViewController extends ReleephProductController
} }
$this->setProduct($product); $this->setProduct($product);
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setPreface($this->renderPreface()) ->setPreface($this->renderPreface())
->setSearchEngine( ->setSearchEngine(

View file

@ -72,7 +72,7 @@ final class PhabricatorSearchController
} }
} }
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine($engine) ->setSearchEngine($engine)
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -14,8 +14,7 @@ final class PhabricatorSlowvoteListController
} }
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $controller = id(new PhabricatorApplicationSearchController())
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorSlowvoteSearchEngine()) ->setSearchEngine(new PhabricatorSlowvoteSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -74,6 +74,8 @@ try {
$application->setRequest($request); $application->setRequest($request);
list($controller, $uri_data) = $application->buildController(); list($controller, $uri_data) = $application->buildController();
$request->setURIMap($uri_data);
$controller->setRequest($request);
$access_log->setData( $access_log->setData(
array( array(
@ -98,7 +100,7 @@ try {
if (!$response) { if (!$response) {
$controller->willProcessRequest($uri_data); $controller->willProcessRequest($uri_data);
$response = $controller->processRequest(); $response = $controller->handleRequest($request);
} }
} catch (Exception $ex) { } catch (Exception $ex) {
$original_exception = $ex; $original_exception = $ex;