check for all needed php extensions and mysqldump tool in setup process, fixes #569

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-09-19 11:15:03 +02:00
parent 6161ad1bd3
commit 91195fda89
3 changed files with 70 additions and 67 deletions

View File

@@ -964,84 +964,39 @@ class FroxlorInstall
} else { } else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']); $content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
} }
// check for session-extension
$this->_requirementCheckFor($content, $_die, 'session', false, 'phpsession');
// check for ctype-extension
$this->_requirementCheckFor($content, $_die, 'ctype', false, 'phpctype');
// check for SimpleXML-extension
$this->_requirementCheckFor($content, $_die, 'simplexml', false, 'phpsimplexml');
// check for xml-extension // check for xml-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpxml']); $this->_requirementCheckFor($content, $_die, 'xml', false, 'phpxml');
if (! extension_loaded('xml')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for filter-extension // check for filter-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpfilter']); $this->_requirementCheckFor($content, $_die, 'filter', false, 'phpfilter');
if (! extension_loaded('filter')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for posix-extension // check for posix-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpposix']); $this->_requirementCheckFor($content, $_die, 'posix', false, 'phpposix');
if (! extension_loaded('posix')) { // check for mbstring-extension
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); $this->_requirementCheckFor($content, $_die, 'mbstring', false, 'phpmbstring');
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for bstring-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpmbstring']);
if (! extension_loaded('mbstring')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for curl extension // check for curl extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpcurl']); $this->_requirementCheckFor($content, $_die, 'curl', false, 'phpcurl');
if (! extension_loaded('curl')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for json extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpjson']);
if (! extension_loaded('json')) { // check for json extension
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']); $this->_requirementCheckFor($content, $_die, 'json', false, 'phpjson');
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for bcmath extension // check for bcmath extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpbcmath']); $this->_requirementCheckFor($content, $_die, 'bcmath', true, 'phpbcmath', 'bcmathdescription');
if (! extension_loaded('bcmath')) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['bcmathdescription']);
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for zip extension // check for zip extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpzip']); $this->_requirementCheckFor($content, $_die, 'zip', true, 'phpzip', 'zipdescription');
if (! extension_loaded('zip')) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['zipdescription']);
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for open_basedir // check for open_basedir
$content .= $this->_status_message('begin', $this->_lng['requirements']['openbasedir']); $content .= $this->_status_message('begin', $this->_lng['requirements']['openbasedir']);
@@ -1051,6 +1006,16 @@ class FroxlorInstall
} else { } else {
$content .= $this->_status_message('green', 'off'); $content .= $this->_status_message('green', 'off');
} }
// check for mysqldump binary in order to backup existing database
$content .= $this->_status_message('begin', $this->_lng['requirements']['mysqldump']);
if (file_exists("/usr/bin/mysqldump") || file_exists("/usr/local/bin/mysqldump")) {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
} else {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['mysqldumpmissing']);
}
$content .= "</table>"; $content .= "</table>";
// check if we have unrecoverable errors // check if we have unrecoverable errors
@@ -1073,6 +1038,22 @@ class FroxlorInstall
'pagenavigation' => $navigation 'pagenavigation' => $navigation
); );
} }
private function _requirementCheckFor(&$content, &$_die, $ext = '', $optional = false, $lng_txt = "", $lng_desc = "")
{
$content .= $this->_status_message('begin', $this->_lng['requirements'][$lng_txt]);
if (! extension_loaded($ext)) {
if (!$optional) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements'][$lng_desc]);
}
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
}
/** /**
* send no-caching headers and set the default timezone * send no-caching headers and set the default timezone
@@ -1141,12 +1122,24 @@ class FroxlorInstall
} }
} }
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php'; // require english base language as fallback
$lngfile = $this->_basepath . '/install/lng/english.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 $lngfile;
$this->_lng = $lng; $this->_lng = $lng;
} }
// require chosen language if not english
if ($this->_activelng != 'english')
{
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php';
if (file_exists($lngfile)) {
// includes file /lng/$language.lng.php if it exists
require $lngfile;
$this->_lng = $lng;
}
}
} }
/** /**

View File

@@ -28,6 +28,9 @@ $lng['requirements']['newerphpprefered'] = 'Good, but php-5.6 is prefered.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...'; $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']['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']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...'; $lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
$lng['requirements']['phpsession'] = 'PHP session-extension...';
$lng['requirements']['phpctype'] = 'PHP ctype-extension...';
$lng['requirements']['phpsimplexml'] = 'PHP SimpleXML-extension...';
$lng['requirements']['phpxml'] = 'PHP XML-extension...'; $lng['requirements']['phpxml'] = 'PHP XML-extension...';
$lng['requirements']['phpfilter'] = 'PHP filter-extension...'; $lng['requirements']['phpfilter'] = 'PHP filter-extension...';
$lng['requirements']['phpposix'] = 'PHP posix-extension...'; $lng['requirements']['phpposix'] = 'PHP posix-extension...';
@@ -40,6 +43,8 @@ $lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functio
$lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.'; $lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.';
$lng['requirements']['openbasedir'] = 'open_basedir...'; $lng['requirements']['openbasedir'] = 'open_basedir...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini'; $lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini';
$lng['requirements']['mysqldump'] = 'MySQL dump tool';
$lng['requirements']['mysqldumpmissing'] = 'Automatic backup of possible existing database is not possible. Please install mysql-client tools';
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.'; $lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied'; $lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied';

View File

@@ -28,6 +28,9 @@ $lng['requirements']['newerphpprefered'] = 'Passt, aber php-5.6 wird bevorzugt.'
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime'; $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']['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']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...'; $lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
$lng['requirements']['phpsession'] = 'PHP session-Erweiterung...';
$lng['requirements']['phpctype'] = 'PHP ctype-Erweiterung...';
$lng['requirements']['phpsimplexml'] = 'PHP SimpleXML-Erweiterung...';
$lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...'; $lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...';
$lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...'; $lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...';
$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...'; $lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...';
@@ -40,6 +43,8 @@ $lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funkti
$lng['requirements']['zipdescription'] = 'Die Auto-Update Funktion benötigt die zip Erweiterung.'; $lng['requirements']['zipdescription'] = 'Die Auto-Update Funktion benötigt die zip Erweiterung.';
$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...'; $lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini'; $lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini';
$lng['requirements']['mysqldump'] = 'MySQL dump Tool';
$lng['requirements']['mysqldumpmissing'] = 'Ein automatisches Backup einer möglicherweise schon existierenden Datenbank nicht möglich. Bitte mysql-client installieren';
$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.'; $lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.';
$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt'; $lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt';