/** * check reverse dependencies of an item to remove. * * Find all items having the given item as dependency, and remove them * * @param Item $item * @param string $epId */ protected function _checkReverseDependencies(Item $item) { if (isset($this->circularReverseDependencyTracker[$item->getName()])) { throw new ItemException('Circular reverse dependency! Cannot process the item ' . $item->getName(), $item, 4); } $this->circularReverseDependencyTracker[$item->getName()] = true; foreach ($this->items as $revdepItemName => $revdepItem) { $dependencies = $revdepItem->getDependencies(); if (!isset($dependencies[$item->getName()])) { continue; } if ($revdepItem->getAction() == self::ACTION_INSTALL || $revdepItem->getAction() == self::ACTION_UPGRADE) { throw new ItemException('Item ' . $revdepItemName . ' should be removed because of the removal of one of its dependencies, ' . $item->getName() . ', but it asked to be install/upgrade at the same time', $item, 5, $revdepItem); } if (isset($this->checkedItems[$revdepItemName])) { continue; } if ($revdepItem->getAction() == self::ACTION_REMOVE) { $this->_checkReverseDependencies($revdepItem); $this->chain[] = $revdepItem; } elseif ($revdepItem->getAction() == self::ACTION_NONE) { if ($revdepItem->isInstalled()) { $revdepItem->setAction(self::ACTION_REMOVE); $this->_checkReverseDependencies($revdepItem); $this->chain[] = $revdepItem; } } } $this->checkedItems[$item->getName()] = true; unset($this->circularReverseDependencyTracker[$item->getName()]); }