Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97891820
PhabricatorXHProfDropController.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
Tue, Jan 7, 06:21
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 06:21 (2 d)
Engine
blob
Format
Raw Data
Handle
23432399
Attached To
rPH Phabricator
PhabricatorXHProfDropController.php
View Options
<?php
final
class
PhabricatorXHProfDropController
extends
PhabricatorXHProfController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
if
(!
$request
->
validateCSRF
())
{
return
new
Aphront400Response
();
}
$cancel_uri
=
$this
->
getApplicationURI
();
$ids
=
$request
->
getStrList
(
'h'
);
if
(
$ids
)
{
$files
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
$ids
)
->
setRaisePolicyExceptions
(
true
)
->
execute
();
}
else
{
$files
=
array
();
}
if
(!
$files
)
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Nothing Uploaded'
))
->
appendParagraph
(
pht
(
'Drag and drop .xhprof files to import them.'
))
->
addCancelButton
(
$cancel_uri
,
pht
(
'Done'
));
}
$samples
=
array
();
foreach
(
$files
as
$file
)
{
$sample
=
PhabricatorXHProfSample
::
initializeNewSample
()
->
setFilePHID
(
$file
->
getPHID
())
->
setUserPHID
(
$viewer
->
getPHID
())
->
save
();
$samples
[]
=
$sample
;
}
if
(
count
(
$samples
)
==
1
)
{
$event
=
head
(
$samples
);
$next_uri
=
$event
->
getURI
();
}
else
{
$next_uri
=
$this
->
getApplicationURI
();
}
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$next_uri
);
}
}
Event Timeline
Log In to Comment