mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
09ab82faef
Summary: Ref T8628. Updates Search. Test Plan: Did various searches, saved new queries, reordered, ran new queries. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D14268
35 lines
890 B
PHP
35 lines
890 B
PHP
<?php
|
|
|
|
final class PhabricatorSearchOrderController
|
|
extends PhabricatorSearchBaseController {
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
$viewer = $this->getViewer();
|
|
$engine_class = $request->getURIData('engine');
|
|
|
|
$request->validateCSRF();
|
|
|
|
$base_class = 'PhabricatorApplicationSearchEngine';
|
|
if (!is_subclass_of($engine_class, $base_class)) {
|
|
return new Aphront400Response();
|
|
}
|
|
|
|
$engine = newv($engine_class, array());
|
|
$engine->setViewer($viewer);
|
|
|
|
$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());
|
|
}
|
|
|
|
}
|