Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92259418
PhabricatorSearchOrderController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 18, 20:58
Size
988 B
Mime Type
text/x-php
Expires
Wed, Nov 20, 20:58 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22407063
Attached To
rPH Phabricator
PhabricatorSearchOrderController.php
View Options
<?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
());
}
}
Event Timeline
Log In to Comment