Updated requirements in installer

This commit is contained in:
Wruczek 2020-10-07 00:33:34 +02:00
parent c317ac3614
commit 06b843353a
2 changed files with 27 additions and 42 deletions

View File

@ -51,14 +51,6 @@ if(!empty($_POST["allow-metrics-checkbox"])) {
</script>
<?php } else { ?>
<?php if (PHP_VERSION_ID < 70000) { ?>
<div class="text-center">
<div class="alert alert-danger" style="display: inline-block">
You are using PHP 5.6 which will not be supported in the future. Please upgrade.
</div>
</div>
<?php } ?>
<div class="text-center">
<div class="alert alert-success" style="display: inline-block">
<strong>Success!</strong> Looks like you can run TS-website 2.0!
@ -92,10 +84,10 @@ function checkRequirements() {
// PHP version - 5.6.0 minimum, < 7 warning, > 7 ok
{
$result = PHP_VERSION_ID < 50600 ? 2 : (PHP_VERSION_ID < 70000 ? 1 : 0);
$result = PHP_VERSION_ID < 70200 ? 2 : 0;
showCheckResult(
"PHP 5.6.0+ (7.0+ required soon)",
"PHP 7.2.0+",
$result,
"Current PHP version: " . phpversion()
);
@ -114,21 +106,6 @@ function checkRequirements() {
);
}
// password_hash and password_verify
{
$result = PHP_VERSION_ID >= 50500 && password_verify(
"ayy-lmao-m88", password_hash("ayy-lmao-m88", PASSWORD_DEFAULT)
);
showCheckResult(
"password_hash & password_verify",
$result ? 0 : 2,
$result ?
"Functions exists and work" :
"Please make sure your PHP version supports BCRYPT and BLOWFISH"
);
}
displayCategory("Extension checks");
// Extensions check

View File

@ -25,28 +25,36 @@ if (!empty($_POST)) {
$tsServer = $tsNodeHost->serverGetByPort($queryserverport);
if(is_array($tsServer->getInfo())) {
$utils = Config::i();
$tsVersion = $tsServer->getInfo()["virtualserver_version"];
$tsBuildNo = $tsVersion->section("[", 1)->filterDigits()->toInt();
$configdata = [
"query_hostname" => $queryhostname,
"query_port" => $queryport,
"tsserver_port" => $queryserverport,
"query_username" => $queryusername,
"query_password" => $querypassword,
"query_displayip" => $querydisplayip,
];
if ($tsBuildNo < 1564054246) {
$errormessage =
'Your TeamSpeak server version is not supported.<br>' .
'Current version: ' . TeamSpeak3_Helper_Convert::versionShort($tsVersion) . ' (build ' . $tsBuildNo . ')' . '<br>' .
'Supported versions: 3.10.0 (build 1564054246) and newer';
} else {
$configdata = [
"query_hostname" => $queryhostname,
"query_port" => $queryport,
"tsserver_port" => $queryserverport,
"query_username" => $queryusername,
"query_password" => $querypassword,
"query_displayip" => $querydisplayip,
];
foreach ($configdata as $key => $value) {
try {
$utils->setValue($key, $value);
} catch (\Exception $e) {
die("Error while updating config in database, at " . htmlspecialchars($key) . " => " . htmlspecialchars($value));
foreach ($configdata as $key => $value) {
try {
Config::i()->setValue($key, $value);
} catch (\Exception $e) {
die("Error while updating config in database, at " . htmlspecialchars($key) . " => " . htmlspecialchars($value));
}
}
}
$cacheIcons = true;
$cacheIcons = true;
}
} else {
$errormessage .= '<br>Cannot retrieve server information';
$errormessage = 'Cannot retrieve server information';
}
} catch (Exception $e) {
$errormessage = htmlspecialchars("Error " . $e->getCode() . ": " . $e->getMessage());