[BUGFIX] Ensure processing folder within another storage is created 85/44685/2
authorBenjamin Mack <benni@typo3.org>
Thu, 12 Nov 2015 06:02:27 +0000 (07:02 +0100)
committerNicole Cordes <typo3@cordes.co>
Thu, 12 Nov 2015 17:40:13 +0000 (18:40 +0100)
This patch checks if the processing folder within another storage
exists and ensures it is created if not.

Resolves: #70481
Releases: master, 6.2
Change-Id: Ib6747b5e37a46e6f761912103d1ac5f490bb2a1d
Reviewed-on: https://review.typo3.org/44685
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/context_help/locallang_csh_sysfilestorage.xlf
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index ec866e4..b36ba40 100644 (file)
@@ -34,7 +34,7 @@
                                <source>The driver is the technical background of a storage, and thus also defines whether the location of the storage is local (= on the same machine as this TYPO3 installation) or remote like a WebDAV server connection. Search for extensions in the TYPO3 Extension Repository that extend this driver list.</source>
                        </trans-unit>
                        <trans-unit id="processingfolder.description" xml:space="preserve">
-                               <source>Defines the directory on this storage to be used to save temporary files like resized images. When on a different storage make sure that the folder exists and is writable.</source>
+                               <source>Defines the directory on this storage to be used to save temporary files like resized images.</source>
                        </trans-unit>
                        <trans-unit id="is_browsable.description" xml:space="preserve">
                                <source>If set, backend users can browse through this storage. Otherwise it will show up as a unselectable item in the list.</source>
index 8215e87..e0bb887 100644 (file)
@@ -2654,7 +2654,13 @@ class ResourceStorage implements ResourceStorageInterface {
                        }
                        try {
                                if (strpos($processingFolder, ':') !== FALSE) {
-                                       $this->processingFolder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($processingFolder);
+                                       list ($storageUid, $processingFolderIdentifier) = explode(':', $processingFolder, 2);
+                                       $storage = ResourceFactory::getInstance()->getStorageObject($storageUid);
+                                       if ($storage->hasFolder($processingFolderIdentifier)) {
+                                               $this->processingFolder = $storage->getFolder($processingFolderIdentifier);
+                                       } else {
+                                               $this->processingFolder = $storage->createFolder(ltrim($processingFolderIdentifier, '/'));
+                                       }
                                } else {
                                        if ($this->driver->folderExists($processingFolder) === FALSE) {
                                                $this->processingFolder = $this->createFolder($processingFolder);