[BUGFIX] Ensure processing folder within another storage is created 03/43903/5
authorNicole Cordes <typo3@cordes.co>
Wed, 7 Oct 2015 20:44:51 +0000 (22:44 +0200)
committerBenni Mack <benni@typo3.org>
Thu, 12 Nov 2015 05:58:04 +0000 (06:58 +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/43903
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>

index 19b14b4..5455ac0 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 id="processingfolder.description">
-                               <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 id="is_browsable.description">
                                <source>If set, backend users can browse through this storage. Otherwise it will show up as a unselectable item in the list.</source>
index f92765a..724c0e0 100644 (file)
@@ -2847,7 +2847,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);