mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 09:12:41 +01:00
Make storage adjustment a little nicer, especially the first time
Summary: Fixes T11583. - When users run `bin/storage upgrade` for the first time on a new install, we currently give them a prompt which feels rough and which they can only reasonably ever answer "yes" to. - We generally use cautionary language ("found issues with schema") in this workflow. Adjustments are now routine, so use more neutral and progress-oriented language ("found adjustments to apply"). Test Plan: - Ran `bin/storage upgrade --namesapce kappa123`, got an adjustment using neutral language without prompting. - Dropped a key, ran `bin/storage upgrade`, got normal workflow (but with more neutral language). Reviewers: chad Reviewed By: chad Maniphest Tasks: T11583 Differential Revision: https://secure.phabricator.com/D16509
This commit is contained in:
parent
76af4d649b
commit
b7e51877c3
1 changed files with 16 additions and 5 deletions
|
@ -8,6 +8,8 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
private $force;
|
private $force;
|
||||||
private $patches;
|
private $patches;
|
||||||
|
|
||||||
|
private $didInitialize;
|
||||||
|
|
||||||
final public function getAPI() {
|
final public function getAPI() {
|
||||||
return $this->api;
|
return $this->api;
|
||||||
}
|
}
|
||||||
|
@ -176,12 +178,16 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
"%s\n",
|
"%s\n",
|
||||||
pht('DRYRUN: Would apply adjustments.'));
|
pht('DRYRUN: Would apply adjustments.'));
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if ($this->didInitialize) {
|
||||||
|
// If we just initialized the database, continue without prompting. This
|
||||||
|
// is nicer for first-time setup and there's no reasonable reason any
|
||||||
|
// user would ever answer "no" to the prompt against an empty schema.
|
||||||
} else if (!$this->force) {
|
} else if (!$this->force) {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"\n%s\n",
|
"\n%s\n",
|
||||||
pht(
|
pht(
|
||||||
"Found %s issues(s) with schemata, detailed above.\n\n".
|
"Found %s adjustment(s) to apply, detailed above.\n\n".
|
||||||
"You can review issues in more detail from the web interface, ".
|
"You can review adjustments in more detail from the web interface, ".
|
||||||
"in Config > Database Status. To better understand the adjustment ".
|
"in Config > Database Status. To better understand the adjustment ".
|
||||||
"workflow, see \"Managing Storage Adjustments\" in the ".
|
"workflow, see \"Managing Storage Adjustments\" in the ".
|
||||||
"documentation.\n\n".
|
"documentation.\n\n".
|
||||||
|
@ -189,7 +195,7 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
"migrations may take some time.",
|
"migrations may take some time.",
|
||||||
phutil_count($adjustments)));
|
phutil_count($adjustments)));
|
||||||
|
|
||||||
$prompt = pht('Fix these schema issues?');
|
$prompt = pht('Apply these schema adjustments?');
|
||||||
if (!phutil_console_confirm($prompt, $default_no = true)) {
|
if (!phutil_console_confirm($prompt, $default_no = true)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +203,7 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
|
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n",
|
"%s\n",
|
||||||
pht('Fixing schema issues...'));
|
pht('Applying schema adjustments...'));
|
||||||
|
|
||||||
$conn = $api->getConn(null);
|
$conn = $api->getConn(null);
|
||||||
|
|
||||||
|
@ -368,7 +374,7 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
if (!$failed) {
|
if (!$failed) {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
"%s\n",
|
"%s\n",
|
||||||
pht('Completed fixing all schema issues.'));
|
pht('Completed applying all schema adjustments.'));
|
||||||
|
|
||||||
$err = 0;
|
$err = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -800,6 +806,11 @@ abstract class PhabricatorStorageManagementWorkflow
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're initializing storage for the first time, track it so that
|
||||||
|
// we can give the user a nicer experience during the subsequent
|
||||||
|
// adjustment phase.
|
||||||
|
$this->didInitialize = true;
|
||||||
|
|
||||||
$legacy = $api->getLegacyPatches($this->patches);
|
$legacy = $api->getLegacyPatches($this->patches);
|
||||||
if ($legacy || $no_quickstart || $init_only) {
|
if ($legacy || $no_quickstart || $init_only) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue