1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-19 16:38:51 +02:00

Remove an unused method in "ArcanistUploadWorkflow"

Summary: This method is private and has no callers. The code has moved to "FileUploader" in a prior change.

Test Plan: Grepped for callers, found none.

Differential Revision: https://secure.phabricator.com/D21382
This commit is contained in:
epriestley 2020-07-01 05:05:27 -07:00
parent 4b8a32ee02
commit 98ca5cfa81

View file

@ -141,83 +141,4 @@ EOTEXT
$this->writeStatusMessage($line."\n");
}
private function uploadChunks($file_phid, $path) {
$conduit = $this->getConduit();
$f = @fopen($path, 'rb');
if (!$f) {
throw new Exception(pht('Unable to open file "%s"', $path));
}
$this->writeStatus(pht('Beginning chunked upload of large file...'));
$chunks = $conduit->resolveCall(
'file.querychunks',
array(
'filePHID' => $file_phid,
));
$remaining = array();
foreach ($chunks as $chunk) {
if (!$chunk['complete']) {
$remaining[] = $chunk;
}
}
$done = (count($chunks) - count($remaining));
if ($done) {
$this->writeStatus(
pht(
'Resuming upload (%s of %s chunks remain).',
phutil_count($remaining),
phutil_count($chunks)));
} else {
$this->writeStatus(
pht(
'Uploading chunks (%s chunks to upload).',
phutil_count($remaining)));
}
$progress = new PhutilConsoleProgressBar();
$progress->setTotal(count($chunks));
for ($ii = 0; $ii < $done; $ii++) {
$progress->update(1);
}
$progress->draw();
// TODO: We could do these in parallel to improve upload performance.
foreach ($remaining as $chunk) {
$offset = $chunk['byteStart'];
$ok = fseek($f, $offset);
if ($ok !== 0) {
throw new Exception(
pht(
'Failed to %s!',
'fseek()'));
}
$data = fread($f, $chunk['byteEnd'] - $chunk['byteStart']);
if ($data === false) {
throw new Exception(
pht(
'Failed to %s!',
'fread()'));
}
$conduit->resolveCall(
'file.uploadchunk',
array(
'filePHID' => $file_phid,
'byteStart' => $offset,
'dataEncoding' => 'base64',
'data' => base64_encode($data),
));
$progress->update(1);
}
}
}