From 76fbd3790ff4a48e2de3d9730a67bb1107f08f97 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 2 Sep 2020 10:47:42 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03123=20-=20Update=20the=20list=20of=20re?= =?UTF-8?q?quired=20PHP=20extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/setuputils.class.inc.php | 69 ++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 881db8462..ba15598d9 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -136,29 +136,8 @@ class SetupUtils $aWritableDirsErrors = self::CheckWritableDirs(array('log', 'env-production', 'env-production-build', 'conf', 'data')); $aResult = array_merge($aResult, $aWritableDirsErrors); - $aMandatoryExtensions = array( - 'mysqli', - 'iconv', - 'simplexml', - 'soap', - 'hash', - 'json', - 'session', - 'pcre', - 'dom', - 'zlib', - 'gd', // test image type (always returns false if not installed), image resizing, PDF export - ); - $aOptionalExtensions = array( - 'mcrypt, sodium or openssl' => - array( - 'mcrypt' => 'Strong encryption will not be used.', - 'sodium' => 'Strong encryption will not be used.', - 'openssl' => 'Strong encryption will not be used.', - ), - 'ldap' => 'LDAP authentication will be disabled.', - 'mbstring' => 'For CryptEngine implementations, trace in Mail to ticket automation', // N°2891 - ); + $aMandatoryExtensions = self::GetPHPMandatoryExtensions(); + $aOptionalExtensions = self::GetPHPOptionalExtensions(); asort($aMandatoryExtensions); // Sort the list to look clean ! ksort($aOptionalExtensions); // Sort the list to look clean ! @@ -2122,6 +2101,50 @@ JS IssueLog::Info($sText); } } + + /** + * @return string[] + */ + public static function GetPHPMandatoryExtensions(): array + { + return [ + 'mysqli', + 'iconv', + 'simplexml', + 'soap', + 'hash', + 'json', + 'session', + 'pcre', + 'dom', + 'zlib', + 'zip', + 'fileinfo', // N°3123 + 'gd', // test image type (always returns false if not installed), image resizing, PDF export + ]; + } + + /** + * @return array + */ + public static function GetPHPOptionalExtensions(): array + { + $aOptionalExtensions = [ + 'mcrypt, sodium or openssl' => [ + 'mcrypt' => 'Strong encryption will not be used.', + 'sodium' => 'Strong encryption will not be used.', + 'openssl' => 'Strong encryption will not be used.', + ], + 'ldap' => 'LDAP authentication will be disabled.', + 'mbstring' => 'For CryptEngine implementations, trace in Mail to ticket automation', // N°2891 + ]; + + if (utils::IsDevelopmentEnvironment()) { + $aOptionalExtensions['xdebug'] = 'For debugging'; + } + + return $aOptionalExtensions; + } } /**