check php-extension requirements not only on installation (e.g. when php version was changed)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
19
lib/init.php
19
lib/init.php
@@ -65,6 +65,7 @@ use Froxlor\UI\Linker;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
use Froxlor\UI\Response;
|
||||
use Froxlor\Install\Requirements;
|
||||
|
||||
// include MySQL-tabledefinitions
|
||||
require Froxlor::getInstallDir() . '/lib/tables.inc.php';
|
||||
@@ -126,6 +127,24 @@ if ($_SERVER['SERVER_NAME'] != Settings::Get('system.hostname') &&
|
||||
die();
|
||||
}
|
||||
|
||||
// validate php-extensions requirements
|
||||
$loadedExtensions = get_loaded_extensions();
|
||||
$missingExtensions = [];
|
||||
foreach (Requirements::REQUIRED_EXTENSIONS as $requiredExtension) {
|
||||
if (in_array($requiredExtension, $loadedExtensions)) {
|
||||
continue;
|
||||
}
|
||||
$missingExtensions[] = $requiredExtension;
|
||||
}
|
||||
if (!empty($missingExtensions)) {
|
||||
UI::twig()->addGlobal('install_mode', '1');
|
||||
echo UI::twig()->render($_deftheme . '/misc/missingextensionhint.html.twig', [
|
||||
'phpversion' => phpversion(),
|
||||
'missing_extensions' => implode(", ", $missingExtensions),
|
||||
]);
|
||||
die();
|
||||
}
|
||||
|
||||
// set error-handler
|
||||
@set_error_handler([
|
||||
'\\Froxlor\\PhpHelper',
|
||||
|
||||
Reference in New Issue
Block a user