mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
8756d82cf6
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
41 lines
988 B
PHP
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());
|
|
}
|
|
|
|
}
|