/**
* Unfreeze a package
*
* Unfreezes a previously frozen package. On the next request, this package will
* be considered again by the file monitoring and related services – if they are
* enabled in the current context.
*
* By specifying <b>all</b> as a package key, all currently frozen packages are
* unfrozen (the default).
*
* @param string $packageKey Key of the package to unfreeze, or 'all'
* @return void
* @see neos.flow:package:freeze
* @see neos.flow:cache:flush
*/
public function unfreezeCommand($packageKey = 'all')
{
if (!$this->bootstrap->getContext()->isDevelopment()) {
$this->outputLine('Package freezing is only supported in Development context.');
$this->quit(3);
}
$packagesToUnfreeze = [];
if ($packageKey === 'all') {
foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
if ($this->packageManager->isPackageFrozen($packageKey)) {
$packagesToUnfreeze[] = $packageKey;
}
}
if ($packagesToUnfreeze === []) {
$this->outputLine('Nothing to do, no packages were frozen.');
$this->quit(0);
}
} else {
if ($packageKey === null) {
$this->outputLine('You must specify a package to unfreeze.');
$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);
}
$packagesToUnfreeze = [$packageKey];
}
foreach ($packagesToUnfreeze as $packageKey) {
$this->packageManager->unfreezePackage($packageKey);
$this->outputLine('Unfroze package "%s".', [$packageKey]);
}
}