1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 20:52:43 +01:00
phorge-phorge/src/applications/files/uploadsource/PhabricatorExecFutureFileUploadSource.php
epriestley b51a859636 Allow diffusion.filecontentquery to load data for arbitrarily large files
Summary:
Fixes T10186. After D14970, `diffusion.filecontentquery` puts the content in a file and returns the file PHID.

However, it does this in a way that doesn't go through the chunking engine, so it will fail for files larger than the chunk threshold (generally, 8MB).

Instead, stream the file from the underlying command directly into chunked storage.

Test Plan:
  - Made a commit including a really big file: 4dcd4c492b
  - Used `diffusion.filecontentquery` to load file content.
  - Parsed/imported commit locally.
  - Used `diffusion.filecontentquery` to load content for smaller files (README, etc).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10186

Differential Revision: https://secure.phabricator.com/D15072
2016-01-21 09:52:43 -08:00

28 lines
519 B
PHP

<?php
final class PhabricatorExecFutureFileUploadSource
extends PhabricatorFileUploadSource {
private $future;
public function setExecFuture(ExecFuture $future) {
$this->future = $future;
return $this;
}
public function getExecFuture() {
return $this->future;
}
protected function newDataIterator() {
$future = $this->getExecFuture();
return id(new LinesOfALargeExecFuture($future))
->setDelimiter(null);
}
protected function getDataLength() {
return null;
}
}