Exemplo n.º 1
0
 /**
  * Checks whether the package is in conflict with another package.
  *
  * @param string $packageId Package ID
  *
  * @return bool
  */
 public function checkPackageConflict($packageId)
 {
     $conflicts = $this->package->getProperty('conflicts', []);
     $package = rex_package::get($packageId);
     if (!isset($conflicts['packages'][$packageId]) || !$package->isAvailable()) {
         return true;
     }
     $constraints = $conflicts['packages'][$packageId];
     if (!is_string($constraints) || !$constraints || $constraints === '*') {
         $this->message = $this->i18n('conflict_error_' . $package->getType(), $package->getPackageId());
         return false;
     } elseif (self::matchVersionConstraints($package->getVersion(), $constraints)) {
         $this->message = $this->i18n('conflict_error_' . $package->getType() . '_version', $package->getPackageId(), $constraints);
         return false;
     }
     return true;
 }