Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583592
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/workflow/ArcanistUploadWorkflow.php b/src/workflow/ArcanistUploadWorkflow.php
index 3629a449..424cca67 100644
--- a/src/workflow/ArcanistUploadWorkflow.php
+++ b/src/workflow/ArcanistUploadWorkflow.php
@@ -1,106 +1,99 @@
<?php
/**
* Upload a file to Phabricator.
*/
final class ArcanistUploadWorkflow extends ArcanistWorkflow {
private $paths;
private $json;
public function getWorkflowName() {
return 'upload';
}
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
**upload** __file__ [__file__ ...] [--json]
EOTEXT
);
}
public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT
Supports: filesystems
Upload a file from local disk.
EOTEXT
);
}
public function getArguments() {
return array(
'json' => array(
- 'help' => 'Output upload information in JSON format.',
+ 'help' => pht('Output upload information in JSON format.'),
),
'*' => 'paths',
);
}
protected function didParseArguments() {
if (!$this->getArgument('paths')) {
- throw new ArcanistUsageException('Specify one or more files to upload.');
+ throw new ArcanistUsageException(
+ pht('Specify one or more files to upload.'));
}
$this->paths = $this->getArgument('paths');
$this->json = $this->getArgument('json');
}
public function requiresAuthentication() {
return true;
}
- private function getPaths() {
- return $this->paths;
- }
-
- private function getJSON() {
- return $this->json;
- }
-
public function run() {
$conduit = $this->getConduit();
-
$results = array();
foreach ($this->paths as $path) {
$name = basename($path);
- $this->writeStatusMessage("Uploading '{$name}'...\n");
+ $this->writeStatusMessage(pht("Uploading '%s'...", $name)."\n");
+
try {
$data = Filesystem::readFile($path);
} catch (FilesystemException $ex) {
$this->writeStatusMessage(
- "Unable to upload file: ".$ex->getMessage()."\n");
+ pht('Unable to upload file: %s.', $ex->getMessage())."\n");
$results[$path] = null;
continue;
}
$phid = $conduit->callMethodSynchronous(
'file.upload',
array(
'data_base64' => base64_encode($data),
- 'name' => $name,
+ 'name' => $name,
));
$info = $conduit->callMethodSynchronous(
'file.info',
array(
- 'phid' => $phid,
+ 'phid' => $phid,
));
$results[$path] = $info;
- if (!$this->getJSON()) {
+ if (!$this->json) {
$id = $info['id'];
echo " F{$id} {$name}: ".$info['uri']."\n\n";
}
}
- if ($this->getJSON()) {
+ if ($this->json) {
echo json_encode($results)."\n";
} else {
- $this->writeStatusMessage("Done.\n");
+ $this->writeStatusMessage(pht('Done.')."\n");
}
return 0;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Oct 11, 10:11 (13 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
984190
Default Alt Text
(3 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment