partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 03d22154a2eed9f890d36cd453456e7424cf742a
parent cde194e3029cc4ce141e944eb3345d5245fc8038
Author: dromer <1185977+dromer@users.noreply.github.com>
Date:   Sun, 12 Apr 2020 06:47:14 +0200

Merge pull request #1099 from christianlupus/dev/requirements

Added requirements for PHP<7.2 and FreeType extension
Diffstat:
Mapp/PartKeeprRequirements.php | 61++++++++++++++++++++++++++++++++++++++++++++-----------------
Mweb/setup/tests/check-php.php | 3+++
2 files changed, 47 insertions(+), 17 deletions(-)

diff --git a/app/PartKeeprRequirements.php b/app/PartKeeprRequirements.php @@ -12,28 +12,43 @@ class PartKeeprRequirements extends SymfonyRequirements $this->addRequirement( ini_get('allow_url_fopen') || function_exists('curl_init'), sprintf('No way to remotely load files detected'), - sprintf('Either set <strong>allow_url_fopen=true</strong> or install the cURL extension')); + sprintf('Either set <strong>allow_url_fopen=true</strong> or install the cURL extension') + ); $this->addRequirement( function_exists('imagecreate'), sprintf('GD library not found'), - sprintf('Install the GD library extension')); + sprintf('Install the GD library extension') + ); + + $this->addRequirement( + function_exists('imagettftext'), + sprintf('GD library has no FreeType support'), + sprintf('Install the FreeType extension and make sure GD extention can use it') + ); $this->addRequirement( function_exists('ldap_connect'), sprintf('LDAP library not found'), - sprintf('Install the LDAP library extension')); + sprintf('Install the LDAP library extension') + ); $this->addRequirement( function_exists('curl_init'), sprintf('CURL library not found'), - sprintf('Install the CURL library extension')); + sprintf('Install the CURL library extension') + ); - $this->addPhpIniRequirement('memory_limit', $this->getBytesIniSetting('memory_limit') > 128000000, + $this->addPhpIniRequirement( + 'memory_limit', + $this->getBytesIniSetting('memory_limit') > 128000000, false, 'Memory Limit too small', - sprintf('The php.ini memory_limit directive must be set to 128MB or higher. Your limit is set to %s', - ini_get('memory_limit'))); + sprintf( + 'The php.ini memory_limit directive must be set to 128MB or higher. Your limit is set to %s', + ini_get('memory_limit') + ) + ); $this->checkWritable(realpath(dirname(__FILE__).'/../data/')); $this->checkWritable(realpath(dirname(__FILE__).'/../app/')); @@ -45,12 +60,15 @@ class PartKeeprRequirements extends SymfonyRequirements sprintf('For best performance install the PHP APCu cache') ); - $this->addPhpIniRecommendation('max_execution_time', + $this->addPhpIniRecommendation( + 'max_execution_time', ini_get('max_execution_time') > 30, true, sprintf('Maximum Execution Time might be too low'), - sprintf('Your maximum execution time is set to %d seconds, which might be too low for low-end systems. If you encounter problems, please increase the value.', - ini_get('max_execution_time')) + sprintf( + 'Your maximum execution time is set to %d seconds, which might be too low for low-end systems. If you encounter problems, please increase the value.', + ini_get('max_execution_time') + ) ); $this->addRequirement( @@ -67,15 +85,21 @@ class PartKeeprRequirements extends SymfonyRequirements if (ini_get('opcache.enable')) { if (version_compare(phpversion(), '7.0', '<')) { - $this->addPhpIniRequirement('opcache.save_comments', 1, + $this->addPhpIniRequirement( + 'opcache.save_comments', + 1, false, 'opcache.save_comments must be on', - sprintf('The php.ini opcache.save_comments directive must be set to 1.')); + sprintf('The php.ini opcache.save_comments directive must be set to 1.') + ); - $this->addPhpIniRequirement('opcache.load_comments', 1, + $this->addPhpIniRequirement( + 'opcache.load_comments', + 1, false, 'opcache.load_comments must be on', - sprintf('The php.ini opcache.load_comments directive must be set to 1.')); + sprintf('The php.ini opcache.load_comments directive must be set to 1.') + ); } } } @@ -92,9 +116,12 @@ class PartKeeprRequirements extends SymfonyRequirements } catch (\Exception $e) { $this->addRequirement( false, - sprintf('Directory %s and all subfolders/files must be writable.<br/><br/>If you already set the subfolders and files writable, you might have SELinux installed. Read <a href="https://wiki.partkeepr.org/wiki/SELinux" target="_blank">the PartKeepr SELinux Wiki Article</a> for further information.<br/>', - $path), - $e->getMessage()); + sprintf( + 'Directory %s and all subfolders/files must be writable.<br/><br/>If you already set the subfolders and files writable, you might have SELinux installed. Read <a href="https://wiki.partkeepr.org/wiki/SELinux" target="_blank">the PartKeepr SELinux Wiki Article</a> for further information.<br/>', + $path + ), + $e->getMessage() + ); } } diff --git a/web/setup/tests/check-php.php b/web/setup/tests/check-php.php @@ -5,6 +5,9 @@ if (version_compare(phpversion(), '5.6.0', '<')) { echo '{"success": false, "message": "PHP Version '.phpversion().' is too old, minimum required version is PHP 5.6.",'; echo '"errors": ["Your PHP Version is too old. The minimum required version is 5.6.0. '; echo '<a target=\"_blank\" href=\"https://wiki.partkeepr.org/wiki/KB00003:PHP_Version\">Read moreā€¦</a>"]}'; +} elseif (version_compare(phpversion(), '7.2', '>=')) { + echo '{"success": false, "message": "PHP Version '.phpversion().' is not supported.",'; + echo '"errors": ["Your PHP Version is too new. PartKeepr currently only works well with PHP <= 7.1."]}'; } else { echo '{"success": true, "message": "PHP Version '.phpversion().' found"}'; }