71525[TASK] Replace file and folder actions with enumerations
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 26
- typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php2+3 −2
- typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php+2 −1
- typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php+3 −2
- typo3/sysext/core/Classes/Imaging/IconFactory.php+2 −1
- typo3/sysext/core/Classes/Resource/Enumeration/FileAction.phpnew+33 −0
- typo3/sysext/core/Classes/Resource/Enumeration/FolderAction.phpnew+33 −0
- typo3/sysext/core/Classes/Resource/Enumeration/ResourceAction.php2new+34 −0
- typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php+2 −1
- typo3/sysext/core/Classes/Resource/CanCheckActionPermissionAbility.phpnew+26 −0
- typo3/sysext/core/Classes/Resource/File.php+7 −6
- typo3/sysext/core/Classes/Resource/Folder.php+4 −3
- typo3/sysext/core/Classes/Resource/ResourceStorage.php2+69 −47
- typo3/sysext/core/Documentation/Changelog/master/Deprecation-95555-UseFileActionAndFolderActionEnumerations.rstnew+70 −0
- typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php+14 −12
- typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php+14 −13
- typo3/sysext/filelist/Classes/Controller/File/CreateFolderController.php+4 −2
- typo3/sysext/filelist/Classes/Controller/FileDownloadController.php+2 −1
- typo3/sysext/filelist/Classes/Controller/FileListController.php+12 −9
- typo3/sysext/filelist/Classes/FileList.php+19 −17
- typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php+5 −3
Show 6 more files
- typo3/sysext/impexp/Classes/Export.php+3 −2
- typo3/sysext/recordlist/Classes/Browser/FileBrowser.php+2 −1
- typo3/sysext/recordlist/Classes/Browser/FolderBrowser.php+2 −1
- typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php+4 −3
- typo3/sysext/recordlist/Classes/View/FolderUtilityRenderer.php+3 −2
- typo3/sysext/setup/Classes/Controller/SetupModuleController.php+2 −1
Review log 1113
-
Nikita Hovratov uploaded patch set 1 10/10/21, 12:36
-
core-ci voted on patch set 1 V +1 10/10/21, 12:57 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17892
-
Mathias Brodala commented on patch set 1 10/11/21, 07:28
-
Nikita Hovratov uploaded patch set 2 10/11/21, 10:48
-
Nikita Hovratov commented on patch set 2 10/11/21, 10:54
ResourceStorage.php:722ReplyThanks for the review! I extended the code as you suggested. Internally now only enumeration objects are passed. In v12 strings can then be deprecated. -
Mathias Brodala commented on patch set 2 10/11/21, 10:59
ResourceAction.php:34This should be dropped again and the constants be duplicated in FileAction/FolderAction. We do not need any de-duplication here since these constants belong to each enumeration separately. It's just coincidence that they have the same name/value. -
core-ci voted on patch set 2 V +1 10/11/21, 11:03 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17908
-
Nikita Hovratov commented on patch set 2 10/11/21, 11:18
ResourceAction.php:34Reply UnresolvedI did this, because we have some instances, where File and Folder are called polymorphicly (the method "checkActionPermission"). This is just for convenience. Or else we would need to add a if ($fileOrFolder instanceof Folder) check everywhere (60 or so occurrences). So in fact it's not even a coincidence I would argue. Just the intersection of actions, that can be performed on both Files and Folders. -
Benni Mack commented on patch set 2 10/11/21, 14:53
Hey Nikita. does this actually fix a bug? If not, I suggest we wait with this change, go with PHP 8.1 "Enum" built-in? -
Nikita Hovratov commented on patch set 2 10/11/21, 17:42
Reply
No, it's just housekeeping. Wow, enums in PHP 8.1 look very great! Do you think we will raise the minimum PHP version to 8.1 in TYPO3 v12 as well? Either way, let's wait with that until branching off. -
Oliver Hader commented on patch set 2 10/12/21, 09:02
ElementInformationController.php:212Why are we still using `Enumeration::cast` instead of directly using the constant `ResourceAction::READ`? -
Nikita Hovratov commented on patch set 2 10/12/21, 09:05
ElementInformationController.php:212Reply UnresolvedThis should ensure, a valid object is passed as parameter instead of a string. -
Nikita Hovratov abandoned the change 11/04/21, 17:13
Not so important. Can be picked up later in v12 maybe.
ResourceStorage.php:722