Allow to call setup.php outside to test PHP version and extensions #1209

This commit is contained in:
the-djmaze 2023-08-28 14:43:53 +02:00
parent 120873c7d6
commit 44c4514622

View file

@ -1,14 +1,13 @@
<?php
if (defined('APP_VERSION')) {
if (PHP_VERSION_ID < 70400) {
if (PHP_VERSION_ID < 70400) {
echo '<p style="color: red">';
echo '[301] Your PHP version ('.PHP_VERSION.') is lower than the minimal required 7.4.0!';
echo '</p>';
exit(301);
}
}
$aOptional = array(
$aOptional = array(
'cURL' => extension_loaded('curl'),
'exif' => extension_loaded('exif'),
'finfo' => class_exists('finfo'),
@ -29,9 +28,9 @@ if (defined('APP_VERSION')) {
'uuid' => extension_loaded('uuid'),
'xxtea' => extension_loaded('xxtea'),
'zip' => extension_loaded('zip')
);
);
$aRequirements = array(
$aRequirements = array(
'mbstring' => extension_loaded('mbstring'),
'Zlib' => extension_loaded('zlib'),
// enabled by default:
@ -40,9 +39,9 @@ if (defined('APP_VERSION')) {
'dom' => class_exists('DOMDocument')
// https://github.com/the-djmaze/snappymail/issues/392
// 'phar' => class_exists('PharData')
);
);
if (in_array(false, $aRequirements)) {
if (in_array(false, $aRequirements)) {
echo '<p>[302] The following PHP extensions are not available in your PHP configuration!</p>';
echo '<ul>';
foreach ($aRequirements as $sKey => $bValue) {
@ -52,8 +51,9 @@ if (defined('APP_VERSION')) {
}
echo '</ul>';
exit(302);
}
}
if (defined('APP_VERSION')) {
$sCheckName = 'delete_if_you_see_it_after_install';
$sCheckFolder = APP_DATA_FOLDER_PATH.$sCheckName;
$sCheckFilePath = APP_DATA_FOLDER_PATH.$sCheckName.'/'.$sCheckName.'.file';