/** * {@inheritDoc} */ public function uninstall(WritableRepositoryInterface $repo, PackageInterface $package) { if (!$repo->hasPackage($package)) { // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125) return; throw new \InvalidArgumentException('Package is not installed: ' . $package); } $repo->removePackage($package); }
/** * {@inheritDoc} */ public function uninstall(WritableRepositoryInterface $repo, PackageInterface $package) { if (!$repo->hasPackage($package)) { // TODO throw exception again here, when update is fixed and we don't have to remove+install (see #125) return; throw new \InvalidArgumentException('Package is not installed: ' . $package); } $downloadPath = $this->getInstallPath($package); $this->downloadManager->remove($package, $downloadPath); $this->removeBinaries($package); $repo->removePackage($package); }
/** * Inject the contao/*-bundle versions into the Contao package. * * @param WritableRepositoryInterface $repository The repository where to add the packages. * * @param string $version The version to use. * * @param string $prettyVersion The version to use. * * @return void */ protected function injectContaoBundles(WritableRepositoryInterface $repository, $version, $prettyVersion) { foreach (Environment::$bundleNames as $bundleName) { if ($remove = $repository->findPackage($bundleName, '*')) { if ($this->isNotMetaPackageOrHasSameVersion($remove, $version)) { // stop if the package is required somehow and must not be injected or if the virtual package is // already injected. continue; } // Otherwise remove the package. $repository->removePackage($remove); } $package = new CompletePackage($bundleName, $version, $prettyVersion); $package->setType('metapackage'); $repository->addPackage($package); } }