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 which has been uploaded to '.
17 public function getArtifactParameterSpecification() {
19 'filePHID' => 'string',
23 public function getArtifactParameterDescriptions() {
25 'filePHID' => pht('File to create an artifact from.'),
29 public function getArtifactDataExample() {
31 'filePHID' => 'PHID-FILE-abcdefghijklmnopqrst',
35 public function renderArtifactSummary(PhabricatorUser
$viewer) {
36 $artifact = $this->getBuildArtifact();
37 $file_phid = $artifact->getProperty('filePHID');
38 return $viewer->renderHandle($file_phid);
41 public function willCreateArtifact(PhabricatorUser
$actor) {
42 // NOTE: This is primarily making sure the actor has permission to view the
43 // file. We don't want to let you run builds using files you don't have
44 // permission to see, since this could let you violate permissions.
45 $this->loadArtifactFile($actor);
48 public function loadArtifactFile(PhabricatorUser
$viewer) {
49 $artifact = $this->getBuildArtifact();
50 $file_phid = $artifact->getProperty('filePHID');
52 $file = id(new PhabricatorFileQuery())
54 ->withPHIDs(array($file_phid))
59 'File PHID "%s" does not correspond to a valid file.',