[BUGFIX] File PackageStates.php isn't created at all 94/25194/3
authorNicole Cordes <typo3@cordes.co>
Thu, 7 Nov 2013 12:12:56 +0000 (13:12 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 8 Nov 2013 12:53:05 +0000 (13:53 +0100)
With the patch I71bba56361a4cc85fb253199acbfee5829defa29 the access to
the PackageStates.php file is checked. If the file doesn't exists yet
the error is thrown as well. This patch adds a test if the file can be
created so the update process can be executed again.

Resolves: #53410
Releases: 6.2
Change-Id: I1e79c7f0ab0f0c69a20086c8b8e5be2c37bdb5f3
Reviewed-on: https://review.typo3.org/25194
Reviewed-by: Wouter Wolters
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManager.php
typo3/sysext/core/Resources/PHP/TYPO3.Flow/README

index c71dac4..1853040 100644 (file)
@@ -930,10 +930,15 @@ class PackageManager implements \TYPO3\Flow\Package\PackageManagerInterface {
                        }
                }
                if (!@is_writable($this->packageStatesPathAndFilename)) {
-                       throw new \TYPO3\Flow\Package\Exception\PackageStatesFileNotWritableException(
-                               sprintf('We could not update the list of installed packages because the file %s is not writable. Please, check the file system permissions for this file and make sure that the web server can update it.', $this->packageStatesPathAndFilename),
-                               1382449759
-                       );
+                       // If file does not exists try to create it
+                       $fileHandle = @fopen($this->packageStatesPathAndFilename, 'x');
+                       if (!$fileHandle) {
+                               throw new \TYPO3\Flow\Package\Exception\PackageStatesFileNotWritableException(
+                                       sprintf('We could not update the list of installed packages because the file %s is not writable. Please, check the file system permissions for this file and make sure that the web server can update it.', $this->packageStatesPathAndFilename),
+                                       1382449759
+                               );
+                       }
+                       fclose($fileHandle);
                }
                $packageStatesCode = "<?php\n$fileDescription\nreturn " . var_export($this->packageStatesConfiguration, TRUE) . "\n ?>";
                @file_put_contents($this->packageStatesPathAndFilename, $packageStatesCode);
index ec93f6d..b183fa7 100644 (file)
@@ -4,6 +4,7 @@ package management to work.
 The following has been changed:
 * TYPO3\Flow\Exception now extends TYPO3\CMS\Core\Exception
 * TYPO3\Flow\Package\Package has magic sleep and wakeup methods
+* TYPO3\Flow\Package\PackageManager::sortAndSavePackageStates throws error if write access to PackageState file is missing
 
 It has been imported from this commmit hash: