CHANGE: detect missing imap extension and config error

This commit is contained in:
synox 2019-03-10 22:17:59 +07:00
parent 727c41f207
commit 38e1d4fd42
3 changed files with 11 additions and 0 deletions

View file

@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. The format
### Changed
- find config.php automatically in current and parent directories. Show error message if not found.
- use local CSS/JS instead of CDN
- detect missing imap extension and config error
## [0.2.1] - 2018-07-01

View file

@ -62,6 +62,11 @@ Install php dependecies:
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
## Testing on MacOs
* brew install php
* brew install kabel/php-ext/php-imap
* php -S localhost:8000 -t src
## Credit :thumbsup:

View file

@ -3,6 +3,8 @@ if (version_compare(phpversion(), '7.2', '<')) {
die("ERROR! The php version isn't high enough, you need at least 7.2 to run this application! But you have: " . phpversion());
}
extension_loaded("imap") || die('ERROR: IMAP extension not loaded. Please see the installation instructions in the README.md');
/**
* searches for a config-file in the current and parent directories until found.
* @return path to found config file, or FALSE otherwise.
@ -32,6 +34,9 @@ function load_config(){
$file = find_config();
if ( $file !== FALSE) {
require_once($file);
if(!isset($config) || !is_array($config)){
die('ERROR: Config file is invalid. Please see the installation instructions in the README.md');
}
} else {
die('ERROR: Config file not found. Please see the installation instructions in the README.md');
}