Differential D25106 Diff 449 src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | try { | ||||
->setReadBufferSize(32 * 1024 * 1024); | ->setReadBufferSize(32 * 1024 * 1024); | ||||
$iterator = id(new FutureIterator(array($future))) | $iterator = id(new FutureIterator(array($future))) | ||||
->setUpdateInterval(0.010); | ->setUpdateInterval(0.010); | ||||
foreach ($iterator as $ready) { | foreach ($iterator as $ready) { | ||||
list($stdout, $stderr) = $future->read(); | list($stdout, $stderr) = $future->read(); | ||||
$future->discardBuffers(); | $future->discardBuffers(); | ||||
if (strlen($stderr)) { | if (phutil_nonempty_string($stderr)) { | ||||
fwrite(STDERR, $stderr); | fwrite(STDERR, $stderr); | ||||
} | } | ||||
$this->writeData($stdout, $file, $is_compress, $output_file); | $this->writeData($stdout, $file, $is_compress, $output_file); | ||||
if ($ready !== null) { | if ($ready !== null) { | ||||
$ready->resolvex(); | $ready->resolvex(); | ||||
} | } | ||||
Show All 28 Lines | try { | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
private function writeData($data, $file, $is_compress, $output_file) { | private function writeData($data, $file, $is_compress, $output_file) { | ||||
if (!strlen($data)) { | if (!phutil_nonempty_string($data)) { | ||||
return; | return; | ||||
} | } | ||||
if (!$file) { | if (!$file) { | ||||
$ok = fwrite(STDOUT, $data); | $ok = fwrite(STDOUT, $data); | ||||
} else if ($is_compress) { | } else if ($is_compress) { | ||||
$ok = gzwrite($file, $data); | $ok = gzwrite($file, $data); | ||||
} else { | } else { | ||||
Show All 13 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