1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/search/controller/PhabricatorSearchOrderController.php
Joshua Spence 8756d82cf6 Remove @group annotations
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues.

Test Plan: Eye-ball it.

Reviewers: #blessed_reviewers, epriestley, chad

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D9859
2014-07-10 08:12:48 +10:00

41 lines
988 B
PHP

<?php
final class PhabricatorSearchOrderController
extends PhabricatorSearchBaseController {
private $engineClass;
public function willProcessRequest(array $data) {
$this->engineClass = idx($data, 'engine');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$request->validateCSRF();
$base_class = 'PhabricatorApplicationSearchEngine';
if (!is_subclass_of($this->engineClass, $base_class)) {
return new Aphront400Response();
}
$engine = newv($this->engineClass, array());
$engine->setViewer($user);
$queries = $engine->loadAllNamedQueries();
$queries = mpull($queries, null, 'getQueryKey');
$order = $request->getStrList('order');
$queries = array_select_keys($queries, $order) + $queries;
$sequence = 1;
foreach ($queries as $query) {
$query->setSequence($sequence++);
$query->save();
}
return id(new AphrontAjaxResponse());
}
}