MDL-79131 core: Added new Hook instance for task failed max delay

This commit is contained in:
raortegar
2024-04-03 09:08:50 +02:00
parent cc6316368e
commit abefcdb09a
2 changed files with 52 additions and 0 deletions
@@ -0,0 +1,51 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
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 <[email protected]>
* @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;
}
}
+1
View File
@@ -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 ===