Merge pull request #1369 from sq5t/master

Small fixes for installator
这个提交包含在:
Peter Goodhall 2022-01-20 14:36:09 +00:00 提交者 GitHub
当前提交 0250ac28c2
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 29 次插入5 次删除

查看文件

@ -5,8 +5,20 @@ $db_config_path = '../application/config/';
$db_file_path = $db_config_path."database.php";
function delDir($dir) {
$files = glob( $dir . '*', GLOB_MARK );
foreach( $files as $file ){
if( substr( $file, -1 ) == '/' )
delDir( $file );
else
unlink( $file );
}
rmdir( $dir );
}
if (file_exists($db_file_path)) {
echo "Cloudlog is already installed, please delete the /install folder.";
delDir(getcwd());
header("../");
exit;
}
@ -40,11 +52,23 @@ if($_POST) {
// If no errors, redirect to registration page
if(!isset($message)) {
sleep(1);
$ch = curl_init();
$protocol=((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http";
list($realHost,)=explode(':',$_SERVER['HTTP_HOST']);
$cloudlog_url=$protocol."://".$realHost.":".$_SERVER['SERVER_PORT'];
curl_setopt($ch, CURLOPT_URL,$cloudlog_url);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL,$cloudlog_url."/index.php/update/dxcc");
$result = curl_exec($ch);
delDir(getcwd());
header('Location: '.$protocol."://".$_SERVER['HTTP_HOST'].$_POST['directory']);
echo "<h1>Install successful</h1>";
echo "<p>Please delete the install folder";
exit;
}
}
else {
$message = $core->show_message('error','Not all fields have been filled in correctly. The host, username, password, and database name are required.');
@ -139,4 +163,3 @@ if($_POST) {
</body>
</html>

查看文件

@ -256,8 +256,9 @@ if ( ! function_exists('get_config'))
}
elseif ( ! $found)
{
set_status_header(503);
echo 'The configuration file does not exist.';
// set_status_header(301);
header('Location: install/');
// echo 'The configuration file does not exist.';
exit(3); // EXIT_CONFIG
}