also remove let's encrypt certificate for froxlor-hostname when updating to acme.sh; make installation more mysql/mariadb compatible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -104,7 +104,7 @@ class FroxlorInstall
|
|||||||
// check if we have a valid installation already
|
// check if we have a valid installation already
|
||||||
$this->_checkUserdataFile();
|
$this->_checkUserdataFile();
|
||||||
// include the MySQL-Table-Definitions
|
// include the MySQL-Table-Definitions
|
||||||
require $this->_basepath . '/lib/tables.inc.php';
|
require_once $this->_basepath . '/lib/tables.inc.php';
|
||||||
// include language
|
// include language
|
||||||
$this->_includeLanguageFile();
|
$this->_includeLanguageFile();
|
||||||
// show the action
|
// show the action
|
||||||
@@ -643,21 +643,8 @@ class FroxlorInstall
|
|||||||
|
|
||||||
$mysql_access_host_array[] = $this->_data['serverip'];
|
$mysql_access_host_array[] = $this->_data['serverip'];
|
||||||
foreach ($mysql_access_host_array as $mysql_access_host) {
|
foreach ($mysql_access_host_array as $mysql_access_host) {
|
||||||
$_db = str_replace('`', '', $this->_data['mysql_database']);
|
$frox_db = str_replace('`', '', $this->_data['mysql_database']);
|
||||||
$stmt = $db_root->prepare("
|
$this->_grantDbPrivilegesTo($db_root, $frox_db, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $mysql_access_host);
|
||||||
GRANT ALL PRIVILEGES ON `" . $_db . "`.*
|
|
||||||
TO :username@:host
|
|
||||||
IDENTIFIED BY 'password'");
|
|
||||||
$stmt->execute(array(
|
|
||||||
"username" => $this->_data['mysql_unpriv_user'],
|
|
||||||
"host" => $mysql_access_host
|
|
||||||
));
|
|
||||||
$stmt = $db_root->prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)");
|
|
||||||
$stmt->execute(array(
|
|
||||||
"username" => $this->_data['mysql_unpriv_user'],
|
|
||||||
"host" => $mysql_access_host,
|
|
||||||
"password" => $this->_data['mysql_unpriv_pass']
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_root->query("FLUSH PRIVILEGES;");
|
$db_root->query("FLUSH PRIVILEGES;");
|
||||||
@@ -667,6 +654,38 @@ class FroxlorInstall
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _grantDbPrivilegesTo(&$db_root, $database, $username, $password, $access_host)
|
||||||
|
{
|
||||||
|
// mysql8 compatibility
|
||||||
|
if (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) {
|
||||||
|
// create user
|
||||||
|
$stmt = $db_root->prepare("
|
||||||
|
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password
|
||||||
|
");
|
||||||
|
$stmt->execute(array(
|
||||||
|
"password" => $password
|
||||||
|
));
|
||||||
|
// grant privileges
|
||||||
|
$stmt = $db_root->prepare("
|
||||||
|
GRANT ALL ON `" . $database . "`.* TO :username@:host
|
||||||
|
");
|
||||||
|
$stmt->execute(array(
|
||||||
|
"username" => $username,
|
||||||
|
"host" => $access_host
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
// grant privileges
|
||||||
|
$stmt = $db_root->prepare("
|
||||||
|
GRANT ALL PRIVILEGES ON `" . $database . "`.* TO :username@:host IDENTIFIED BY :password
|
||||||
|
");
|
||||||
|
$stmt->execute(array(
|
||||||
|
"username" => $username,
|
||||||
|
"host" => $access_host,
|
||||||
|
"password" => $password
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an old database exists and back it up if necessary
|
* Check if an old database exists and back it up if necessary
|
||||||
*
|
*
|
||||||
@@ -1060,12 +1079,13 @@ class FroxlorInstall
|
|||||||
*/
|
*/
|
||||||
private function _sendHeaders()
|
private function _sendHeaders()
|
||||||
{
|
{
|
||||||
// no caching
|
if (@php_sapi_name() !== 'cli') {
|
||||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
// no caching
|
||||||
header("Pragma: no-cache");
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
header("Pragma: no-cache");
|
||||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||||
|
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||||
|
}
|
||||||
// ensure that default timezone is set
|
// ensure that default timezone is set
|
||||||
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
|
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
|
||||||
@date_default_timezone_set(@date_default_timezone_get());
|
@date_default_timezone_set(@date_default_timezone_get());
|
||||||
@@ -1082,7 +1102,7 @@ class FroxlorInstall
|
|||||||
if (file_exists($userdata)) {
|
if (file_exists($userdata)) {
|
||||||
// includes the usersettings (MySQL-Username/Passwort)
|
// includes the usersettings (MySQL-Username/Passwort)
|
||||||
// to test if Froxlor is already installed
|
// to test if Froxlor is already installed
|
||||||
require $this->_basepath . '/lib/userdata.inc.php';
|
require_once $this->_basepath . '/lib/userdata.inc.php';
|
||||||
|
|
||||||
if (isset($sql) && is_array($sql)) {
|
if (isset($sql) && is_array($sql)) {
|
||||||
// use sparkle theme for the notice
|
// use sparkle theme for the notice
|
||||||
@@ -1126,7 +1146,7 @@ class FroxlorInstall
|
|||||||
$lngfile = $this->_basepath . '/install/lng/' . $standardlanguage . '.lng.php';
|
$lngfile = $this->_basepath . '/install/lng/' . $standardlanguage . '.lng.php';
|
||||||
if (file_exists($lngfile)) {
|
if (file_exists($lngfile)) {
|
||||||
// includes file /lng/$language.lng.php if it exists
|
// includes file /lng/$language.lng.php if it exists
|
||||||
require $lngfile;
|
require_once $lngfile;
|
||||||
$this->_lng = $lng;
|
$this->_lng = $lng;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,7 +1155,7 @@ class FroxlorInstall
|
|||||||
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php';
|
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php';
|
||||||
if (file_exists($lngfile)) {
|
if (file_exists($lngfile)) {
|
||||||
// includes file /lng/$language.lng.php if it exists
|
// includes file /lng/$language.lng.php if it exists
|
||||||
require $lngfile;
|
require_once $lngfile;
|
||||||
$this->_lng = $lng;
|
$this->_lng = $lng;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,6 +220,10 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201902120')) {
|
|||||||
$domain_in = substr($domain_in, 0, - 1);
|
$domain_in = substr($domain_in, 0, - 1);
|
||||||
Database::query("DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` IN (" . $domain_in . ")");
|
Database::query("DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` IN (" . $domain_in . ")");
|
||||||
}
|
}
|
||||||
|
// check for froxlor domain using let's encrypt
|
||||||
|
if (Settings::Get('system.le_froxlor_enabled') == 1) {
|
||||||
|
Database::query("DELETE FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = '0'");
|
||||||
|
}
|
||||||
lastStepStatus(0);
|
lastStepStatus(0);
|
||||||
|
|
||||||
showUpdateStep("Inserting job to regenerate configfiles");
|
showUpdateStep("Inserting job to regenerate configfiles");
|
||||||
|
|||||||
Reference in New Issue
Block a user