mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-03 12:12:43 +01:00
b51a859636
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
91 lines
2.1 KiB
PHP
91 lines
2.1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorFilesApplicationStorageEnginePanel
|
|
extends PhabricatorApplicationConfigurationPanel {
|
|
|
|
public function getPanelKey() {
|
|
return 'storage';
|
|
}
|
|
|
|
public function shouldShowForApplication(
|
|
PhabricatorApplication $application) {
|
|
return ($application instanceof PhabricatorFilesApplication);
|
|
}
|
|
|
|
public function buildConfigurationPagePanel() {
|
|
$viewer = $this->getViewer();
|
|
$application = $this->getApplication();
|
|
|
|
$engines = PhabricatorFileStorageEngine::loadAllEngines();
|
|
$writable_engines = PhabricatorFileStorageEngine::loadWritableEngines();
|
|
$chunk_engines = PhabricatorFileStorageEngine::loadWritableChunkEngines();
|
|
|
|
$yes = pht('Yes');
|
|
$no = pht('No');
|
|
|
|
$rows = array();
|
|
$rowc = array();
|
|
foreach ($engines as $key => $engine) {
|
|
if ($engine->isTestEngine()) {
|
|
continue;
|
|
}
|
|
|
|
$limit = null;
|
|
if ($engine->hasFilesizeLimit()) {
|
|
$limit = phutil_format_bytes($engine->getFilesizeLimit());
|
|
} else {
|
|
$limit = pht('Unlimited');
|
|
}
|
|
|
|
if ($engine->canWriteFiles()) {
|
|
$writable = $yes;
|
|
} else {
|
|
$writable = $no;
|
|
}
|
|
|
|
if (isset($writable_engines[$key]) || isset($chunk_engines[$key])) {
|
|
$rowc[] = 'highlighted';
|
|
} else {
|
|
$rowc[] = null;
|
|
}
|
|
|
|
$rows[] = array(
|
|
$key,
|
|
get_class($engine),
|
|
$writable,
|
|
$limit,
|
|
);
|
|
}
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
->setNoDataString(pht('No storage engines available.'))
|
|
->setHeaders(
|
|
array(
|
|
pht('Key'),
|
|
pht('Class'),
|
|
pht('Writable'),
|
|
pht('Limit'),
|
|
))
|
|
->setRowClasses($rowc)
|
|
->setColumnClasses(
|
|
array(
|
|
'',
|
|
'wide',
|
|
'',
|
|
'n',
|
|
));
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
->setHeaderText(pht('Storage Engines'))
|
|
->setTable($table);
|
|
|
|
return $box;
|
|
}
|
|
|
|
public function handlePanelRequest(
|
|
AphrontRequest $request,
|
|
PhabricatorController $controller) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
}
|