Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F552502
HarbormasterFileArtifact.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
HarbormasterFileArtifact.php
View Options
<?php
final
class
HarbormasterFileArtifact
extends
HarbormasterArtifact
{
const
ARTIFACTCONST
=
'file'
;
public
function
getArtifactTypeName
()
{
return
pht
(
'File'
);
}
public
function
getArtifactTypeDescription
()
{
return
pht
(
'Stores a reference to file data.'
);
}
public
function
getArtifactParameterSpecification
()
{
return
array
(
'filePHID'
=>
'string'
,
);
}
public
function
getArtifactParameterDescriptions
()
{
return
array
(
'filePHID'
=>
pht
(
'File to create an artifact from.'
),
);
}
public
function
getArtifactDataExample
()
{
return
array
(
'filePHID'
=>
'PHID-FILE-abcdefghijklmnopqrst'
,
);
}
public
function
renderArtifactSummary
(
PhabricatorUser
$viewer
)
{
$artifact
=
$this
->
getBuildArtifact
();
$file_phid
=
$artifact
->
getProperty
(
'filePHID'
);
return
$viewer
->
renderHandle
(
$file_phid
);
}
public
function
willCreateArtifact
(
PhabricatorUser
$actor
)
{
// NOTE: This is primarily making sure the actor has permission to view the
// file. We don't want to let you run builds using files you don't have
// permission to see, since this could let you violate permissions.
$this
->
loadArtifactFile
(
$actor
);
}
public
function
loadArtifactFile
(
PhabricatorUser
$viewer
)
{
$artifact
=
$this
->
getBuildArtifact
();
$file_phid
=
$artifact
->
getProperty
(
'filePHID'
);
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$file_phid
))
->
executeOne
();
if
(!
$file
)
{
throw
new
Exception
(
pht
(
'File PHID "%s" does not correspond to a valid file.'
,
$file_phid
));
}
return
$file
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 4:29 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
109902
Default Alt Text
HarbormasterFileArtifact.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment