Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / harbormaster / step / HarbormasterUploadArtifactBuildStepImplementation.php
blob0779ccb186798c057d0bc7776ab8805c55f1bded
1 <?php
3 final class HarbormasterUploadArtifactBuildStepImplementation
4 extends HarbormasterBuildStepImplementation {
6 public function getName() {
7 return pht('Upload File');
10 public function getGenericDescription() {
11 return pht('Upload a file.');
14 public function getBuildStepGroupKey() {
15 return HarbormasterPrototypeBuildStepGroup::GROUPKEY;
18 public function getDescription() {
19 return pht(
20 'Upload %s from %s.',
21 $this->formatSettingForDescription('path'),
22 $this->formatSettingForDescription('hostartifact'));
25 public function execute(
26 HarbormasterBuild $build,
27 HarbormasterBuildTarget $build_target) {
28 $viewer = PhabricatorUser::getOmnipotentUser();
30 $settings = $this->getSettings();
31 $variables = $build_target->getVariables();
33 $path = $this->mergeVariables(
34 'vsprintf',
35 $settings['path'],
36 $variables);
38 $artifact = $build_target->loadArtifact($settings['hostartifact']);
39 $impl = $artifact->getArtifactImplementation();
40 $lease = $impl->loadArtifactLease($viewer);
42 $interface = $lease->getInterface('filesystem');
44 // TODO: Handle exceptions.
45 $file = $interface->saveFile($path, $settings['name']);
47 // Insert the artifact record.
48 $artifact = $build_target->createArtifact(
49 $viewer,
50 $settings['name'],
51 HarbormasterFileArtifact::ARTIFACTCONST,
52 array(
53 'filePHID' => $file->getPHID(),
54 ));
57 public function getArtifactInputs() {
58 return array(
59 array(
60 'name' => pht('Upload From Host'),
61 'key' => $this->getSetting('hostartifact'),
62 'type' => HarbormasterHostArtifact::ARTIFACTCONST,
67 public function getArtifactOutputs() {
68 return array(
69 array(
70 'name' => pht('Uploaded File'),
71 'key' => $this->getSetting('name'),
72 'type' => HarbormasterHostArtifact::ARTIFACTCONST,
77 public function getFieldSpecifications() {
78 return array(
79 'path' => array(
80 'name' => pht('Path'),
81 'type' => 'text',
82 'required' => true,
84 'name' => array(
85 'name' => pht('Local Name'),
86 'type' => 'text',
87 'required' => true,
89 'hostartifact' => array(
90 'name' => pht('Host Artifact'),
91 'type' => 'text',
92 'required' => true,