registration: Short-circuit if dependency constraint is '*'
[lhc/web/wiklou.git] / includes / registration / VersionChecker.php
index 9c673bc..1569e08 100644 (file)
@@ -117,7 +117,7 @@ class VersionChecker {
                                                }
                                                break;
                                        case 'extensions':
-                                       case 'skin':
+                                       case 'skins':
                                                foreach ( $values as $dependency => $constraint ) {
                                                        $extError = $this->handleExtensionDependency(
                                                                $dependency, $constraint, $extension, $dependencyType
@@ -169,7 +169,7 @@ class VersionChecker {
         * @param string $dependencyName The name of the dependency
         * @param string $constraint The required version constraint for this dependency
         * @param string $checkedExt The Extension, which depends on this dependency
-        * @param string $type Either 'extension' or 'skin'
+        * @param string $type Either 'extensions' or 'skins'
         * @return bool|array false for no errors, or an array of info
         */
        private function handleExtensionDependency( $dependencyName, $constraint, $checkedExt,
@@ -183,23 +183,19 @@ class VersionChecker {
                                'missing' => $dependencyName,
                        ];
                }
+               if ( $constraint === '*' ) {
+                       // short-circuit since any version is OK.
+                       return false;
+               }
                // Check if the dependency has specified a version
                if ( !isset( $this->loaded[$dependencyName]['version'] ) ) {
-                       // If we depend upon any version, and none is set, that's fine.
-                       if ( $constraint === '*' ) {
-                               wfDebug( "{$dependencyName} does not expose its version, but {$checkedExt}"
-                                       . " mentions it with constraint '*'. Assume it's ok so." );
-                               return false;
-                       } else {
-                               // Otherwise, mark it as incompatible.
-                               $msg = "{$dependencyName} does not expose its version, but {$checkedExt}"
-                                       . " requires: {$constraint}.";
-                               return [
-                                       'msg' => $msg,
-                                       'type' => "incompatible-$type",
-                                       'incompatible' => $checkedExt,
-                               ];
-                       }
+                       $msg = "{$dependencyName} does not expose its version, but {$checkedExt}"
+                               . " requires: {$constraint}.";
+                       return [
+                               'msg' => $msg,
+                               'type' => "incompatible-$type",
+                               'incompatible' => $checkedExt,
+                       ];
                } else {
                        // Try to get a constraint for the dependency version
                        try {