From 23ad5fe8c4ed0202a682ca773dc888828b4513df Mon Sep 17 00:00:00 2001 From: kevand900 Date: Wed, 22 Mar 2017 10:41:44 -0700 Subject: [PATCH] Adding command line parameter --db-host to specify remote mysql server. --- base/DatabaseInstaller.php | 14 ++++++++------ base/PerfOptions.php | 8 ++++++++ targets/drupal7/Drupal7Target.php | 5 +++++ targets/drupal7/settings.php.gz | Bin 8497 -> 8511 bytes targets/drupal8/Drupal8Target.php | 4 ++++ targets/drupal8/settings/settings.php | 2 +- targets/magento1/Magento1Target.php | 6 +++++- targets/magento1/local.xml | 2 +- targets/mediawiki/LocalSettings.php | 2 +- targets/mediawiki/MediaWikiTarget.php | 7 ++++++- targets/sugarcrm/SugarCRMTarget.php | 4 ++++ targets/sugarcrm/config.php | 2 +- targets/wordpress/WordpressTarget.php | 7 ++++++- targets/wordpress/wp-config.php | 2 +- 14 files changed, 51 insertions(+), 14 deletions(-) diff --git a/base/DatabaseInstaller.php b/base/DatabaseInstaller.php index 3cb21b0..72deacc 100644 --- a/base/DatabaseInstaller.php +++ b/base/DatabaseInstaller.php @@ -48,6 +48,8 @@ public function configureMysqlAffinity(): void { public function installDatabase(): bool { $db = $this->databaseName; $dump = $this->dumpFile; + $dbHost = $this->options->dbHost; + invariant( $db !== null && $dump !== null, 'database and dump must be specified', @@ -57,7 +59,7 @@ public function installDatabase(): bool { return false; } - $conn = mysql_connect('127.0.0.1', $db, $db); + $conn = mysql_connect($dbHost, $db, $db); $db_selected = mysql_select_db($db, $conn); if ($conn === false || $db_selected === false) { $this->createMySQLDatabase(); @@ -86,7 +88,7 @@ public function installDatabase(): bool { '|'. $sed. Utils::EscapeCommand( - Vector {'mysql', '-h', '127.0.0.1', $db, '-u', $db, '-p'.$db}, + Vector {'mysql', '-h', $dbHost.'', $db, '-u', $db, '-p'.$db}, ), $output, $ret, @@ -112,7 +114,7 @@ private function getRootConnection(): resource { fprintf(STDERR, '%s', 'MySQL admin password: '); $this->password = trim(fgets(STDIN)); } - $conn = mysql_connect('127.0.0.1', $this->username, $this->password); + $conn = mysql_connect($this->options->dbHost, $this->username, $this->password); if ($conn === false) { throw new Exception('Failed to connect: '.mysql_error()); } @@ -121,7 +123,7 @@ private function getRootConnection(): resource { private function checkMySQLConnectionLimit(): void { $conn = - mysql_connect('127.0.0.1', $this->getUsername(), $this->getPassword()); + mysql_connect($this->options->dbHost, $this->getUsername(), $this->getPassword()); if ($conn === false) { throw new Exception('Failed to connect: '.mysql_error()); } @@ -151,7 +153,7 @@ private function createMySQLDatabase(): void { STDERR, '%s', "Can't connect to database ". - "(mysql -h 127.0.0.1 -p$db -u $db $db). This can be ". + "(mysql -h $this->options->dbHost -p$db -u $db $db). This can be ". "fixed for you.\n", ); $conn = $this->getRootConnection(); @@ -178,7 +180,7 @@ private function createMySQLDatabase(): void { $conn, ); mysql_query( - "GRANT ALL PRIVILEGES ON $edb.* TO '$edb'@127.0.0.1 ". + "GRANT ALL PRIVILEGES ON $edb.* TO '$edb'@'$this->options->dbHost' ". "IDENTIFIED BY '$edb'", $conn, ); diff --git a/base/PerfOptions.php b/base/PerfOptions.php index a09e655..df6478d 100644 --- a/base/PerfOptions.php +++ b/base/PerfOptions.php @@ -120,6 +120,8 @@ final class PerfOptions { public bool $notBenchmarking = false; + public string $dbHost = '127.0.0.1'; //The hostname/IP of server which hosts the database. + private array $args; private Vector $notBenchmarkingArgs = Vector {}; @@ -181,6 +183,7 @@ public function __construct(Vector $argv) { 'daemon-files', // daemon output goes to files in the temp directory 'temp-dir:', // temp directory to use; if absent one in /tmp is made 'src-dir:', // location for source to copy into tmp dir instead of ZIP + 'db-host:', //The IP Address or Hostname of the remote Database }; $targets = $this->getTargetDefinitions()->keys(); $def->addAll($targets); @@ -321,6 +324,11 @@ public function __construct(Vector $argv) { $argTempDir = $this->getNullableString('temp-dir'); + $host = $this->getNullableString('db-host'); + if ($host) { + $this->dbHost = $host; + } + if ($argTempDir === null) { $this->tempDir = tempnam('/tmp', 'hhvm-nginx'); // Currently a file - change to a dir diff --git a/targets/drupal7/Drupal7Target.php b/targets/drupal7/Drupal7Target.php index eb2ccba..3c1387c 100644 --- a/targets/drupal7/Drupal7Target.php +++ b/targets/drupal7/Drupal7Target.php @@ -36,6 +36,11 @@ public function install(): void { $this->getSourceRoot().'/sites/default/settings.php', ); + $file = $this->getSourceRoot().'/sites/default/settings.php'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); + (new DatabaseInstaller($this->options)) ->setDatabaseName('drupal_bench') ->setDumpFile(__DIR__.'/dbdump.sql.gz') diff --git a/targets/drupal7/settings.php.gz b/targets/drupal7/settings.php.gz index 575f1a94aa490cf436c9114f2d50813ba94f2096..1bf775029372761377049352a4086117b361159c 100644 GIT binary patch literal 8511 zcmV-FA;8`riwFp9f)=IzPZ%d_L7>$A7#SINt_m&x0!tHX=aOZxTA(fRRda&h_g z52wf1$#~34Gk%*%O_w~28{ZJIWzW=XrSG-H`AmZrHGCFhlF zz|3Ygr2%Dfd2uzweA88nN0;WtI(}-FH?F18Kd&tPZ0Yl4xhmScrnQ!NxoWK&J^C!I z%GqBB*v!P4nVqzY#?nEGZ1A7S*U81Ji^phpH_5`>f z;dMjjPiosNbLTLqw_-v+4JLDzL@94KNt3%9Pm*go(|v+r0@`O$nT$k_CYTyWzpQHd z9#m*n1)XbZi)uYeUR7&*Ya7g#i;S^ofGLS7a^oO~JZou|Gz-3PWB!*#ou;ozPFVhl z66?GuXlhI+>kkuCW;`#?MhoY%3)3{jv(I=Yd5oyhG&(s!Z3Gi#c|&xrnoWP_ zSJvuo?44PXERVWf%_>ly=$x1I>r!ZArqzlk)SWy`#coAC4}IcN?2jlwvgFz(uWL{S zTV2~JRvtJ^wy0bSN{Nyeb|#XT&lfFIqBiZK`(8e$0T?*qov^ZErX7r(RV$jp?`Z|D zVopZ%3Z0FNp=p zm?87S&Q)a`jUZr=9(7GPk8|OfgAw z8FuiDNny)Oso{lcPYAIG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>rSD2?;B7k-Mw^lRMAF9pM3V&7oU9g fq3H_U*Ot{}K^}*FjJqAgS>gWydU?P}N?iZ|H-zc7 diff --git a/targets/drupal8/Drupal8Target.php b/targets/drupal8/Drupal8Target.php index 8f45940..32e76d1 100644 --- a/targets/drupal8/Drupal8Target.php +++ b/targets/drupal8/Drupal8Target.php @@ -46,6 +46,10 @@ public function install(): void { __DIR__.'/settings/settings.php', $this->getSourceRoot().'/sites/default/settings.php', ); + $file = $this->getSourceRoot().'/sites/default/settings.php'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); copy( __DIR__.'/settings/setup.php', $this->getSourceRoot().'/sites/default/setup.php', diff --git a/targets/drupal8/settings/settings.php b/targets/drupal8/settings/settings.php index 6dd31a2..c76c3c9 100644 --- a/targets/drupal8/settings/settings.php +++ b/targets/drupal8/settings/settings.php @@ -678,7 +678,7 @@ 'username' => 'drupal_bench', 'password' => 'drupal_bench', 'prefix' => '', - 'host' => '127.0.0.1', + 'host' => '__DB_HOST__', 'port' => '3306', 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', 'driver' => 'mysql', diff --git a/targets/magento1/Magento1Target.php b/targets/magento1/Magento1Target.php index 1d21bea..aba4b3e 100644 --- a/targets/magento1/Magento1Target.php +++ b/targets/magento1/Magento1Target.php @@ -98,6 +98,10 @@ public function install(): void { __DIR__.'/local.xml', $this->getSourceRoot().'/app/etc/local.xml', ); + $file = $this->getSourceRoot().'/app/etc/local.xml'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); return; } @@ -127,7 +131,7 @@ public function install(): void { private function getInstallerArgs(): array { $url = 'http://'.gethostname().':'.PerfSettings::HttpPort().'/'; return array( - 'db_host' => '127.0.0.1', + 'db_host' => $this->options->dbHost, 'db_name' => $this->getDatabaseName(), 'db_user' => $this->installer->getUsername(), 'db_pass' => $this->installer->getPassword(), diff --git a/targets/magento1/local.xml b/targets/magento1/local.xml index 4da021e..0e15102 100755 --- a/targets/magento1/local.xml +++ b/targets/magento1/local.xml @@ -40,7 +40,7 @@ - + diff --git a/targets/mediawiki/LocalSettings.php b/targets/mediawiki/LocalSettings.php index c0fcefc..f2a57ef 100644 --- a/targets/mediawiki/LocalSettings.php +++ b/targets/mediawiki/LocalSettings.php @@ -55,7 +55,7 @@ ## Database settings $wgDBtype = "mysql"; -$wgDBserver = "127.0.0.1"; +$wgDBserver = "__DB_HOST__"; $wgDBname = "mw_bench"; $wgDBuser = "mw_bench"; $wgDBpassword = "mw_bench"; diff --git a/targets/mediawiki/MediaWikiTarget.php b/targets/mediawiki/MediaWikiTarget.php index 66a35fc..c870942 100644 --- a/targets/mediawiki/MediaWikiTarget.php +++ b/targets/mediawiki/MediaWikiTarget.php @@ -39,8 +39,13 @@ public function install(): void { // we're in repo-auth mode, the generated files end up in the repo $cache_dir = $this->getSourceRoot().'/mw-cache'; mkdir($cache_dir); - copy(__DIR__.'/LocalSettings.php', $this->getSourceRoot().'/LocalSettings.php'); + + $file = $this->getSourceRoot().'/LocalSettings.php'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); + file_put_contents( $this->getSourceRoot().'/LocalSettings.php', '$wgCacheDirectory="'.$cache_dir.'";', diff --git a/targets/sugarcrm/SugarCRMTarget.php b/targets/sugarcrm/SugarCRMTarget.php index 4cf1959..6818631 100644 --- a/targets/sugarcrm/SugarCRMTarget.php +++ b/targets/sugarcrm/SugarCRMTarget.php @@ -22,6 +22,10 @@ public function install(): void { } copy(__DIR__.'/config.php', $this->getSourceRoot().'/config.php'); + $file = $this->getSourceRoot().'/config.php'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); if ($this->options->skipDatabaseInstall) { return; diff --git a/targets/sugarcrm/config.php b/targets/sugarcrm/config.php index 3408dcf..969a8a3 100644 --- a/targets/sugarcrm/config.php +++ b/targets/sugarcrm/config.php @@ -52,7 +52,7 @@ 'datef' => 'm/d/Y', 'dbconfig' => array ( - 'db_host_name' => '127.0.0.1', + 'db_host_name' => '__DB_HOST__', 'db_host_instance' => 'SQLEXPRESS', 'db_user_name' => 'sugarcrm', 'db_password' => 'sugarcrm', diff --git a/targets/wordpress/WordpressTarget.php b/targets/wordpress/WordpressTarget.php index f773235..df9c963 100644 --- a/targets/wordpress/WordpressTarget.php +++ b/targets/wordpress/WordpressTarget.php @@ -30,6 +30,11 @@ public function install(): void { copy(__DIR__.'/wp-config.php', $this->getSourceRoot().'/wp-config.php'); + $file = $this->getSourceRoot().'/wp-config.php'; + $file_contents = file_get_contents($file); + $file_contents = str_replace('__DB_HOST__', $this->options->dbHost, $file_contents ); + file_put_contents($file, $file_contents); + $created_database = (new DatabaseInstaller($this->options)) ->setDatabaseName('wp_bench') @@ -45,7 +50,7 @@ public function install(): void { : PerfSettings::HttpPort(); $root = 'http://'.gethostname().':'.$visible_port; - $conn = mysql_connect('127.0.0.1', 'wp_bench', 'wp_bench'); + $conn = mysql_connect($this->options->dbHost, 'wp_bench', 'wp_bench'); $db_selected = mysql_select_db('wp_bench', $conn); $result = mysql_query( 'UPDATE wp_options '. diff --git a/targets/wordpress/wp-config.php b/targets/wordpress/wp-config.php index bd89a31..b36c90f 100644 --- a/targets/wordpress/wp-config.php +++ b/targets/wordpress/wp-config.php @@ -42,7 +42,7 @@ define('DB_PASSWORD', 'wp_bench'); /** MySQL hostname */ -define('DB_HOST', '127.0.0.1'); +define('DB_HOST', '__DB_HOST__'); ////////////////////////////////////////////// ///// END CHANGES TO DEFAULT CONFIG FILE /////