diff --git a/utility/restore.php b/utility/restore.php index 100abec1d202621dca8967af7b40a52e46e98e15..6dd136ede59caba30b4c1d2ed765b4e66937cc02 100644 --- a/utility/restore.php +++ b/utility/restore.php @@ -124,14 +124,17 @@ if($operation == 'import') { show_msg('database_import_succeed', '', 'message', 1); } } elseif($dumpinfo['method'] == 'shell') { - + $dbhost = $_config['db'][1]['dbhost']; + $dbname = $_config['db'][1]['dbname']; + $dbpw = $_config['db'][1]['dbpw']; + $dbuser = $_config['db'][1]['dbuser']; list($dbhost, $dbport) = explode(':', $dbhost); $query = $db->query("SHOW VARIABLES LIKE 'basedir'"); - list(, $mysql_base) = $db->fetch($query, $db->drivertype == 'mysqli' ? MYSQLI_NUM : MYSQL_NUM); - + list(, $mysql_base) = $db->fetch_array($query, $db->drivertype == 'mysqli' ? MYSQLI_NUM : MYSQL_NUM); + $datafile = addslashes(dirname(dirname(__FILE__))).str_replace('..', '', $datafile) ; $mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base).'bin/'; shell_exec($mysqlbin.'mysql -h"'.$dbhost.($dbport ? (is_numeric($dbport) ? ' -P'.$dbport : ' -S"'.$dbport.'"') : ''). - '" -u"'.$dbuser.'" -p"'.$dbpw.'" "'.$dbname.'" < '.getgpc('datafile')); + '" -u"'.$dbuser.'" -p"'.$dbpw.'" "'.$dbname.'" < '.$datafile); show_msg('database_import_succeed', '', 'message', 1); } else { @@ -317,14 +320,14 @@ function show_importfile_list($exportlog = array(), $exportziplog = array(), $ex } foreach($exportziplog as $key => $val) { - + sort($val);//确保-1.zip排前面,才会自动解压-2.zip $info = $val[0]; $info['dateline'] = is_int($info['dateline']) ? gmdate('Y-m-d H:i:s', $info['dateline'] + 3600 * 8) : lang('unknown'); $info['size'] = sizecount($info['size']); $info['method'] = $info['method'] == 'multivol' ? lang('db_multivol') : lang('db_zip'); echo "