Review main Abandoned

70643[FEATURE] Add configurable template for locked backend

Jochen Roth CR 0 V 0 Hard +322 −18 updated 07/04/23, 07:28

Commit message

When the backend is locked an error is thrown. This is
somehow misleading information.

This issue is solved by adding a configurable template
which generates a static html file upon activation
and will be served when the backend is in locked state.
The view can be customized with logo and text.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 9

Review log 6399

Show 4874 earlier messages
  1. Jochen Roth uploaded patch set 1 08/16/21, 20:05

  2. Jochen Roth marked it work in progress 08/16/21, 20:05

  3. core-ci voted on patch set 1 V -1 08/16/21, 20:08 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15208

  4. Jochen Roth uploaded patch set 2 08/16/21, 20:36

  5. Jochen Roth uploaded patch set 3 08/16/21, 20:38

  6. core-ci voted on patch set 3 V -1 08/16/21, 21:00 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15212

  7. Jochen Roth uploaded patch set 4 08/17/21, 11:34

  8. core-ci voted on patch set 4 V +1 08/17/21, 11:52 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15230

  9. Jochen Roth uploaded patch set 5 08/17/21, 12:17

  10. Jochen Roth uploaded patch set 6 08/17/21, 12:21

  11. Jochen Roth marked it ready for review 08/17/21, 12:33

  12. core-ci voted on patch set 6 V +1 08/17/21, 12:42 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15234

  13. Jochen Roth uploaded patch set 7 08/17/21, 12:43

  14. core-ci voted on patch set 5 V +1 08/17/21, 12:44 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15232

  15. core-ci voted on patch set 7 V +1 08/17/21, 12:55 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15235

  16. Oli Bartsch commented on patch set 7 08/17/21, 15:10

    LockBackendCommand.php:67

    This seems like a misuse of the argument.

    LockBackendCommand.php:75

    We should check if the logoPath is valid

    LockedBackendGuard.php:54

    Can we use strict types?

    LockedBackendGuard.php:54

    Should we use GeneralUtility::isValidUrl() instead?

    LockedBackendGuard.php:58

    I don't get this check. May you elaborate what this is for?

    locallang_maintenance.xlf:3

    I think this is not that important. However, let's add the real date here.

    locallang_maintenance.xlf:3

    This seems to be wrong.

    BackendLocked.html:5

    This does not seem like a login form ;)

    BackendLocked.html:7

    Do we really need this div?

    Feature-94910-AddTemplateForLockedBackend.rst:12

    Added to what? :)

    Feature-94910-AddTemplateForLockedBackend.rst:33

    How can I use those settings when initiating the lock in the backend instead of CLI? Doesn't sound comfortable if only CLI allows those settings and I have to type them again whenever I want to lock the backend.
  17. Jochen Roth uploaded patch set 8 08/18/21, 16:47

  18. core-ci voted on patch set 8 V -1 08/18/21, 16:51 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15276

  19. Jochen Roth marked it work in progress 08/18/21, 16:59

  20. Jochen Roth uploaded patch set 9 08/18/21, 18:20

  21. core-ci voted on patch set 9 V -1 08/18/21, 18:23 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15282

  22. Jochen Roth uploaded patch set 10 08/18/21, 18:37

  23. core-ci voted on patch set 10 V -1 08/18/21, 19:04 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15285

  24. Jochen Roth uploaded patch set 11 08/19/21, 08:08

  25. core-ci voted on patch set 11 V +1 08/19/21, 08:29 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15298

  26. Jochen Roth uploaded patch set 12 08/19/21, 10:16

  27. Jochen Roth marked it ready for review 08/19/21, 10:25

  28. Jochen Roth updated the commit message in patch set 13 08/19/21, 10:25

  29. core-ci voted on patch set 12 V +1 08/19/21, 10:37 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15301

  30. core-ci voted on patch set 13 V +1 08/19/21, 10:38 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15302

  31. Jochen Roth commented on patch set 13 08/19/21, 10:55

    LockBackendCommand.php:67 Reply

    Now using the argument as it was before.

    LockBackendCommand.php:75 Reply

    Done

    LockedBackendGuard.php:54 Reply

    Done

    LockedBackendGuard.php:54 Reply

    Done

    LockedBackendGuard.php:58 Reply

    Checks if the content is HTML. After having another look, it seems useless and obsolete now.

    locallang_maintenance.xlf:3 Reply

    Done

    locallang_maintenance.xlf:3 Reply

    Done

    BackendLocked.html:5 Reply

    True, removed

    BackendLocked.html:7 Reply

    Nope ... remove it.

    Feature-94910-AddTemplateForLockedBackend.rst:12 Reply

    Done
  32. Oli Bartsch commented on patch set 13 08/19/21, 14:32

    LockBackendCommand.php:71

    IMO this is unecessary hard to read. What about: if ($input->getOption($option) !== null) { $io->note('Option "' . $option . '" has no effect on "redirect" argument'); }

    LockBackendCommand.php:80

    What is this array_filter for?

    LockBackendCommand.php:82

    Do we really need a "service" for this? If at all, this service should also handle the fallbacks. Currently you have duplicated code here and in checkLockedBackend(). This service could be initialized with the "logo", "headline", "text" settings. In the constructor you can then apply the fallbacks. So no setters are needed. Something like: $lockFileContent = GeneralUtility::makeInstance( MaintenanceTemplateService::class, $input->getOption('logo'), $input->getOption('headline'), $input->getOption('text') )->render();

    LockedBackendGuard.php:52

    Same question as in the command, what is this for?

    LockedBackendGuard.php:56

    What happened to this exception. Do we not need it anymore?

    LockedBackendGuard.php:68

    This is now missing. Fells like the case that $lockContent is empty is not longer handled.

    MaintenanceTemplateService.php:50

    Should we check if fileExtension is an allowed image extension?
  33. Jochen Roth uploaded patch set 14 08/20/21, 15:19

  34. core-ci voted on patch set 14 V -1 08/20/21, 15:22 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15332

  35. Jochen Roth uploaded patch set 15 08/20/21, 15:35

  36. core-ci voted on patch set 15 V -1 08/20/21, 15:49 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15336

  37. Jochen Roth uploaded patch set 16 08/20/21, 17:23

  38. core-ci voted on patch set 16 V -1 08/20/21, 17:51 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15339

  39. Jochen Roth uploaded patch set 17 08/20/21, 18:12

  40. core-ci voted on patch set 17 V -1 08/20/21, 18:31 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15341

  41. Jochen Roth uploaded patch set 18 08/20/21, 18:34

  42. Jochen Roth uploaded patch set 19 08/20/21, 18:38

  43. core-ci voted on patch set 19 V +1 08/20/21, 18:54 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15345

  44. Jochen Roth commented on patch set 19 08/20/21, 19:50

    LockBackendCommand.php:71 Reply

    Ack

    LockBackendCommand.php:80 Reply

    To remove empty values so ?? operator can be used for fallbacks.

    LockBackendCommand.php:82 Reply

    Ack

    LockedBackendGuard.php:52 Reply

    see above :-)

    LockedBackendGuard.php:56 Reply

    You are right. This is needed to cover the case someone emptied the file manually.

    LockedBackendGuard.php:68 Reply

    Added it again.

    MaintenanceTemplateService.php:50 Reply

    Yep, make sense. Also now resizing all allowed image formats and convert it to json except .
  45. Oli Bartsch commented on patch set 19 08/23/21, 14:27

    LockBackendCommand.php:47

    We can/should remove this now since "static" is not longe set, right?

    LockBackendCommand.php:72

    when "redirect" argument is set.

    LockBackendCommand.php:84

    As mentioned, those fallbacks should be handled in the MaintenanceTemplate. Currently this is done at various places.

    LockBackendCommand.php:117

    Should not be needed, since fallback should not be handled here.

    LockedBackendGuard.php:47

    Both, LanguageService and ExtensionConfiguration are not needed here as those functionality should be done in the "Service" class.

    LockedBackendGuard.php:112

    Here we have the same code, see the other comment.

    LockedBackendGuard.php:166

    Could we integrate this into the new "Service" class, too? So just having two different methods for output.
  46. Oli Bartsch uploaded patch set 20 08/23/21, 15:08

  47. Oli Bartsch commented on patch set 20 08/23/21, 15:09

    LockBackendCommand.php:84 Reply

    Done

    LockBackendCommand.php:117 Reply

    Done

    LockedBackendGuard.php:47 Reply

    Done

    LockedBackendGuard.php:112 Reply

    Done

    LockedBackendGuard.php:166 Reply

    Done
  48. core-ci voted on patch set 20 V +1 08/23/21, 15:22 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15414

  49. Anja Leichsenring commented on patch set 20 V -1 08/23/21, 16:36

    with PHP 8.0 I get (1/1) #1476107295 TYPO3\CMS\Core\Error\Exception PHP Warning: Undefined array key "BE_USER" in /var/www/html/typo3/sysext/core/Classes/Resource/Security/StoragePermissionsAspect.php line 46 upon logout from BE. Can you please fix that? Nice feature, I like.
  50. Jochen Roth uploaded patch set 21 08/24/21, 09:55

  51. core-ci voted on patch set 21 V +1 08/24/21, 10:15 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15485

  52. Jochen Roth commented on patch set 21 08/24/21, 10:35

    Reply

    Thank you. This should be fixed now.
  53. Christian Kuhn commented on patch set 21 09/06/21, 14:25

    Hey. Not entirely sure here: Merging this *now* would be a late feature, considering the feature freeze tomorrow. I think we should think about and look at two details: The backend maintenance lock can be done i a way that admins are still able to login, right? This can not be configured via cli, though? Furthermore, we should have a look at dependencies since this area should probably have a minimum amount of dependencies. Since fluid gets involved with the patch, we may want to not do this in v11 anymore, since fluid still has this heavy dependency to extbase. We're currently relaxing this, though, so maybe we should just postpone that patch to v12?
  54. Jochen Roth uploaded patch set 22 10/15/21, 09:47

  55. core-ci voted on patch set 22 V -1 10/15/21, 09:49 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18153

  56. Jochen Roth uploaded patch set 23 10/15/21, 11:06

  57. core-ci voted on patch set 23 V +1 10/15/21, 11:39 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18168

  58. Guido Schmechel commented on patch set 23 V -1 10/30/21, 09:46

    The idea is great and we should push this for v12. Unfortunately I still have 2-3 problems. Test 1 with default values => All good Test 2 with "fileadmin/logo.png" CLI reports this: PHP Warning: file_get_contents(/var/www/html/logo.png): Failed to open stream: No such file or directory in /var/www/html/typo3/sysext/backend/Classes/Maintenance/MaintenanceInformation.php line 97 => So the fileadmin folder is missing. Maybe you can test it again with the current master? I'm just unsure if this is due to my setup. Also, I wonder if we can't provide the same functionality as the normal logo? There you can also specify external image addresses, for example.
  59. Jochen Roth uploaded patch set 24 11/02/21, 13:26

  60. Jochen Roth commented on patch set 24 11/02/21, 13:30

    Reply

    > CLI reports this: PHP Warning: file_get_contents(/var/www/html/logo.png): Failed to open stream: No such file or directory in /var/www/html/typo3/sysext/backend/Classes/Maintenance/MaintenanceInformation.php line 97 Thanks for reporting, this is fixed now. > Also, I wonder if we can't provide the same functionality as the normal logo? There you can also specify external image addresses, for example. Now you can also use remote files. But keep in mind, it will still download the file an include it in HTML. Because i wanted to have a static rendered HTML with all styles/images included.
  61. core-ci voted on patch set 24 V +1 11/02/21, 13:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18760

  62. Benni Mack wrote 11/29/21, 10:15

    Change destination moved from master to main
  63. Benni Mack updated the commit message in patch set 25 11/29/21, 11:56

  64. core-ci voted on patch set 25 V +1 11/29/21, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19977

  65. Guido Schmechel rebased onto patch set 26 01/08/22, 14:09

  66. core-ci voted on patch set 26 V +1 01/08/22, 14:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21811

  67. Guido Schmechel commented on patch set 26 CR -1 01/08/22, 14:25

    Small -1 for now, but i really like this feature!

    MaintenanceInformation.php:73

    We should push the function further down (line 80 and also 85). In case we use a config with EXT:, e.g. the default value EXT:backend/Resources/Public/Images/Logo.png, we get an exception because the URL is not retrievable.
  68. Jochen Roth uploaded patch set 27 01/10/22, 10:36

  69. core-ci voted on patch set 27 V +1 01/10/22, 10:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21833

  70. Jochen Roth uploaded patch set 28 01/10/22, 11:01

  71. Jochen Roth commented on patch set 28 01/10/22, 11:13

    MaintenanceInformation.php:73 Reply

    Thanks :-) Now also checking if the file is available locally using getFileAbsFileName() which solves this issue. Also fixed an issue where the local svg file was not displayed.
  72. core-ci voted on patch set 28 V +1 01/10/22, 11:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21838

  73. Jochen Roth uploaded patch set 29 01/10/22, 12:00

  74. Jochen Roth commented on patch set 29 01/10/22, 12:02

    LockBackendCommand.php:47 Reply

    Done

    LockBackendCommand.php:72 Reply

    Done

    MaintenanceInformation.php:73 Reply

    Done

    LockedBackendGuard.php:58 Reply

    Done

    BackendLocked.html:5 Reply

    Done

    BackendLocked.html:7 Reply

    Done

    Feature-94910-AddTemplateForLockedBackend.rst:33 Reply Unresolved

    Also works in case BE->adminOnly is set to -1
  1. core-ci voted on patch set 29 V +1 01/10/22, 12:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21843

  2. Jochen Roth uploaded patch set 30 01/17/22, 13:44

  3. core-ci voted on patch set 30 V +1 01/17/22, 13:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22186

  4. Guido Schmechel voted on patch set 30 V +1 CR +1 01/17/22, 14:02

  5. Christian Kuhn commented on patch set 30 CR -1 01/17/22, 17:05

    Hey. It seems we're relatively close to make backend templates configurable with a more general approach. Let's postpone this patch until this is settled to see how the locked backend view fits in there.
  6. Jochen Roth uploaded patch set 31 07/12/22, 10:04

  7. core-ci voted on patch set 31 V -1 07/12/22, 10:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28960

  8. Jochen Roth uploaded patch set 32 07/12/22, 10:40

  9. core-ci voted on patch set 32 V +1 07/12/22, 10:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28962

  10. Andreas Kienast commented on patch set 32 CR -1 07/12/22, 15:18

    LockBackendCommand.php:45

    As discussed in person - "only for redirect = static" contradicts the code flow in execute().

    MaintenanceInformation.php:44

    title and headline are always the same?

    MaintenanceInformation.php:80

    GeneralUtility::getUrl($this->logoPath) is called twice in this method.

    MaintenanceInformation.php:85

    I wonder what's the benefit of downloading the file just to render a base64 variant, especially since this is a blocking request and may cause troubles on huge files. Can't we use the URL in the src attribute directly? Of course, this needs handling for EXT: paths...

    LockedBackendGuard.php:144

    I know it has been 403 before already, but 503 (Service unavailable) fits more, IMO.
  11. Jochen Roth uploaded patch set 33 07/12/22, 17:30

  12. core-ci voted on patch set 33 V +1 07/12/22, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29002

  13. Jochen Roth commented on patch set 33 07/12/22, 17:41

    LockBackendCommand.php:45 Reply

    Done

    MaintenanceInformation.php:44 Reply

    Yes, now using only headline.

    MaintenanceInformation.php:80 Reply

    Done

    MaintenanceInformation.php:85 Reply

    The idea was to have everything in one single file and neither rely on any TYPO3 resources nor any external sources.

    LockedBackendGuard.php:144 Reply

    Ack
  14. Simon Schaufelberger uploaded patch set 34 08/03/22, 21:33

  15. Simon Schaufelberger uploaded patch set 35 08/03/22, 21:34

  16. core-ci voted on patch set 34 V +1 08/03/22, 21:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29809

  17. core-ci voted on patch set 35 V +1 08/03/22, 21:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29810

  18. Chris Müller uploaded patch set 36 08/08/22, 17:46

  19. core-ci voted on patch set 36 V +1 08/08/22, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29961

  20. Jochen Roth uploaded patch set 37 V +1 12/21/22, 04:00

  21. core-ci voted on patch set 37 V -1 12/21/22, 04:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35256

  22. Jochen Roth uploaded patch set 38 V -1 12/21/22, 04:27

  23. core-ci voted on patch set 38 V +1 12/21/22, 04:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35259

  24. Jochen Roth commented on patch set 38 CR -1 12/21/22, 04:40

    For now, as i'm waiting for Lolli's response.
  25. Jochen Roth abandoned the change 07/04/23, 07:28

    This feature is is only useful for very few people