Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15401456
D20572.id49075.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D20572.id49075.diff
View Options
diff --git a/src/docs/user/configuration/configuring_backups.diviner b/src/docs/user/configuration/configuring_backups.diviner
--- a/src/docs/user/configuration/configuring_backups.diviner
+++ b/src/docs/user/configuration/configuring_backups.diviner
@@ -42,7 +42,7 @@
Since most of this data is compressible, it may be helpful to run it through
gzip prior to storage. For example:
- phabricator/ $ ./bin/storage dump | gzip > backup.sql.gz
+ phabricator/ $ ./bin/storage dump --compress --output backup.sql.gz
Then store the backup somewhere safe, like in a box buried under an old tree
stump. No one will ever think to look for it there.
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
@@ -51,24 +51,59 @@
}
public function didExecute(PhutilArgumentParser $args) {
+ $output_file = $args->getArg('output');
+ $is_compress = $args->getArg('compress');
+ $is_overwrite = $args->getArg('overwrite');
+
+ if ($is_compress) {
+ if ($output_file === null) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'The "--compress" flag can only be used alongside "--output".'));
+ }
+
+ if (!function_exists('gzopen')) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'The "--compress" flag requires the PHP "zlib" extension, but '.
+ 'that extension is not available. Install the extension or '.
+ 'omit the "--compress" option.'));
+ }
+ }
+
+ if ($is_overwrite) {
+ if ($output_file === null) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'The "--overwrite" flag can only be used alongside "--output".'));
+ }
+ }
+
+ if ($output_file !== null) {
+ if (Filesystem::pathExists($output_file)) {
+ if (!$is_overwrite) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Output file "%s" already exists. Use "--overwrite" '.
+ 'to overwrite.',
+ $output_file));
+ }
+ }
+ }
+
$api = $this->getSingleAPI();
$patches = $this->getPatches();
- $console = PhutilConsole::getConsole();
-
$with_indexes = !$args->getArg('no-indexes');
$applied = $api->getAppliedPatches();
if ($applied === null) {
- $namespace = $api->getNamespace();
- $console->writeErr(
+ throw new PhutilArgumentUsageException(
pht(
- '**Storage Not Initialized**: There is no database storage '.
- 'initialized in this storage namespace ("%s"). Use '.
- '**%s** to initialize storage.',
- $namespace,
- './bin/storage upgrade'));
- return 1;
+ 'There is no database storage initialized in the current storage '.
+ 'namespace ("%s"). Use "bin/storage upgrade" to initialize '.
+ 'storage or use "--namespace" to choose a different namespace.',
+ $api->getNamespace()));
}
$ref = $api->getRef();
@@ -141,38 +176,6 @@
}
}
- $output_file = $args->getArg('output');
- $is_compress = $args->getArg('compress');
- $is_overwrite = $args->getArg('overwrite');
-
- if ($is_compress) {
- if ($output_file === null) {
- throw new PhutilArgumentUsageException(
- pht(
- 'The "--compress" flag can only be used alongside "--output".'));
- }
- }
-
- if ($is_overwrite) {
- if ($output_file === null) {
- throw new PhutilArgumentUsageException(
- pht(
- 'The "--overwrite" flag can only be used alongside "--output".'));
- }
- }
-
- if ($output_file !== null) {
- if (Filesystem::pathExists($output_file)) {
- if (!$is_overwrite) {
- throw new PhutilArgumentUsageException(
- pht(
- 'Output file "%s" already exists. Use "--overwrite" '.
- 'to overwrite.',
- $output_file));
- }
- }
- }
-
$argv = array();
$argv[] = '--hex-blob';
$argv[] = '--single-transaction';
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 5:48 PM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709739
Default Alt Text
D20572.id49075.diff (4 KB)
Attached To
Mode
D20572: Recommend dumping database backups with "--compress --output X" instead of "| gzip > X"
Attached
Detach File
Event Timeline
Log In to Comment