Changeset View
Changeset View
Standalone View
Standalone View
scripts/sql/manage_storage.php
#!/usr/bin/env php | #!/usr/bin/env php | ||||
<?php | <?php | ||||
$root = dirname(dirname(dirname(__FILE__))); | $root = dirname(dirname(dirname(__FILE__))); | ||||
require_once $root.'/scripts/init/init-setup.php'; | require_once $root.'/scripts/init/init-setup.php'; | ||||
$args = new PhutilArgumentParser($argv); | $args = new PhutilArgumentParser($argv); | ||||
$args->setTagline(pht('manage Phabricator storage and schemata')); | $args->setTagline(pht('manage storage and schemata')); | ||||
$args->setSynopsis(<<<EOHELP | $args->setSynopsis(<<<EOHELP | ||||
**storage** __workflow__ [__options__] | **storage** __workflow__ [__options__] | ||||
Manage Phabricator database storage and schema versioning. | Manage database storage and schema versioning. | ||||
**storage** upgrade | **storage** upgrade | ||||
Initialize or upgrade Phabricator storage. | Initialize or upgrade storage. | ||||
**storage** upgrade --user __root__ --password __hunter2__ | **storage** upgrade --user __root__ --password __hunter2__ | ||||
Use administrative credentials for schema changes. | Use administrative credentials for schema changes. | ||||
EOHELP | EOHELP | ||||
); | ); | ||||
$args->parseStandardArguments(); | $args->parseStandardArguments(); | ||||
$default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace(); | $default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace(); | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | array( | ||||
'name' => 'dryrun', | 'name' => 'dryrun', | ||||
'help' => pht( | 'help' => pht( | ||||
'Do not actually change anything, just show what would be changed.'), | 'Do not actually change anything, just show what would be changed.'), | ||||
), | ), | ||||
array( | array( | ||||
'name' => 'disable-utf8mb4', | 'name' => 'disable-utf8mb4', | ||||
'help' => pht( | 'help' => pht( | ||||
'Disable %s, even if the database supports it. This is an '. | 'Disable %s, even if the database supports it. This is an '. | ||||
'advanced feature used for testing changes to Phabricator; you '. | 'advanced feature used for testing internal changes; you '. | ||||
'should not normally use this flag.', | 'should not normally use this flag.', | ||||
'utf8mb4'), | 'utf8mb4'), | ||||
), | ), | ||||
)); | )); | ||||
} catch (PhutilArgumentUsageException $ex) { | } catch (PhutilArgumentUsageException $ex) { | ||||
$args->printUsageException($ex); | $args->printUsageException($ex); | ||||
exit(77); | exit(77); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | foreach ($refs as $ref) { | ||||
} catch (AphrontQueryException $ex) { | } catch (AphrontQueryException $ex) { | ||||
$message = phutil_console_format( | $message = phutil_console_format( | ||||
"**%s**\n\n%s\n\n%s\n\n%s\n\n**%s**: %s\n", | "**%s**\n\n%s\n\n%s\n\n%s\n\n**%s**: %s\n", | ||||
pht('MySQL Credentials Not Configured'), | pht('MySQL Credentials Not Configured'), | ||||
pht( | pht( | ||||
'Unable to connect to MySQL using the configured credentials. '. | 'Unable to connect to MySQL using the configured credentials. '. | ||||
'You must configure standard credentials before you can upgrade '. | 'You must configure standard credentials before you can upgrade '. | ||||
'storage. Run these commands to set up credentials:'), | 'storage. Run these commands to set up credentials:'), | ||||
" phabricator/ $ ./bin/config set mysql.host __host__\n". | " $ ./bin/config set mysql.host __host__\n". | ||||
" phabricator/ $ ./bin/config set mysql.user __username__\n". | " $ ./bin/config set mysql.user __username__\n". | ||||
" phabricator/ $ ./bin/config set mysql.pass __password__", | " $ ./bin/config set mysql.pass __password__", | ||||
pht( | pht( | ||||
'These standard credentials are separate from any administrative '. | 'These standard credentials are separate from any administrative '. | ||||
'credentials provided to this command with __%s__ or '. | 'credentials provided to this command with __%s__ or '. | ||||
'__%s__, and must be configured correctly before you can proceed.', | '__%s__, and must be configured correctly before you can proceed.', | ||||
'--user', | '--user', | ||||
'--password'), | '--password'), | ||||
pht('Raw MySQL Error'), | pht('Raw MySQL Error'), | ||||
$ex->getMessage()); | $ex->getMessage()); | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |