Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistUploadWorkflow.php
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | public function runWorkflow() { | ||||
$is_temporary = $this->getArgument('temporary'); | $is_temporary = $this->getArgument('temporary'); | ||||
$is_json = $this->getArgument('json'); | $is_json = $this->getArgument('json'); | ||||
$is_browse = $this->getArgument('browse'); | $is_browse = $this->getArgument('browse'); | ||||
$paths = $this->getArgument('paths'); | $paths = $this->getArgument('paths'); | ||||
$conduit = $this->getConduitEngine(); | $conduit = $this->getConduitEngine(); | ||||
$results = array(); | $results = array(); | ||||
$uploader = id(new ArcanistFileUploader()) | $uploader = (new ArcanistFileUploader()) | ||||
->setConduitEngine($conduit); | ->setConduitEngine($conduit); | ||||
foreach ($paths as $key => $path) { | foreach ($paths as $key => $path) { | ||||
$file = id(new ArcanistFileDataRef()) | $file = (new ArcanistFileDataRef()) | ||||
->setName(basename($path)) | ->setName(basename($path)) | ||||
->setPath($path); | ->setPath($path); | ||||
if ($is_temporary) { | if ($is_temporary) { | ||||
$expires_at = time() + phutil_units('24 hours in seconds'); | $expires_at = time() + phutil_units('24 hours in seconds'); | ||||
$file->setDeleteAfterEpoch($expires_at); | $file->setDeleteAfterEpoch($expires_at); | ||||
} | } | ||||
Show All 39 Lines | if ($is_json) { | ||||
'phid' => $ref->getPHID(), | 'phid' => $ref->getPHID(), | ||||
'name' => $ref->getName(), | 'name' => $ref->getName(), | ||||
'uri' => $uri, | 'uri' => $uri, | ||||
); | ); | ||||
$json[] = $map; | $json[] = $map; | ||||
} | } | ||||
echo id(new PhutilJSON())->encodeAsList($json); | echo (new PhutilJSON())->encodeAsList($json); | ||||
} else { | } else { | ||||
foreach ($refs as $ref) { | foreach ($refs as $ref) { | ||||
$uri = $ref->getURI(); | $uri = $ref->getURI(); | ||||
$uri = $this->getAbsoluteURI($uri); | $uri = $this->getAbsoluteURI($uri); | ||||
echo tsprintf( | echo tsprintf( | ||||
'%s', | '%s', | ||||
$ref->newRefView() | $ref->newRefView() | ||||
->setURI($uri)); | ->setURI($uri)); | ||||
Show All 21 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0