[BUGFIX] Return InaccessibleFolder for non existing processed folder 36/32836/5
authorFrans Saris <franssaris@gmail.com>
Fri, 30 Jan 2015 08:50:03 +0000 (09:50 +0100)
committerFrans Saris <franssaris@gmail.com>
Fri, 30 Jan 2015 12:30:31 +0000 (13:30 +0100)
When the processed folder of a folder isn't present the ResourceStorage
tries to create it. When storage is offline or write-only this will fail
and as a result you run into exceptions on several places in BE.

This change makes sure there is a InaccessibleFolder object returned
in these cases.

Resolves: #61688
Releases: master, 6.2
Change-Id: Ie32c09f8d322914234860903c18ca44ff5cbf5db
Reviewed-on: http://review.typo3.org/32836
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Tested-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 764c80c..7dd9064 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
@@ -2425,11 +2426,17 @@ class ResourceStorage implements ResourceStorageInterface {
                        if (!empty($this->storageRecord['processingfolder'])) {
                                $processingFolder = $this->storageRecord['processingfolder'];
                        }
-                       if ($this->driver->folderExists($processingFolder) === FALSE) {
-                               $this->processingFolder = $this->createFolder($processingFolder);
-                       } else {
-                               $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
-                               $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
+                       try {
+                               if ($this->driver->folderExists($processingFolder) === FALSE) {
+                                       $this->processingFolder = $this->createFolder($processingFolder);
+                               } else {
+                                       $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
+                                       $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
+                               }
+                       } catch(InsufficientFolderWritePermissionsException $e) {
+                               $this->processingFolder = GeneralUtility::makeInstance(
+                                       InaccessibleFolder::class, $this, $processingFolder, $processingFolder
+                               );
                        }
                }
                return $this->processingFolder;