diff options
author | cweagans | 2013-08-27 19:31:55 (GMT) |
---|---|---|
committer | Christopher Gervais | 2013-08-29 14:29:49 (GMT) |
commit | e66befcf485e046f73714667b6792c9e7c2cf607 (patch) | |
tree | dc181fa965e68f7bf2091faa4b2d8e972f745a41 | |
parent | ea1c2c87b7b501e28c04d048c012e25888353883 (diff) |
Issue #2069387 by cweagans: Added Support nonstandard database port on hostmaster-install command.
-rw-r--r-- | install.hostmaster.inc | 20 | ||||
-rw-r--r-- | provision.drush.inc | 1 |
2 files changed, 14 insertions, 7 deletions
diff --git a/install.hostmaster.inc b/install.hostmaster.inc index d847caf..aff7b2b 100644 --- a/install.hostmaster.inc +++ b/install.hostmaster.inc @@ -13,7 +13,7 @@ * @see Provision_Service_db_mysql::grant_host(). */ function drush_provision_hostmaster_install_pre_validate() { - $command = sprintf('mysql -u intntnllyInvalid -h %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost')); + $command = sprintf('mysql -u intntnllyInvalid -h %s -P %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost'), drush_get_option('aegir_db_port', '3306')); drush_shell_exec($command); if (preg_match("/Access denied for user 'intntnllyInvalid'@'([^']*)'/", implode('', drush_shell_exec_output()), $match)) { @@ -39,6 +39,7 @@ function drush_provision_hostmaster_install_validate($site = NULL) { drush_set_default('web_group', _provision_default_web_group()); drush_set_default('http_service_type', 'apache'); drush_set_default('aegir_db_user', 'root'); + drush_set_default('aegir_db_port', '3306'); drush_set_default('client_name', 'admin'); $aegir_db_user = drush_get_option('aegir_db_user'); drush_set_default('makefile', dirname(__FILE__) . '/aegir.make'); @@ -64,7 +65,7 @@ Don't worry: you will get to review those settings after the final install"); system('stty -echo'); drush_set_option('aegir_db_pass', drush_prompt(dt('MySQL privileged user ("!root") password', array('!root' => $aegir_db_user)))); system('stty echo'); - print "\n"; // add a newline since the user's didn't print + print "\n"; // add a newline since the user's didn't print } if (drush_get_option('aegir_host') == 'localhost') { @@ -101,6 +102,7 @@ The following settings will be used: Aegir DB host: !db_host Aegir DB user: !db_user Aegir DB password: !db_pass + Aegir DB port: !db_port Aegir version: !version Aegir platform path: !root Aegir makefile: !makefile @@ -114,6 +116,7 @@ The following settings will be used: '!db_host' => drush_get_option('aegir_db_host'), '!db_user' => drush_get_option('aegir_db_user'), '!db_pass' => is_null(drush_get_option('aegir_db_pass', NULL, 'process')) ? '<previously set>' : '<prompted>', + '!db_port' => drush_get_option('aegir_db_port'), '!version' => drush_get_option('version'), '!root' => drush_get_option(array('r', 'root')), '!makefile' => drush_get_option('makefile'), @@ -138,7 +141,8 @@ function drush_provision_hostmaster_install($site = NULL) { $aegir_db_user = drush_get_option('aegir_db_user'); $aegir_db_pass = drush_get_option('aegir_db_pass'); - + $aegir_db_port = drush_get_option('aegir_db_port'); + $server = '@server_master'; $master_context = array( 'context_type' => 'server', @@ -150,9 +154,10 @@ function drush_provision_hostmaster_install($site = NULL) { 'http_service_type' => drush_get_option('http_service_type'), 'web_group' => drush_get_option('web_group'), 'master_url' => "http://" . $site, + 'db_port' => $aegir_db_port, ); - $master_db = sprintf("mysql://%s:%s@%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), drush_get_option('aegir_db_host')); + $master_db = sprintf("mysql://%s:%s@%s:%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), drush_get_option('aegir_db_host'), $aegir_db_port); if (drush_get_option('aegir_host') == drush_get_option('aegir_db_host')) { $master_context['db_service_type'] = 'mysql'; $master_context['master_db'] = $master_db; @@ -164,6 +169,7 @@ function drush_provision_hostmaster_install($site = NULL) { 'context_type' => 'server', 'db_service_type' => 'mysql', 'master_db' => $master_db, + 'db_port' => $aegir_db_port, ); drush_invoke_process('@none', "provision-save", array($dbserver), $dbserver_context); provision_backend_invoke($dbserver, 'provision-verify'); @@ -171,7 +177,7 @@ function drush_provision_hostmaster_install($site = NULL) { drush_invoke_process('@none', "provision-save", array($server), $master_context); provision_backend_invoke($server, 'provision-verify'); - // exit if an error has occured. + // exit if an error has occured. if (drush_get_error()) { return false; } @@ -195,7 +201,7 @@ function drush_provision_hostmaster_install($site = NULL) { } provision_backend_invoke($platform_name, 'provision-verify', array(), $options); - // exit if an error has occured. + // exit if an error has occured. if (drush_get_error()) { return false; } @@ -215,7 +221,7 @@ function drush_provision_hostmaster_install($site = NULL) { $data = provision_backend_invoke($site_name, 'provision-install', array(), array('client_email' => drush_get_option('client_email'))); provision_backend_invoke($site_name, 'provision-verify'); - // exit if an error has occured. + // exit if an error has occured. if (drush_get_error()) { return false; } diff --git a/provision.drush.inc b/provision.drush.inc index 2a02c08..0d9c0d0 100644 --- a/provision.drush.inc +++ b/provision.drush.inc @@ -280,6 +280,7 @@ function provision_drush_command() { 'aegir_db_host' => dt('Database host to connect to (default: %host)', array('%host' => 'localhost')), 'aegir_db_user' => dt('Database user to connect as (default: %user)', array('%user' => 'root')), 'aegir_db_pass' => dt('Database password to use'), + 'aegir_db_port' => dt('Database port to use (default: %port)', array('%port' => '3306')), 'client_email' => dt('Email of the first client to create in the frontend'), 'client_name' => dt('Name of the first client to create in the frontend (default: %user)', array('%user' => 'admin')), 'makefile' => dt('The makefile used to create the hostmaster platform (default: %makefile)', array('%makefile' => dirname(__FILE__). '/aegir.make')), |