EOHELP ); $args->parseStandardArguments(); $default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace(); try { $args->parsePartial(array(array('name' => 'force', 'short' => 'f', 'help' => pht('Do not prompt before performing dangerous operations.')), array('name' => 'host', 'param' => 'hostname', 'help' => pht('Connect to __host__ instead of the default host.')), array('name' => 'user', 'short' => 'u', 'param' => 'username', 'help' => pht('Connect with __username__ instead of the configured default.')), array('name' => 'password', 'short' => 'p', 'param' => 'password', 'help' => pht('Use __password__ instead of the configured default.')), array('name' => 'namespace', 'param' => 'name', 'default' => $default_namespace, 'help' => pht("Use namespace __namespace__ instead of the configured " . "default ('%s'). This is an advanced feature used by unit tests; " . "you should not normally use this flag.", $default_namespace)), array('name' => 'dryrun', 'help' => pht('Do not actually change anything, just show what would be changed.')), array('name' => 'disable-utf8mb4', 'help' => pht('Disable %s, even if the database supports it. This is an ' . 'advanced feature used for testing changes to Phabricator; you ' . 'should not normally use this flag.', 'utf8mb4')))); } catch (PhutilArgumentUsageException $ex) { $args->printUsageException($ex); exit(77); } // First, test that the Phabricator configuration is set up correctly. After // we know this works we'll test any administrative credentials specifically. $host = $args->getArg('host'); if (strlen($host)) { $ref = null; $refs = PhabricatorDatabaseRef::getLiveRefs(); // Include the master in case the user is just specifying a redundant // "--host" flag for no reason and does not actually have a database // cluster configured. $refs[] = PhabricatorDatabaseRef::getMasterDatabaseRef(); foreach ($refs as $possible_ref) { if ($possible_ref->getHost() == $host) { $ref = $possible_ref; break; } } if (!$ref) { throw new PhutilArgumentUsageException(pht('There is no configured database on host "%s". This command can ' . 'only interact with configured databases.', $host)); } } else { $ref = PhabricatorDatabaseRef::getMasterDatabaseRef();