[TASK] EXT:form - use own folder for form definitions 89/53989/15
authorThomas Kieslich <thomas.kieslich@gmail.com>
Fri, 8 Sep 2017 08:34:43 +0000 (10:34 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 8 Sep 2017 21:31:06 +0000 (23:31 +0200)
Change default filemount for form definitions to fileadmin/form_definitions,
the directory is automatically created if necessary.

Existing forms in fileadmin/user_upload can be listed, duplicated and removed
but not edited.

Since no migration wizard can be provided for this, a manual migration is
necessary which can be done

1) ...by moving all form definitions to the new directory via filesystem or
2) ...by duplicating all form definitions (thus storing them in the new
location) and removing the old form definitions.

Resolves: #82328
Releases: master
Change-Id: Id804f58747a203e92998aca2699b37f81900e9e7
Reviewed-on: https://review.typo3.org/53989
Reviewed-by: Daniel Lorenz <daniel.lorenz@extco.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Daniel Lorenz <daniel.lorenz@extco.de>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Carlos Meyer <cm@davitec.de>
Tested-by: Carlos Meyer <cm@davitec.de>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/master/Important-82328-EXTform-UseOwnFolderForFormDefinitions.rst [new file with mode: 0644]
typo3/sysext/form/Classes/Controller/FormManagerController.php
typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php
typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml
typo3/sysext/form/Documentation/Concepts/FormFileStorages/Index.rst
typo3/sysext/form/Documentation/Config/configuration/Index.rst
typo3/sysext/form/Documentation/Config/persistenceManager/Index.rst

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-82328-EXTform-UseOwnFolderForFormDefinitions.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-82328-EXTform-UseOwnFolderForFormDefinitions.rst
new file mode 100644 (file)
index 0000000..9ca7bfc
--- /dev/null
@@ -0,0 +1,25 @@
+.. include:: ../../Includes.txt
+
+================================================================================
+Important: #82328 - EXT:form - use own folder for form definitions
+================================================================================
+
+See :issue:`82328`
+
+Description
+===========
+
+Change default filemount for form definitions to fileadmin/form_definitions,
+the directory is automatically created if necessary.
+
+Existing forms in fileadmin/user_upload can be listed, duplicated and removed
+but not edited.
+
+Since no migration wizard can be provided for this, a manual migration is
+necessary which can be done
+
+1) ...by moving all form definitions to the new directory via filesystem or
+2) ...by duplicating all form definitions (thus storing them in the new
+location) and removing the old form definitions.
+
+.. index:: Backend
index dd65f7f..353eb05 100644 (file)
@@ -235,6 +235,11 @@ class FormManagerController extends AbstractBackendController
     {
         $preparedAccessibleFormStorageFolders = [];
         foreach ($this->formPersistenceManager->getAccessibleFormStorageFolders() as $identifier => $folder) {
+            // TODO: deprecated since TYPO3 v9, will be removed in TYPO3 v10
+            if ($folder->getCombinedIdentifier() === '1:/user_upload/') {
+                continue;
+            }
+
             $preparedAccessibleFormStorageFolders[] = [
                 'label' => $folder->getName(),
                 'value' => $identifier
index 64eef01..fa5365e 100644 (file)
@@ -239,6 +239,12 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
             $storage = $folder->getStorage();
             $storage->addFileAndFolderNameFilter([$fileExtensionFilter, 'filterFileList']);
 
+            // TODO: deprecated since TYPO3 v9, will be removed in TYPO3 v10
+            $formReadOnly = false;
+            if ($folder->getCombinedIdentifier() === '1:/user_upload/') {
+                $formReadOnly = true;
+            }
+
             $files = $folder->getFiles(0, 0, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, true);
             foreach ($files as $file) {
                 $persistenceIdentifier = $storage->getUid() . ':' . $file->getIdentifier();
@@ -248,7 +254,7 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
                     'identifier' => $form['identifier'],
                     'name' => isset($form['label']) ? $form['label'] : $form['identifier'],
                     'persistenceIdentifier' => $persistenceIdentifier,
-                    'readOnly' => false,
+                    'readOnly' => $formReadOnly,
                     'removable' => true,
                     'location' => 'storage',
                     'duplicateIdentifier' => false,
@@ -330,6 +336,7 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
             try {
                 $folder = $storage->getFolder($fileMountIdentifier);
             } catch (FolderDoesNotExistException $e) {
+                $storage->createFolder($fileMountIdentifier);
                 continue;
             } catch (InsufficientFolderAccessPermissionsException $e) {
                 continue;
index dac7932..2b088ee 100644 (file)
@@ -3,7 +3,8 @@ TYPO3:
     Form:
       persistenceManager:
         allowedFileMounts:
-          10: 1:/user_upload/
+          10: 1:/form_definitions/
+          20: 1:/user_upload/
         allowSaveToExtensionPaths: false
         allowDeleteFromExtensionPaths: false
         #allowedExtensionPaths:
index 427d813..55cf51d 100644 (file)
@@ -60,7 +60,7 @@ for form definitions.
             allowedFileMounts:
               # default filemount, no need to redeclare it again
               # just to show you the structure
-              # 10: 1:/user_upload/
+              # 10: 1:/form_definitions/
               # additional filemounts
               100: 1:/custom/forms/
               110: 2:/cloudstorage/forms/
index a95f026..9782b2d 100644 (file)
@@ -12,7 +12,7 @@ Full default configuration
 
     persistenceManager:
       allowedFileMounts:
-        10: '1:/user_upload/'
+        10: '1:/form_definitions/'
       allowSaveToExtensionPaths: false
       allowDeleteFromExtensionPaths: false
     prototypes:
index f1cb928..3b00976 100644 (file)
@@ -37,15 +37,15 @@ allowedFileMounts
 
          persistenceManager:
            allowedFileMounts:
-             10: '1:/user_upload/'
+             10: '1:/form_definitions/'
 
 :aspect:`Good to know`
       :ref:`Form/ File storages<concepts-form-file-storages>`
 
 :aspect:`Description`
       EXT:form stores the form definitions within the file system and thus needs
-      write access to this storage. By default, the filemount ``user_uploads`` is
-      used. It is possible to configure a different and/ or an additional
+      write access to this storage. By default, the folder ``form_definitions`` is
+      created and used. It is possible to configure a different and/ or an additional
       filemount which is then utilized for storing and reading forms.