示例#1
0
 /**
  * The implementation of {@link lookupRequirements()}.
  *
  * @param Addon $addon The addon to lookup.
  * @param array &$array The current requirements list.
  * @see AddonManager::lookupRequirements()
  */
 private function lookupRequirementsRecursive(Addon $addon, array &$array)
 {
     $addonReqs = $addon->getRequirements();
     foreach ($addonReqs as $addonKey => $versionReq) {
         $addonKey = strtolower($addonKey);
         if (isset($array[$addonKey])) {
             continue;
         }
         $addonReq = $this->lookupAddon($addonKey);
         if (!$addonReq) {
             $status = self::REQ_MISSING;
         } elseif ($this->isEnabled($addonReq->getKey(), $addonReq->getType())) {
             $status = self::REQ_ENABLED;
         } elseif (Addon::checkVersion($addonReq->getVersion(), $versionReq)) {
             $status = self::REQ_DISABLED;
         } else {
             $status = self::REQ_VERSION;
         }
         $array[$addonKey] = ['req' => $versionReq, 'status' => $status];
         // Check the required addon's requirements.
         if ($addonReq && $status !== self::REQ_ENABLED) {
             $this->lookupRequirementsRecursive($addonReq, $array);
         }
     }
 }