Commit 07727da3 authored by Thomas Kieslich's avatar Thomas Kieslich Committed by Christian Kuhn
Browse files

[TASK] EXT:form - use own folder for form definitions

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: default avatarDaniel Lorenz <daniel.lorenz@extco.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Tested-by: default avatarDaniel Lorenz <daniel.lorenz@extco.de>
Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: default avatarCarlos Meyer <cm@davitec.de>
Tested-by: default avatarCarlos Meyer <cm@davitec.de>
Reviewed-by: Björn Jacob's avatarBjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Björn Jacob's avatarBjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent b75df14c
.. 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
......@@ -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
......
......@@ -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;
......
......@@ -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:
......
......@@ -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/
......
......@@ -12,7 +12,7 @@ Full default configuration
persistenceManager:
allowedFileMounts:
10: '1:/user_upload/'
10: '1:/form_definitions/'
allowSaveToExtensionPaths: false
allowDeleteFromExtensionPaths: false
prototypes:
......
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment