diff --git a/lib/classes/hook/task/after_failed_task_max_delay.php b/lib/classes/hook/task/after_failed_task_max_delay.php new file mode 100644 index 00000000000..cf081bce7af --- /dev/null +++ b/lib/classes/hook/task/after_failed_task_max_delay.php @@ -0,0 +1,51 @@ +. + +namespace core\hook\task; + +use core\hook\described_hook; +use core\task\task_base; + +/** + * Hook to allow plugins to get information when a task has reached the maximum fail delay in adhoc and scheduled task + * + * @package core + * @copyright 2024 Raquel Ortega + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +#[\core\attribute\tags('task')] +#[\core\attribute\label('Allow plugins to get information when a task reaches its maximum failure delay.')] +final class after_failed_task_max_delay { + + /** + * Constructor. + * @param task_base $task failed task. + */ + public function __construct( + protected task_base $task, + ) { + + } + + /** + * Get the task object. + * + * @return task_base Task object. + */ + public function get_task(): task_base { + return $this->task; + } +} diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 163bde8bb81..2da28f158d1 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -137,6 +137,7 @@ information provided here is intended especially for developers. because there aren't cases in core. - Deprecation: Cannot use the "Test" suffix on abstract test case classes. Proceed to rename them to end with "TestCase" instead. +* A new hook called after_failed_task_max_delay has been created. This hook will be triggered when an Ad-hoc or Scheduled task reaches its maximum failure delay. === 4.3 ===