isPackageFrozen() public method

Tells if a package is frozen
public isPackageFrozen ( string $packageKey ) : boolean
$packageKey string The package to check
return boolean
 /**
  * @return void
  */
 public function indexAction()
 {
     $packageGroups = array();
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         /** @var Package $package */
         $packagePath = substr($package->getPackagepath(), strlen(FLOW_PATH_PACKAGES));
         $packageGroup = substr($packagePath, 0, strpos($packagePath, '/'));
         $packageGroups[$packageGroup][$package->getPackageKey()] = array('sanitizedPackageKey' => str_replace('.', '', $package->getPackageKey()), 'version' => $package->getInstalledVersion(), 'name' => $package->getComposerManifest('name'), 'type' => $package->getComposerManifest('type'), 'description' => $package->getComposerManifest('description'), '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()));
 }
 /**
  * Flush all caches
  *
  * The flush command flushes all caches (including code caches) which have been
  * registered with Flow's Cache Manager. It also removes any session data.
  *
  * If fatal errors caused by a package prevent the compile time bootstrap
  * from running, the removal of any temporary data can be forced by specifying
  * the option <b>--force</b>.
  *
  * This command does not remove the precompiled data provided by frozen
  * packages unless the <b>--force</b> option is used.
  *
  * @param boolean $force Force flushing of any temporary data
  * @return void
  * @see neos.flow:cache:warmup
  * @see neos.flow:package:freeze
  * @see neos.flow:package:refreeze
  */
 public function flushCommand($force = false)
 {
     // Internal note: the $force option is evaluated early in the Flow
     // bootstrap in order to reliably flush the temporary data before any
     // other code can cause fatal errors.
     $this->cacheManager->flushCaches();
     $this->outputLine('Flushed all caches for "' . $this->bootstrap->getContext() . '" context.');
     if ($this->lockManager->isSiteLocked()) {
         $this->lockManager->unlockSite();
     }
     $frozenPackages = [];
     foreach (array_keys($this->packageManager->getActivePackages()) as $packageKey) {
         if ($this->packageManager->isPackageFrozen($packageKey)) {
             $frozenPackages[] = $packageKey;
         }
     }
     if ($frozenPackages !== []) {
         $this->outputFormatted(PHP_EOL . 'Please note that the following package' . (count($frozenPackages) === 1 ? ' is' : 's are') . ' currently frozen: ' . PHP_EOL);
         $this->outputFormatted(implode(PHP_EOL, $frozenPackages) . PHP_EOL, [], 2);
         $message = 'As code and configuration changes in these packages are not detected, the application may respond ';
         $message .= 'unexpectedly if modifications were done anyway or the remaining code relies on these changes.' . PHP_EOL . PHP_EOL;
         $message .= 'You may call <b>package:refreeze all</b> in order to refresh frozen packages or use the <b>--force</b> ';
         $message .= 'option of this <b>cache:flush</b> command to flush caches if Flow becomes unresponsive.' . PHP_EOL;
         $this->outputFormatted($message, [$frozenPackages]);
     }
     $this->sendAndExit(0);
 }
 /**
  * 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 neos.flow:package:freeze
  * @see neos.flow: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 = [];
     if ($packageKey === 'all') {
         foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
             if ($this->packageManager->isPackageFrozen($packageKey)) {
                 $packagesToRefreeze[] = $packageKey;
             }
         }
         if ($packagesToRefreeze === []) {
             $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.', [$packageKey]);
             $this->quit(2);
         }
         if (!$this->packageManager->isPackageFrozen($packageKey)) {
             $this->outputLine('Package "%s" was not frozen.', [$packageKey]);
             $this->quit(0);
         }
         $packagesToRefreeze = [$packageKey];
     }
     foreach ($packagesToRefreeze as $packageKey) {
         $this->packageManager->refreezePackage($packageKey);
         $this->outputLine('Refroze package "%s".', [$packageKey]);
     }
     Scripts::executeCommand('neos.flow:cache:flush', $this->settings, false);
     $this->sendAndExit(0);
 }
Exemplo n.º 4
0
 /**
  * Tries to load the reflection data from the compile time cache.
  *
  * The compile time cache is only supported for Development context and thus
  * this function will return in any other context.
  *
  * If no reflection data was found, this method will at least load the precompiled
  * reflection data of any possible frozen package. Even if precompiled reflection
  * data could be loaded, FALSE will be returned in order to signal that other
  * packages still need to be reflected.
  *
  * @return boolean TRUE if reflection data could be loaded, otherwise FALSE
  */
 protected function loadClassReflectionCompiletimeCache()
 {
     $data = $this->reflectionDataCompiletimeCache->get('ReflectionData');
     if ($data !== false) {
         foreach ($data as $propertyName => $propertyValue) {
             $this->{$propertyName} = $propertyValue;
         }
         return true;
     }
     if (!$this->context->isDevelopment()) {
         return false;
     }
     $useIgBinary = extension_loaded('igbinary');
     foreach ($this->packageManager->getActivePackages() as $packageKey => $package) {
         if (!$this->packageManager->isPackageFrozen($packageKey)) {
             continue;
         }
         $pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
         if (!file_exists($pathAndFilename)) {
             continue;
         }
         $data = $useIgBinary ? igbinary_unserialize(file_get_contents($pathAndFilename)) : unserialize(file_get_contents($pathAndFilename));
         foreach ($data as $propertyName => $propertyValue) {
             $this->{$propertyName} = Arrays::arrayMergeRecursiveOverrule($this->{$propertyName}, $propertyValue);
         }
     }
     return false;
 }