From 8303376372d15ce8f69978d7e7ea495571c4affa Mon Sep 17 00:00:00 2001 From: Ario Sius <44259996+ariochain@users.noreply.github.com> Date: Tue, 17 Sep 2019 00:36:53 +0200 Subject: [PATCH] Update sanity.php Add support for db host name in bootstraping --- sanity.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sanity.php b/sanity.php index 38bdeea..0f24b3b 100755 --- a/sanity.php +++ b/sanity.php @@ -96,7 +96,8 @@ $current = $block->current(); if ($current['height']==1) { echo "Bootstrapping!\n"; $db_name=substr($_config['db_connect'], strrpos($_config['db_connect'], "dbname=")+7); - echo "DB name: $db_name\n"; + $db_host=substr($_config['db_connect'], strrpos($_config['db_connect'], "host=")+5, strrpos($_config['db_connect'], ";") - strlen($_config['db_connect'])); + echo "DB name: $db_name, DB host: $db_host\n"; echo "Downloading the blockchain dump from arionum.info\n"; $arofile=__DIR__ . '/tmp/aro.sql'; if (file_exists("/usr/bin/curl")) { @@ -109,7 +110,7 @@ if ($current['height']==1) { echo "Importing the blockchain dump\n"; - system("mysql -u ".escapeshellarg($_config['db_user'])." -p".escapeshellarg($_config['db_pass'])." ".escapeshellarg($db_name). " < ".$arofile); + system("mysql -h ".escapeshellarg($db_host)." -u ".escapeshellarg($_config['db_user'])." -p".escapeshellarg($_config['db_pass'])." ".escapeshellarg($db_name). " < ".$arofile); echo "Bootstrapping completed. Sleeping for 3 min. \n"; sleep(180); $current = $block->current();