From c742e7ecaa0f45345262b42365bb31cac208018f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 10 Aug 2022 11:03:56 +0200 Subject: [PATCH] Remove PackageInstallationDispatcher::validatePHPRequirements() This code is completely unused and its API is built for internal use. --- .../PackageInstallationDispatcher.class.php | 93 ------------------- 1 file changed, 93 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index fb16e9ffac..f2eaf94cd8 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -1214,99 +1214,6 @@ class PackageInstallationDispatcher } } - /** - * Validates specific php requirements. - * - * @param array $requirements - * @return mixed[][] - */ - public static function validatePHPRequirements(array $requirements) - { - $errors = []; - - // validate php version - if (isset($requirements['version'])) { - $passed = false; - if (\version_compare(\PHP_VERSION, $requirements['version'], '>=')) { - $passed = true; - } - - if (!$passed) { - $errors['version'] = [ - 'required' => $requirements['version'], - 'installed' => \PHP_VERSION, - ]; - } - } - - // validate extensions - if (isset($requirements['extensions'])) { - foreach ($requirements['extensions'] as $extension) { - $passed = \extension_loaded($extension) ? true : false; - - if (!$passed) { - $errors['extension'][] = [ - 'extension' => $extension, - ]; - } - } - } - - // validate settings - if (isset($requirements['settings'])) { - foreach ($requirements['settings'] as $setting => $value) { - $iniValue = \ini_get($setting); - - $passed = self::compareSetting($setting, $value, $iniValue); - if (!$passed) { - $errors['setting'][] = [ - 'setting' => $setting, - 'required' => $value, - 'installed' => ($iniValue === false) ? '(unknown)' : $iniValue, - ]; - } - } - } - - // validate functions - if (isset($requirements['functions'])) { - foreach ($requirements['functions'] as $function) { - $function = \mb_strtolower($function); - - $passed = \function_exists($function); - if (!$passed) { - $errors['function'][] = [ - 'function' => $function, - ]; - } - } - } - - // validate classes - if (isset($requirements['classes'])) { - foreach ($requirements['classes'] as $class) { - $passed = false; - - // see: http://de.php.net/manual/en/language.oop5.basic.php - if (\preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.~', $class)) { - $globalClass = '\\' . $class; - - if (\class_exists($globalClass, false)) { - $passed = true; - } - } - - if (!$passed) { - $errors['class'][] = [ - 'class' => $class, - ]; - } - } - } - - return $errors; - } - /** * Compares settings, converting values into compareable ones. * -- 2.20.1