3 final class PhabricatorSearchOrderController
4 extends PhabricatorSearchBaseController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
8 $engine_class = $request->getURIData('engine');
10 $request->validateCSRF();
12 $base_class = 'PhabricatorApplicationSearchEngine';
13 if (!is_subclass_of($engine_class, $base_class)) {
14 return new Aphront400Response();
17 $engine = newv($engine_class, array());
18 $engine->setViewer($viewer);
20 $queries = $engine->loadAllNamedQueries();
21 $queries = mpull($queries, null, 'getQueryKey');
23 $order = $request->getStrList('order');
24 $queries = array_select_keys($queries, $order) +
$queries;
27 foreach ($queries as $query) {
28 $query->setSequence($sequence++
);
32 return id(new AphrontAjaxResponse());