refreezePackage() public method

Refreezes a package
public refreezePackage ( string $packageKey ) : void
$packageKey string The package to refreeze
return void
コード例 #1
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);
 }