/**
  * Loads given extension
  *
  * Warning: This method only works if the ugrade wizard to transform
  * localconf.php to LocalConfiguration.php was already run
  *
  * @param string $extensionKey Extension key to load
  * @return void
  * @throws \RuntimeException
  */
 public static function loadExtension($extensionKey)
 {
     if (static::$packageManager->isPackageActive($extensionKey)) {
         throw new \RuntimeException('Extension already loaded', 1342345486);
     }
     static::$packageManager->activatePackage($extensionKey);
 }
 /**
  * Activates all packages that are configured in root composer.json or are required
  *
  * @param bool $removeInactivePackages
  */
 public function generatePackageStatesCommand($removeInactivePackages = FALSE)
 {
     try {
         $installationPackages = $this->getPackagesFromRootComposerFile();
     } catch (\Exception $e) {
         $this->outputLine('<error>' . $e->getMessage() . '</error>');
         $this->quit(1);
         return;
     }
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         if (isset($installationPackages[$package->getPackageKey()]) || $package->isProtected() || $package instanceof Package && $package->isPartOfMinimalUsableSystem()) {
             $this->packageManager->activatePackage($package->getPackageKey());
         } else {
             try {
                 $this->packageManager->deactivatePackage($package->getPackageKey());
             } catch (\UnexpectedValueException $exception) {
                 $this->outputLine('<info>Error while deactivating package %s. Exception: %s</info>', array($package->getPackageKey(), $exception->getMessage()));
             }
             if ($removeInactivePackages) {
                 $this->packageManager->unregisterPackage($package);
                 GeneralUtility::flushDirectory($package->getPackagePath());
                 $this->outputLine('Removed Package: ' . $package->getPackageKey());
             }
         }
     }
     $this->packageManager->forceSortAndSavePackageStates();
 }
 /**
  * Activates all packages that are configured in root composer.json or are required
  *
  * @param bool $removeInactivePackages
  */
 public function generatePackageStatesCommand($removeInactivePackages = FALSE)
 {
     $installationPackages = $this->getPackagesFromRootComposerFile();
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         if (in_array($package->getPackageKey(), $installationPackages) || $package->isProtected() || $package instanceof Package && $package->isPartOfMinimalUsableSystem()) {
             $this->packageManager->activatePackage($package->getPackageKey());
         } else {
             $this->packageManager->deactivatePackage($package->getPackageKey());
             if ($removeInactivePackages) {
                 $this->packageManager->unregisterPackage($package);
                 GeneralUtility::flushDirectory($package->getPackagePath());
                 $this->outputLine('Removed Package: ' . $package->getPackageKey());
             }
         }
     }
     $this->packageManager->forceSortAndSavePackageStates();
 }
Exemplo n.º 4
0
 /**
  * @test
  */
 public function activatePackageAndDeactivatePackageActivateAndDeactivateTheGivenPackage()
 {
     $packageKey = 'Acme.YetAnotherTestPackage';
     $this->createPackage($packageKey);
     $this->packageManager->deactivatePackage($packageKey);
     $this->assertFalse($this->packageManager->isPackageActive($packageKey));
     $this->packageManager->activatePackage($packageKey);
     $this->assertTrue($this->packageManager->isPackageActive($packageKey));
 }
Exemplo n.º 5
0
 /**
  * Wrapper function for loading extensions
  *
  * @param string $extensionKey
  * @return void
  */
 protected function loadExtension($extensionKey)
 {
     $this->packageManager->activatePackage($extensionKey);
 }