require php-5.6 for 0.10.0; fixes #606 and remove invalid value NO_AUTO_CREATE_USER in mysql-attributes for mysql8

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-03 17:15:54 +01:00
parent 2da59f1055
commit 4a0be40f92
9 changed files with 44 additions and 69 deletions

View File

@@ -28,7 +28,7 @@
"docs" : "https://github.com/Froxlor/Froxlor/wiki"
},
"require" : {
"php" : ">=5.3",
"php" : ">=5.6",
"ext-session" : "*",
"ext-ctype" : "*",
"ext-pdo" : "*",
@@ -51,7 +51,8 @@
"theseer/phpdox" : "0.11.2",
"phpunit/php-invoker" : "1.1.4",
"php" : ">=7.0",
"ext-pcntl" : "*"
"ext-pcntl" : "*",
"phpcompatibility/php-compatibility": "*"
},
"suggest" : {
"ext-bcmath" : "*",

View File

@@ -210,8 +210,13 @@ class FroxlorInstall
// check for mysql-root-connection
$content .= $this->_status_message('begin', $this->_lng['install']['testing_mysql']);
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";";
$fatal_fail = false;
@@ -247,8 +252,13 @@ class FroxlorInstall
$content .= $this->_importDatabaseData();
if (! $this->_abort) {
// create DB object for new database
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
$another_fail = false;
@@ -519,8 +529,13 @@ class FroxlorInstall
{
$content = "";
$content .= $this->_status_message('begin', $this->_lng['install']['testing_new_db']);
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
$fatal_fail = false;
@@ -932,29 +947,17 @@ class FroxlorInstall
// check for correct php version
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpversion']);
if (version_compare("5.3.0", PHP_VERSION, ">=")) {
if (version_compare("5.6.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notfound'] . ' (' . PHP_VERSION . ')');
$_die = true;
} else {
if (version_compare("5.6.0", PHP_VERSION, ">=")) {
if (version_compare("7.0.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['newerphpprefered'] . ' (' . PHP_VERSION . ')');
} else {
$content .= $this->_status_message('green', PHP_VERSION);
}
}
// Check if magic_quotes_runtime is active | get_magic_quotes_runtime() is always FALSE since 5.4
if (version_compare(PHP_VERSION, "5.4.0", "<")) {
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpmagic_quotes_runtime']);
if (get_magic_quotes_runtime()) {
// deactivate it
set_magic_quotes_runtime(false);
$content .= $this->_status_message('orange', $this->_lng['requirements']['not_true'] . "<br />" . $this->_lng['requirements']['phpmagic_quotes_runtime_description']);
} else {
$content .= $this->_status_message('green', 'off');
}
}
// check for php_pdo and pdo_mysql
$content .= $this->_status_message('begin', $this->_lng['requirements']['phppdo']);

View File

@@ -23,10 +23,8 @@ $lng['requirements']['not_true'] = 'no';
$lng['requirements']['notfound'] = 'not found';
$lng['requirements']['notinstalled'] = 'not installed';
$lng['requirements']['activated'] = 'enabled';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Good, but php-5.6 is prefered.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
$lng['requirements']['phpversion'] = 'PHP version >= 5.6';
$lng['requirements']['newerphpprefered'] = 'Good, but php-7.0 is prefered.';
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
$lng['requirements']['phpsession'] = 'PHP session-extension...';
$lng['requirements']['phpctype'] = 'PHP ctype-extension...';

View File

@@ -23,9 +23,7 @@ $lng['requirements']['not_true'] = 'non';
$lng['requirements']['notfound'] = 'introuvable';
$lng['requirements']['notinstalled'] = 'non installé';
$lng['requirements']['activated'] = 'activé';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Le réglage PHP "magic_quotes_runtime" doit être positionné à "Off". Nous l\'avons désactivé temporairement pour l\'instant; merci de corriger le php.ini correspondant.';
$lng['requirements']['phpversion'] = 'PHP version >= 5.6';
$lng['requirements']['phppdo'] = 'extension PHP PDO et pilote PDO-MySQL ...';
$lng['requirements']['phpxml'] = 'extension PHP XML...';
$lng['requirements']['phpfilter'] = 'extension PHP filter ...';

View File

@@ -23,10 +23,8 @@ $lng['requirements']['not_true'] = 'nein';
$lng['requirements']['notfound'] = 'nicht gefunden';
$lng['requirements']['notinstalled'] = 'nicht installiert';
$lng['requirements']['activated'] = 'ist aktiviert.';
$lng['requirements']['phpversion'] = 'PHP Version >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-5.6 wird bevorzugt.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
$lng['requirements']['phpversion'] = 'PHP Version >= 5.6';
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-7.0 wird bevorzugt.';
$lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
$lng['requirements']['phpsession'] = 'PHP session-Erweiterung...';
$lng['requirements']['phpctype'] = 'PHP ctype-Erweiterung...';

View File

@@ -127,13 +127,8 @@ abstract class ApiParameter
// which class called us
$_class = get_called_class();
if (empty($trace)) {
// check php version for backtrace flags
$_traceopts = false;
if (version_compare(PHP_VERSION, "5.3.6", ">")) {
$_traceopts = DEBUG_BACKTRACE_IGNORE_ARGS;
}
// get backtrace
$trace = debug_backtrace($_traceopts);
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
// check class and function
$class = $trace[$level]['class'];

View File

@@ -267,7 +267,14 @@ class Database {
// build up connection string
$driver = 'mysql';
$dsn = $driver.":";
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"');
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$attributes = array('ATTR_ERRMODE' => 'ERRMODE_EXCEPTION');
$dbconf["dsn"] = array(

View File

@@ -41,8 +41,13 @@ class PowerDNS
// build up connection string
$driver = 'mysql';
$dsn = $driver . ":";
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$attributes = array(
'ATTR_ERRMODE' => 'ERRMODE_EXCEPTION'

View File

@@ -140,36 +140,6 @@ if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
header($hsts_header);
}
/**
* disable magic_quotes_runtime if enabled
*/
// since 5.4 get_magic_quotes_runtime() and get_magic_quotes_gpc() return always FALSE
if (version_compare(PHP_VERSION, "5.4.0", "<")) {
if (get_magic_quotes_runtime()) {
// deactivate
set_magic_quotes_runtime(false);
}
/**
* Reverse magic_quotes_gpc=on to have clean GPC data again
*/
if (get_magic_quotes_gpc()) {
$in = array(&$_GET, &$_POST, &$_COOKIE);
$_in = $in;
foreach ($_in as $k => $v) {
foreach ($v as $key => $val) {
if (!is_array($val)) {
$in[$k][$key] = stripslashes($val);
continue;
}
$in[] = & $in[$k][$key];
}
}
unset($in);
}
}
/**
* SESSION MANAGEMENT
*/