/**
  * @return void
  */
 public function indexAction()
 {
     $packageGroups = array();
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         $packageGroup = current(array_slice(explode('/', $package->getPackagePath()), -3, 1));
         $packageGroups[$packageGroup][$package->getPackageKey()] = array('sanitizedPackageKey' => str_replace('.', '', $package->getPackageKey()), 'version' => $package->getPackageMetaData()->getVersion(), 'title' => $package->getPackageMetaData()->getTitle(), 'description' => $package->getPackageMetaData()->getDescription(), 'metaData' => $package->getPackageMetaData(), 'isActive' => $this->packageManager->isPackageActive($package->getPackageKey()), 'isFrozen' => $this->packageManager->isPackageFrozen($package->getPackageKey()), 'isProtected' => $package->isProtected());
     }
     ksort($packageGroups);
     foreach (array_keys($packageGroups) as $packageGroup) {
         ksort($packageGroups[$packageGroup]);
     }
     $this->view->assignMultiple(array('packageGroups' => $packageGroups, 'isDevelopmentContext' => $this->objectManager->getContext()->isDevelopment()));
 }
 /**
  * Action for listing active packages
  *
  * @return string
  */
 public function listAvailableAction()
 {
     $packages = $this->packageManager->getAvailablePackages();
     $output = 'Available packages:' . PHP_EOL;
     foreach ($packages as $package) {
         $output .= ' ' . str_pad($package->getPackageKey(), 30) . $package->getPackageMetaData()->getVersion() . PHP_EOL;
     }
     return $output . PHP_EOL;
 }
 /**
  * Refreeze a package
  *
  * Refreezes a currently frozen package: all precompiled information is removed
  * and file monitoring will consider the package exactly once, on the next
  * request. After that request, the package remains frozen again, just with the
  * updated data.
  *
  * By specifying <b>all</b> as a package key, all currently frozen packages are
  * refrozen (the default).
  *
  * @param string $packageKey Key of the package to refreeze, or 'all'
  * @return void
  * @see typo3.flow3:package:freeze
  * @see typo3.flow3:cache:flush
  */
 public function refreezeCommand($packageKey = 'all')
 {
     if (!$this->bootstrap->getContext()->isDevelopment()) {
         $this->outputLine('Package freezing is only supported in Development context.');
         $this->quit(3);
     }
     $packagesToRefreeze = array();
     if ($packageKey === 'all') {
         foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
             if ($this->packageManager->isPackageFrozen($packageKey)) {
                 $packagesToRefreeze[] = $packageKey;
             }
         }
         if ($packagesToRefreeze === array()) {
             $this->outputLine('Nothing to do, no packages were frozen.');
             $this->quit(0);
         }
     } else {
         if ($packageKey === NULL) {
             $this->outputLine('You must specify a package to refreeze.');
             $this->quit(1);
         }
         if (!$this->packageManager->isPackageAvailable($packageKey)) {
             $this->outputLine('Package "%s" is not available.', array($packageKey));
             $this->quit(2);
         }
         if (!$this->packageManager->isPackageFrozen($packageKey)) {
             $this->outputLine('Package "%s" was not frozen.', array($packageKey));
             $this->quit(0);
         }
         $packagesToRefreeze = array($packageKey);
     }
     foreach ($packagesToRefreeze as $packageKey) {
         $this->packageManager->refreezePackage($packageKey);
         $this->outputLine('Refroze package "%s".', array($packageKey));
     }
     Scripts::executeCommand('typo3.flow3:cache:flush', $this->settings, FALSE);
     $this->sendAndExit(0);
 }
Exemple #4
0
 /**
  * Checks which classes lack a cache entry and removes their reflection data
  * accordingly.
  *
  * @return void
  */
 protected function forgetChangedClasses()
 {
     $frozenNamespaces = array();
     foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
         if ($this->packageManager->isPackageFrozen($packageKey)) {
             $frozenNamespaces[] = $package->getPackageNamespace();
         }
     }
     $classNames = array_keys($this->classReflectionData);
     foreach ($frozenNamespaces as $namespace) {
         $namespace .= '\\';
         $namespaceLength = strlen($namespace);
         foreach ($classNames as $index => $className) {
             if (substr($className, 0, $namespaceLength) === $namespace) {
                 unset($classNames[$index]);
             }
         }
     }
     foreach ($classNames as $className) {
         if (!$this->statusCache->has(str_replace('\\', '_', $className))) {
             $this->forgetClass($className);
         }
     }
 }