From 3fc14db5d57a809c18f4f31bdd81b3d672eb4b6e Mon Sep 17 00:00:00 2001 From: Marc Ole Bulling Date: Sun, 22 Mar 2020 16:55:23 +0000 Subject: [PATCH 1/2] Check if all dependencies are installed (#639) * Added check if all dependencies are installed and config.php/config-dist.php exists * Also check for php modules * Uncomment code that was accidentally disabled for debug purposes --- helpers/PrerequisiteChecker.php | 50 +++++++++++++++++++++++++++++++++ public/index.php | 10 +++++++ 2 files changed, 60 insertions(+) create mode 100644 helpers/PrerequisiteChecker.php diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php new file mode 100644 index 00000000..5730081a --- /dev/null +++ b/helpers/PrerequisiteChecker.php @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/public/index.php b/public/index.php index 64e013e1..f65a1f7a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,3 +1,13 @@ checkRequirements(); +} catch (ERequirementNotMet $e) { + die("Unable to run grocy: " . $e->getMessage()); +} + require_once __DIR__ . '/../app.php'; + +?> \ No newline at end of file From 375865d80e54f71ee355bb3bd8f00d04a11cd6f3 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 22 Mar 2020 18:02:19 +0100 Subject: [PATCH 2/2] Changelog and some small changes for #639 --- changelog/57_UNRELEASED_2020-xx-xx.md | 1 + helpers/PrerequisiteChecker.php | 60 ++++++++++++++++----------- public/index.php | 11 ++--- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/changelog/57_UNRELEASED_2020-xx-xx.md b/changelog/57_UNRELEASED_2020-xx-xx.md index a1e9d657..b8f0e1ed 100644 --- a/changelog/57_UNRELEASED_2020-xx-xx.md +++ b/changelog/57_UNRELEASED_2020-xx-xx.md @@ -2,4 +2,5 @@ - Fixed a PHP notice on the recipes page when there are no recipes (thanks @mrunkel) ### General & other improvements +- Prerequisites (PHP extensions, critical files/folders) will now be checked and properly reported if there are problems (thanks @Forceu) - Improved the the overview pages on mobile devices (main column was hidden) (thanks @Mik-) diff --git a/helpers/PrerequisiteChecker.php b/helpers/PrerequisiteChecker.php index 5730081a..96e16c3e 100644 --- a/helpers/PrerequisiteChecker.php +++ b/helpers/PrerequisiteChecker.php @@ -1,14 +1,13 @@ \ No newline at end of file diff --git a/public/index.php b/public/index.php index f65a1f7a..e22b3975 100644 --- a/public/index.php +++ b/public/index.php @@ -2,12 +2,13 @@ require_once __DIR__ . '/../helpers/PrerequisiteChecker.php'; -try { +try +{ (new PrerequisiteChecker)->checkRequirements(); -} catch (ERequirementNotMet $e) { - die("Unable to run grocy: " . $e->getMessage()); +} +catch (ERequirementNotMet $ex) +{ + die('Unable to run grocy: ' . $ex->getMessage()); } require_once __DIR__ . '/../app.php'; - -?> \ No newline at end of file