Also check PHP_INT_SIZE if SnappyMail runs on 64bit

This commit is contained in:
the-djmaze 2022-12-30 15:34:31 +01:00
parent 4922586893
commit 5eef0b409b

View file

@ -1,63 +1,62 @@
<?php
if (defined('APP_VERSION'))
{
if (PHP_VERSION_ID < 70400)
{
if (defined('APP_VERSION')) {
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);
}
if (PHP_INT_SIZE < 8) {
echo '<p style="color: red">';
echo '[301] Your PHP version is 32bit, 64bit is required!';
echo '</p>';
exit(301);
}
$aOptional = array(
'cURL' => extension_loaded('curl'),
'exif' => extension_loaded('exif'),
'gd' => extension_loaded('gd'),
'gnupg' => extension_loaded('gnupg'),
'cURL' => extension_loaded('curl'),
'exif' => extension_loaded('exif'),
'finfo' => class_exists('finfo'),
'gd' => extension_loaded('gd'),
'gnupg' => extension_loaded('gnupg'),
'gmagick' => extension_loaded('gmagick'),
'imagick' => extension_loaded('imagick'),
'iconv' => function_exists('iconv'),
'intl' => function_exists('idn_to_ascii'),
'ldap' => extension_loaded('ldap'),
'iconv' => function_exists('iconv'),
'intl' => function_exists('idn_to_ascii'),
'ldap' => extension_loaded('ldap'),
'OpenSSL' => extension_loaded('openssl'),
'mysql' => extension_loaded('pdo_mysql'),
'pgsql' => extension_loaded('pdo_pgsql'),
'redis' => extension_loaded('redis'),
'Sodium' => extension_loaded('sodium'),
'sqlite' => extension_loaded('pdo_sqlite'),
'tidy' => extension_loaded('tidy'),
'uuid' => extension_loaded('uuid'),
'xxtea' => extension_loaded('xxtea'),
'zip' => extension_loaded('zip'),
'finfo' => class_exists('finfo')
'mysql' => extension_loaded('pdo_mysql'),
'pgsql' => extension_loaded('pdo_pgsql'),
'redis' => extension_loaded('redis'),
'Sodium' => extension_loaded('sodium'),
'sqlite' => extension_loaded('pdo_sqlite'),
'tidy' => extension_loaded('tidy'),
'uuid' => extension_loaded('uuid'),
'xxtea' => extension_loaded('xxtea'),
'zip' => extension_loaded('zip')
);
$aRequirements = array(
'mbstring' => extension_loaded('mbstring'),
'Zlib' => extension_loaded('zlib'),
'Zlib' => extension_loaded('zlib'),
// enabled by default:
'json' => function_exists('json_decode'),
'libxml' => function_exists('libxml_use_internal_errors'),
'dom' => class_exists('DOMDocument')
'json' => function_exists('json_decode'),
'libxml' => function_exists('libxml_use_internal_errors'),
'dom' => class_exists('DOMDocument')
// https://github.com/the-djmaze/snappymail/issues/392
// 'phar' => class_exists('PharData')
// '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)
{
if (!$bValue)
{
foreach ($aRequirements as $sKey => $bValue) {
if (!$bValue) {
echo '<li>'.$sKey.'</li>';
}
}
echo '</ul>';
exit(302);
}
@ -68,12 +67,9 @@ if (defined('APP_VERSION'))
is_file($sCheckFilePath) && unlink($sCheckFilePath);
is_dir($sCheckFolder) && rmdir($sCheckFolder);
if (!is_dir(APP_DATA_FOLDER_PATH))
{
if (!is_dir(APP_DATA_FOLDER_PATH)) {
mkdir(APP_DATA_FOLDER_PATH, 0700, true);
}
else
{
} else {
chmod(APP_DATA_FOLDER_PATH, 0700);
}
@ -115,18 +111,14 @@ if (defined('APP_VERSION'))
file_put_contents(APP_DATA_FOLDER_PATH.'INSTALLED', APP_VERSION);
file_put_contents(APP_DATA_FOLDER_PATH.'index.html', 'Forbidden');
file_put_contents(APP_DATA_FOLDER_PATH.'index.php', 'Forbidden');
if (!is_file(APP_DATA_FOLDER_PATH.'.htaccess') && is_file(__DIR__ . '/app/.htaccess'))
{
if (!is_file(APP_DATA_FOLDER_PATH.'.htaccess') && is_file(__DIR__ . '/app/.htaccess')) {
copy(__DIR__ . '/app/.htaccess', APP_DATA_FOLDER_PATH.'.htaccess');
}
if (!is_dir(APP_PRIVATE_DATA))
{
if (!is_dir(APP_PRIVATE_DATA)) {
mkdir(APP_PRIVATE_DATA, 0700, true);
file_put_contents(APP_PRIVATE_DATA.'.htaccess', 'Require all denied');
}
else if (is_dir(APP_PRIVATE_DATA.'cache'))
{
} else if (is_dir(APP_PRIVATE_DATA.'cache')) {
foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(APP_PRIVATE_DATA.'cache', FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST) as $sName) {
@ -135,16 +127,13 @@ if (defined('APP_VERSION'))
clearstatcache();
}
foreach (array('configs', 'domains', 'plugins', 'storage') as $sName)
{
if (!is_dir(APP_PRIVATE_DATA.$sName))
{
foreach (array('configs', 'domains', 'plugins', 'storage') as $sName) {
if (!is_dir(APP_PRIVATE_DATA.$sName)) {
mkdir(APP_PRIVATE_DATA.$sName, 0700, true);
}
}
if (!file_exists(APP_PRIVATE_DATA.'domains/disabled') && is_dir(APP_PRIVATE_DATA.'domains'))
{
if (!file_exists(APP_PRIVATE_DATA.'domains/disabled') && is_dir(APP_PRIVATE_DATA.'domains')) {
$aFiles = glob(__DIR__ . '/app/domains/*');
if ($aFiles) {
foreach ($aFiles as $sFile) {