Permalink
Browse files

Added check for openssl as mcrypt alternative within depcheck

  • Loading branch information...
sergeychernyshev committed Aug 6, 2018
1 parent 88a6385 commit 9fd27ec4d0cff355cba6fb4387638829e4842755
Showing with 24 additions and 6 deletions.
  1. +24 −6 depcheck.php
View
@@ -4,7 +4,7 @@
* http://startupapi.org/Startup_API/Installation#Prerequisites
*/
$required_php_version = '5.3.0';
$required_extensions = array('mysqli', 'mcrypt', 'curl', 'mbstring', 'json');
$required_extensions = array('mysqli', ['mcrypt', 'openssl'], 'curl', 'mbstring', 'json');
$current_php_version = phpversion();
if (version_compare($current_php_version, $required_php_version, '>=')) {
@@ -16,11 +16,29 @@
$current_php_extensions = get_loaded_extensions();
foreach ($required_extensions as $extension) {
if (in_array($extension, $current_php_extensions)) {
echo "PHP $extension extension is loaded ... OK\n";
foreach ($required_extensions as $requirement) {
if (is_array($requirement)) {
// check for one of the alternatives
$requirement_met = false;
foreach ($requirement as $extension) {
if (in_array($extension, $current_php_extensions)) {
echo "PHP $extension extension is loaded ... OK\n";
$requirement_met = true;
break;
}
}
if (!$requirement_met) {
echo("[Missing Dependency] You're using PHP installation which does not have at least one of the following extension enabled: " . implode(' or ', $requirement). "\n");
exit(1);
}
} else {
echo("[Missing Dependency] You're using PHP installation which does not have '$extension' extension enabled\n");
exit(1);
// check for required extension
if (in_array($requirement, $current_php_extensions)) {
echo "PHP $requirement extension is loaded ... OK\n";
} else {
echo("[Missing Dependency] You're using PHP installation which does not have '$extension' extension enabled\n");
exit(1);
}
}
}

0 comments on commit 9fd27ec

Please sign in to comment.