Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F433126
DiffusionPathCompleteController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DiffusionPathCompleteController.php
View Options
<?php
final
class
DiffusionPathCompleteController
extends
DiffusionController
{
protected
function
getRepositoryIdentifierFromRequest
(
AphrontRequest
$request
)
{
return
$request
->
getStr
(
'repositoryPHID'
);
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$response
=
$this
->
loadDiffusionContext
();
if
(
$response
)
{
return
$response
;
}
$viewer
=
$this
->
getViewer
();
$drequest
=
$this
->
getDiffusionRequest
();
$query_path
=
$request
->
getStr
(
'q'
);
if
(
preg_match
(
'@/$@'
,
$query_path
))
{
$query_dir
=
$query_path
;
}
else
{
$query_dir
=
dirname
(
$query_path
).
'/'
;
}
$query_dir
=
ltrim
(
$query_dir
,
'/'
);
$browse_results
=
DiffusionBrowseResultSet
::
newFromConduit
(
$this
->
callConduitWithDiffusionRequest
(
'diffusion.browsequery'
,
array
(
'path'
=>
$query_dir
,
'commit'
=>
$drequest
->
getCommit
(),
)));
$paths
=
$browse_results
->
getPaths
();
$output
=
array
();
foreach
(
$paths
as
$path
)
{
$full_path
=
$query_dir
.
$path
->
getPath
();
if
(
$path
->
getFileType
()
==
DifferentialChangeType
::
FILE_DIRECTORY
)
{
$full_path
.=
'/'
;
}
$output
[]
=
array
(
'/'
.
$full_path
,
null
,
substr
(
md5
(
$full_path
),
0
,
7
));
}
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 3:26 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
62293
Default Alt Text
DiffusionPathCompleteController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment