public static function determineUninstallOrder() { self::$uninstallOrder = array(); $dependencies = self::listDependencies(); $catalog = Package_Catalog::getCatalog(); foreach ($catalog as $id => $package) { $reliance = self::graphReliance($dependencies, $package['packageName']); self::$uninstallOrder = arr::merge(self::$uninstallOrder, $reliance); } self::$uninstallOrder = array_unique(self::$uninstallOrder); self::$uninstallOrder = array_flip(self::$uninstallOrder); }
public function commit() { foreach ($this->transaction as $operation => $identifiers) { if ($operation == Package_Manager::OPERATION_UNINSTALL) { Package_Message::log('debug', 'Sorting package ' . $operation . ' transaction list by dependencies'); Package_Dependency_Graph::determineUninstallOrder(); usort($identifiers, array('Package_Dependency_Graph', 'sortUninstall')); } else { Package_Message::log('debug', 'Sorting package ' . $operation . ' transaction list by requirements'); Package_Dependency_Graph::determineInstallOrder(); usort($identifiers, array('Package_Dependency_Graph', 'sortInstall')); } if (!Package_Operation::dispatch($operation, $identifiers)) { throw new Package_Transaction_Exception('Unable to complete ' . $operation . ' of selected packages'); } } }