3 final class HarbormasterFileArtifact
extends HarbormasterArtifact
{
5 const ARTIFACTCONST
= 'file';
7 public function getArtifactTypeName() {
11 public function getArtifactTypeDescription() {
13 'Stores a reference to file data.');
16 public function getArtifactParameterSpecification() {
18 'filePHID' => 'string',
22 public function getArtifactParameterDescriptions() {
24 'filePHID' => pht('File to create an artifact from.'),
28 public function getArtifactDataExample() {
30 'filePHID' => 'PHID-FILE-abcdefghijklmnopqrst',
34 public function renderArtifactSummary(PhabricatorUser
$viewer) {
35 $artifact = $this->getBuildArtifact();
36 $file_phid = $artifact->getProperty('filePHID');
37 return $viewer->renderHandle($file_phid);
40 public function willCreateArtifact(PhabricatorUser
$actor) {
41 // NOTE: This is primarily making sure the actor has permission to view the
42 // file. We don't want to let you run builds using files you don't have
43 // permission to see, since this could let you violate permissions.
44 $this->loadArtifactFile($actor);
47 public function loadArtifactFile(PhabricatorUser
$viewer) {
48 $artifact = $this->getBuildArtifact();
49 $file_phid = $artifact->getProperty('filePHID');
51 $file = id(new PhabricatorFileQuery())
53 ->withPHIDs(array($file_phid))
58 'File PHID "%s" does not correspond to a valid file.',