protected function savePackageStates(array $orderedPackageStates)
{
$orderedPackageStates['version'] = static::PACKAGESTATE_FORMAT_VERSION;
$fileDescription = "# PackageStates.php\n\n";
$fileDescription .= "# This file is maintained by Flow's package management. You shouldn't edit it manually\n";
$fileDescription .= "# manually, you should rather use the command line commands for maintaining packages.\n";
$fileDescription .= "# You'll find detailed information about the neos.flow:package:* commands in their\n";
$fileDescription .= "# respective help screens.\n\n";
$fileDescription .= "# This file will be regenerated automatically if it doesn't exist. Deleting this file\n";
$fileDescription .= "# should, however, never become necessary if you use the package commands.\n";
$packageStatesCode = "<?php\n" . $fileDescription . "\nreturn " . var_export($orderedPackageStates, true) . ';';
$result = @file_put_contents($this->packageStatesPathAndFilename, $packageStatesCode);
if ($result === false) {
throw new Exception\PackageStatesFileNotWritableException(sprintf('Flow could not update the list of installed packages because the file %s is not writable. Please, check the file system permissions and make sure that the web server can write to it.', $this->packageStatesPathAndFilename), 1382449759);
}
OpcodeCacheHelper::clearAllActive($this->packageStatesPathAndFilename);
$this->emitPackageStatesUpdated();
}