Remove PackageInstallationDispatcher::validatePHPRequirements()
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 Aug 2022 09:03:56 +0000 (11:03 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 Aug 2022 10:28:34 +0000 (12:28 +0200)
This code is completely unused and its API is built for internal use.

wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php

index fb16e9ffacb1851b4f4e1c1d975b19488af96d35..f2eaf94cd8e8d49624341729fe14842198eff66e 100644 (file)
@@ -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.
      *