Also check for php modules

This commit is contained in:
Marc Ole Bulling 2020-03-22 17:03:35 +01:00
parent 71b7a24462
commit 5236b755cd

View File

@ -3,13 +3,17 @@
class ERequirementNotMet extends Exception {
}
const REQUIRED_PHP_EXTENSIONS = array("fileinfo", "pdo_sqlite", "gd");
class PrerequisiteChecker {
public function checkRequirements() {
self::checkForConfigFile();
/* self::checkForConfigFile();
self::checkForConfigDistFile();
self::checkForComposer();
self::checkForYarn();
self::checkForYarn(); */
self::checkForPhpExtensions();
}
@ -32,6 +36,14 @@ class PrerequisiteChecker {
if (!file_exists(__DIR__ . "/../public/node_modules"))
throw new ERequirementNotMet("/public/node_modules not found. Have you run Yarn?");
}
private function checkForPhpExtensions() {
$loadedExtensions = get_loaded_extensions();
foreach (REQUIRED_PHP_EXTENSIONS as $extension) {
if (!in_array($extension, $loadedExtensions))
throw new ERequirementNotMet("PHP module '{$extension}' not installed, but required.");
}
}
}