Update sanity.php
Add support for db host name in bootstraping
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user