/** * 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(); }
/** * Returns the list of available, but not necessarily loaded extensions * * @return array[] All extensions with info */ public function getAvailableExtensions() { $this->emitPackagesMayHaveChangedSignal(); $extensions = array(); foreach ($this->packageManager->getAvailablePackages() as $package) { $installationType = $this->getInstallTypeForPackage($package); $extensions[$package->getPackageKey()] = array('siteRelPath' => str_replace(PATH_site, '', $package->getPackagePath()), 'type' => $installationType, 'key' => $package->getPackageKey(), 'ext_icon' => ExtensionManagementUtility::getExtensionIcon($package->getPackagePath())); } return $extensions; }
/** * Returns the list of available, but not necessarily loaded extensions * * @return array Array with two sub-arrays, list array (all extensions with info) and category index * @see getInstExtList() */ public function getAvailableExtensions() { $this->emitPackagesMayHaveChangedSignal(); $extensions = array(); foreach ($this->packageManager->getAvailablePackages() as $package) { // Only TYPO3 related packages could be handled by the extension manager // Composer packages from "Packages" folder will be instanciated as \TYPO3\Flow\Package\Package if (!$package instanceof \TYPO3\CMS\Core\Package\PackageInterface) { continue; } $installationType = $this->getInstallTypeForPackage($package); $extensions[$package->getPackageKey()] = array('siteRelPath' => str_replace(PATH_site, '', $package->getPackagePath()), 'type' => $installationType, 'key' => $package->getPackageKey(), 'ext_icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionIcon($package->getPackagePath())); } return $extensions; }
/** * 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(); }
/** * Asserts no changes are found after initial storage */ protected function assertCleanExtensionStates() { $repository = ExtensionInformationRepositoryFactory::create(); $packages = $this->packageManager->getAvailablePackages(); foreach ($packages as $package) { $this->assertSame(array(), $repository->findDifferentExtensionInformation($package)); } }
/** * Update language file for each extension * * @param string $localesToUpdate Comma separated list of locales that needs to be updated * @return void * @deprecated Use LanguageCommandController (language:update) instead. will be removed two versions after 6.2 */ public function updateCommand($localesToUpdate = '') { /** @var $updateTranslationService \TYPO3\CMS\Lang\Service\UpdateTranslationService */ $updateTranslationService = $this->objectManager->get('TYPO3\\CMS\\Lang\\Service\\UpdateTranslationService'); /** @var $languageRepository \TYPO3\CMS\Lang\Domain\Repository\LanguageRepository */ $languageRepository = $this->objectManager->get('TYPO3\\CMS\\Lang\\Domain\\Repository\\LanguageRepository'); $locales = array(); if (!empty($localesToUpdate)) { $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $localesToUpdate, TRUE); } else { $languages = $languageRepository->findSelected(); foreach ($languages as $language) { /** @var $language \TYPO3\CMS\Lang\Domain\Model\Language */ $locales[] = $language->getLocale(); } } $this->packageManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Package\\PackageManager'); $this->emitPackagesMayHaveChangedSignal(); foreach ($this->packageManager->getAvailablePackages() as $package) { $updateTranslationService->updateTranslation($package->getPackageKey(), $locales); } }