A free open source IT asset/license management system
Merge remote-tracking branch 'origin/develop'
snipe31d0b4a46c59
diff --cc upgrade.phpindex d971395d3d,013b819536..ebdba1071f--- a/upgrade.php+++ b/upgrade.php@@@ -45,33 -41,94 +41,118 @@@ if (version_compare(PHP_VERSION, $requiexit;} else {- echo "PHP version: " . PHP_VERSION . " is at least ".$required_version." - continuing... \n\n";+ echo "Current PHP version: (" . PHP_VERSION . ") is at least ".$required_version." - continuing... \n";+ echo sprintf("FYI: The php.ini used by this PHP is: %s\n\n", get_cfg_var('cfg_file_path'));+ }+++ echo "Checking Required PHP extensions... \n\n";++ // Get the list of installed extensions+ $loaded_exts_array = get_loaded_extensions();++ // The PHP extensions PHP is *required* to have enabled in order to run+ $required_exts_array =+ [+ 'bcmath',+ 'curl',+ 'fileinfo',+ 'gd|imagick',+ 'json',+ 'ldap',+ 'mbstring',+ 'mysqli|pgsql',+ 'openssl',+ 'PDO',+ 'tokenizer',+ 'xml',+ 'zip',+ ];++ $ext_missing = '';+ $ext_installed = '';++ // Loop through the required extensions+ foreach ($required_exts_array as $required_ext) {++ // If we don't find the string in the array....+ if (!in_array($required_ext, $loaded_exts_array)) {++ // Let's check for any options with pipes in them - those mean you can have either or+ if (strpos($required_ext, '|')) {++ // Split the either/ors by their pipe and put them into an array+ $require_either = explode("|", $required_ext);++ // Now loop through the either/or array and see whether any of the options match+ foreach ($require_either as $require_either_value) {++ if (in_array($require_either_value, $loaded_exts_array)) {+ $ext_installed .= '√ '.$require_either_value." is installed!\n";+ break;+ // If no match, add it to the string for errors+ } else {+ $ext_missing .= '✘ MISSING PHP EXTENSION: '.str_replace("|", " OR ", $required_ext)."\n";+ break;+ }+ }++ // If this isn't an either/or option, just add it to the string of errors conventionally+ } else {+ $ext_missing .= '✘ MISSING PHP EXTENSION: '.$required_ext."\n";+ }++ // The required extension string was found in the array of installed extensions - yay!+ } else {+ $ext_installed .= '√ '.$required_ext." is installed!\n";+ }+ }++ // Print out a useful error message and abort the install+ if ($ext_missing!='') {+ echo "--------------------- !! ERROR !! ----------------------\n";+ echo $ext_missing;+ echo "--------------------------------------------------------\n\n";+ echo "You have the following extensions installed: \n\n";++ foreach ($loaded_exts_array as $loaded_ext) {+ echo "- ".$loaded_ext."\n";+ }++ echo "------------------------- :( ---------------------------\n";+ echo "ABORTING THE INSTALLER \n";+ echo "Please install the extensions above and re-run this script.\n";+ echo "------------------------- :( ---------------------------\n";+ exit;+ } else {+ echo $ext_installed."\n";+}+$ext_check = '';+if ((!extension_loaded('gd')) || (!extension_loaded('imagick'))) {+ $ext_check .= "PHP extension MISSING: gd or imagick \n";+}++if (!extension_loaded('php-ldap')) {+ $ext_check .= "PHP extension MISSING: php-ldap \n";+}++if (!extension_loaded('php-json')) {+ $ext_check .= "PHP extension MISSING: php-json \n";+}++if (!extension_loaded('php-fileinfo')) {+ $ext_check .= "PHP extension MISSING: php-fileinfo \n";+}++if (!extension_loaded('php-openssl')) {+ $ext_check .= "PHP extension MISSING: php-openssl \n";+}++if ($ext_check!='') {+ echo $ext_check;+}echo "--------------------------------------------------------\n";echo "STEP 2: Backing up database: \n";