Review main Merged

89324[TASK] Introduce TCA for tx_scheduler_task

Benni Mack CR +2 V +2 Hard +388 −189 updated 05/10/25, 13:49

Commit message

TCA is now added to tx_scheduler_task allowing
to use DataHandler to persist changes within
the scheduler module.

In addition, DatabaseRestrictions can be used
for tx_scheduler_task now, making it best practice
for EXT:scheduler as well.

We also now have history support for scheduler tasks!

Custom logging while persisting is now removed
as DataHandler is taking care of this in sys_log.

FormEngine / Editing is currently unavailable
due to "hideTable => true". Custom persistence
validation is currently still handled in
SchedulerTaskRepository, before it is migrated
to DataHandler hooks in the next patch.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Stefan Froemken +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Stefan Froemken +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 2533

Show 48 earlier messages
  1. Benni Mack uploaded patch set 1 05/09/25, 08:29

  2. core-ci voted on patch set 1 V -1 05/09/25, 08:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78723

  3. Benni Mack uploaded patch set 2 V -1 05/09/25, 09:00

  4. core-ci voted on patch set 2 V -1 05/09/25, 09:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78724

  5. Benni Mack uploaded patch set 3 V -1 05/09/25, 09:34

  6. Benni Mack updated the commit message in patch set 4 05/09/25, 09:36

  7. core-ci voted on patch set 3 V +1 05/09/25, 09:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78725

  8. core-ci voted on patch set 4 V +1 05/09/25, 09:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78726

  1. Stefan Bürk commented on patch set 4 05/09/25, 10:17

    TaskService.php:163

    ```php $taskInformation = $this->getAllTaskTypes()[$task->getTaskType()] ?? null; if (!is_array($taskInformation)) { throw new \RuntimeException('Task Type ' . $task->getTaskType() . ' not found in list of registered tasks', 1641658569); } return (string)($taskInformation['fullTitle']; ``` 1. If array key is not set L157 would emit a array key access error. 2. When returning some other values isset would trigger an issue in the condition. Maybe following could also be an alternative: ```php $taskTypes = $this->getAllTaskTypes(); if (!isset($taskTypes[$task->getTaskType()])) { throw new \RuntimeException('Task Type ' . $task->getTaskType() . ' not found in list of registered tasks', 1641658569); } return $taskTypes[$task->getTaskType()]['fullTitle']; ``` What do you think ?
  2. Stefan Bürk uploaded patch set 5 V +1 05/09/25, 10:30

  3. Stefan Bürk commented on patch set 5 05/09/25, 10:30

    TaskService.php:163 Reply

    Done
  4. core-ci voted on patch set 5 V +1 05/09/25, 10:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78727

  5. Stefan Bürk voted on patch set 5 CR +1 V +1 05/09/25, 10:36

  6. Andreas Kienast commented on patch set 5 05/09/25, 11:43

    SchedulerModuleController.php:586

    Should we directly `return false` if the array is empty? Otherwise we'll get an array key error in line 588 (yeah, that was the case previously as well).

    TaskService.php:177

    AFAICS `cshKey` and `cshLabel` are not used anymore. If that's true, we should get rid of it in another patch.

    tx_scheduler_task.php:74

    I wonder whether we should mark those management fields as "readonly" already or wait until we have FormEngine in place.
  7. Stefan Bürk commented on patch set 5 05/09/25, 11:52

    SchedulerModuleController.php:586 Reply

    We can do that, but even if it is not empty that array "may" happen if field is not provided. So guarding it is required anyway. Good catch !

    tx_scheduler_task.php:74 Reply

    I would wait and handle this within the formengine patch, where it is visible which needs to be set and checked/verified if it would lead to persisting errors or not and similar. Would that be okay for you ?
  8. Stefan Bürk uploaded patch set 6 CR +1 V +1 05/09/25, 11:52

  9. Stefan Bürk commented on patch set 6 05/09/25, 11:52

    SchedulerModuleController.php:586 Reply

    Done
  10. Andreas Kienast commented on patch set 6 05/09/25, 11:54

    tx_scheduler_task.php:74 Reply

    Acknowledged
  11. core-ci voted on patch set 6 V +1 05/09/25, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78729

  12. Stefan Bürk voted on patch set 6 CR +1 V +1 05/09/25, 11:59

  13. Stefan Froemken commented on patch set 6 05/09/25, 12:48

    SchedulerTaskRepository.php:91

    Can you make sure this is INT? Currently setTaskUid will cast that value to int. But as we try to implement more typed arguments I would prefer to cast that value here

    SchedulerTaskRepository.php:116

    We have TCA now. Please use enablefields|delete

    SchedulerTaskRepository.php:120

    Is OK, but I prefer calling process_datamap() before. Method unsetElementsToBeDeleted will check for deleted elements between datamap and cmdmap. But as datamap is empty here, it's OK for now.

    SchedulerTaskRepository.php:153

    Do we still need these annotations? I mean, we have .phpstorm.meta.php, there are IDE plugins supporting this. If you have an unsupported IDE I prefer moving that into a getDataHandler method and given return type will solve that issue much better.

    SchedulerTaskRepository.php:422

    We have TCA now, so I prefer using enablecolumns|disable instead

    Execution.php:351

    ```suggestion return !empty($this->getInterval()) || !empty($this->getCronCmd()); ```

    TaskService.php:174

    Don't know, if this is an int, but if so, please cast to INT

    TaskService.php:182

    pageUid seems to be an INT. Are you sure we should use empty string, if pageUid is not set? I prefer ```suggestion 'pageUid' => (int)($fieldInfo['pageUid'] ?? 0), ```

    tx_scheduler_task.php:47

    Move that before items
  14. Stefan Froemken voted on patch set 6 CR -1 05/09/25, 12:49

  15. Stefan Froemken commented on patch set 6 05/09/25, 12:52

    tx_scheduler_task.php:77

    In earlier version it was "INT unsigned". Can we set is to unsigned here, too?

    tx_scheduler_task.php:83

    In earlier version it was "INT unsigned". Can we set is to unsigned here, too?
  16. Stefan Froemken commented on patch set 6 05/09/25, 12:59

    locallang_tca.xlf:22

    ```suggestion <source>Schedule</source> ``` Or maybe "Execution time".
  17. Benni Mack uploaded patch set 7 CR +1 V +1 05/09/25, 14:37

  18. Benni Mack commented on patch set 6 05/09/25, 14:39

    SchedulerTaskRepository.php:91 Reply

    Done

    SchedulerTaskRepository.php:116 Reply

    what are you talking about? This is the "delete" command from DataHandler, and that's the syntax to trigger this for DataHandler. I guess you mix this with the "dataMap" even though this is the "cmdMap".

    SchedulerTaskRepository.php:120 Reply

    this is the correct way. If you only fill only the cmdmap you don't need to call process_datamap().

    SchedulerTaskRepository.php:153 Reply

    yes. we can remove them

    SchedulerTaskRepository.php:422 Reply

    Done

    Execution.php:351 Reply

    Done

    TaskService.php:174 Reply

    sorry, not an integer

    TaskService.php:182 Reply

    Done

    tx_scheduler_task.php:47 Reply

    Done

    tx_scheduler_task.php:77 Reply

    not possible with DefaultTcaSchema

    tx_scheduler_task.php:83 Reply

    not possible with DefaultTcaSchema

    locallang_tca.xlf:22 Reply

    Current label in module is also Timing, but I do like Schedule.
  19. core-ci voted on patch set 7 V +1 05/09/25, 14:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78731

  20. Benni Mack uploaded patch set 8 05/09/25, 14:57

    Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**")
  21. core-ci voted on patch set 8 V +1 05/09/25, 15:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78733

  22. Stefan Bürk commented on patch set 8 CR +1 V +1 05/10/25, 08:38

  23. Stefan Froemken voted on patch set 8 CR +1 V +1 05/10/25, 13:45

  24. Stefan Bürk voted on patch set 8 CR +2 V +2 05/10/25, 13:49

  25. Stefan Bürk merged patch set 9 05/10/25, 13:49