mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Changelog and some small changes for #639
This commit is contained in:
parent
3fc14db5d5
commit
375865d80e
@ -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-)
|
||||
|
@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
class ERequirementNotMet extends Exception {
|
||||
}
|
||||
class ERequirementNotMet extends Exception { }
|
||||
|
||||
const REQUIRED_PHP_EXTENSIONS = array('fileinfo', 'pdo_sqlite', 'gd');
|
||||
|
||||
const REQUIRED_PHP_EXTENSIONS = array("fileinfo", "pdo_sqlite", "gd");
|
||||
|
||||
class PrerequisiteChecker {
|
||||
|
||||
public function checkRequirements() {
|
||||
class PrerequisiteChecker
|
||||
{
|
||||
public function checkRequirements()
|
||||
{
|
||||
self::checkForConfigFile();
|
||||
self::checkForConfigDistFile();
|
||||
self::checkForComposer();
|
||||
@ -17,34 +16,47 @@ class PrerequisiteChecker {
|
||||
}
|
||||
|
||||
|
||||
private function checkForConfigFile() {
|
||||
if (!file_exists(__DIR__ . "/../data/config.php"))
|
||||
throw new ERequirementNotMet("/data/config.php not found. Have you copied config-dist.php to the data directory and renamed it to config.php?");
|
||||
private function checkForConfigFile()
|
||||
{
|
||||
if (!file_exists(__DIR__ . '/../data/config.php'))
|
||||
{
|
||||
throw new ERequirementNotMet('/data/config.php not found. Have you copied config-dist.php to the data directory and renamed it to config.php?');
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForConfigDistFile() {
|
||||
if (!file_exists(__DIR__ . "/../config-dist.php"))
|
||||
throw new ERequirementNotMet("config-dist.php not found. Please do not remove this file.");
|
||||
private function checkForConfigDistFile()
|
||||
{
|
||||
if (!file_exists(__DIR__ . '/../config-dist.php'))
|
||||
{
|
||||
throw new ERequirementNotMet('config-dist.php not found. Please do not remove this file.');
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForComposer() {
|
||||
if (!file_exists(__DIR__ . "/../vendor/autoload.php"))
|
||||
throw new ERequirementNotMet("/vendor/autoload.php not found. Have you run Composer?");
|
||||
private function checkForComposer()
|
||||
{
|
||||
if (!file_exists(__DIR__ . '/../vendor/autoload.php'))
|
||||
{
|
||||
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForYarn() {
|
||||
if (!file_exists(__DIR__ . "/../public/node_modules"))
|
||||
throw new ERequirementNotMet("/public/node_modules not found. Have you run Yarn?");
|
||||
private function checkForYarn()
|
||||
{
|
||||
if (!file_exists(__DIR__ . '/../public/node_modules'))
|
||||
{
|
||||
throw new ERequirementNotMet('/public/node_modules not found. Have you run Yarn?');
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForPhpExtensions() {
|
||||
private function checkForPhpExtensions()
|
||||
{
|
||||
$loadedExtensions = get_loaded_extensions();
|
||||
foreach (REQUIRED_PHP_EXTENSIONS as $extension) {
|
||||
foreach (REQUIRED_PHP_EXTENSIONS as $extension)
|
||||
{
|
||||
if (!in_array($extension, $loadedExtensions))
|
||||
{
|
||||
throw new ERequirementNotMet("PHP module '{$extension}' not installed, but required.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -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';
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user