summaryrefslogtreecommitdiff
path: root/classes/Scheduler.php
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-05-04 14:20:17 +0000
committerwn_ <invalid@email.com>2025-05-04 14:20:17 +0000
commit3ee0f331cc9c22e3a5a4daf27ad11ec9c99b2396 (patch)
treeb579adf2b995d8bcdcaaf1419803c8e349e659f9 /classes/Scheduler.php
parent07eb34529f27e410fb14f7ab394beb9923cc50d4 (diff)
Move registration of 'purge_orphaned_scheduled_tasks' into Scheduler.
Diffstat (limited to 'classes/Scheduler.php')
-rw-r--r--classes/Scheduler.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/classes/Scheduler.php b/classes/Scheduler.php
index f86feed65..13d8e94ea 100644
--- a/classes/Scheduler.php
+++ b/classes/Scheduler.php
@@ -7,6 +7,14 @@ class Scheduler {
/** @var array<string, mixed> */
private array $scheduled_tasks = [];
+ function __construct() {
+ $this->add_scheduled_task('purge_orphaned_scheduled_tasks', '@weekly',
+ function() {
+ return $this->purge_orphaned_tasks();
+ }
+ );
+ }
+
public static function getInstance(): Scheduler {
if (self::$instance == null)
self::$instance = new self();
@@ -126,7 +134,7 @@ class Scheduler {
*
* @return int 0 if successful, 1 on failure
*/
- function purge_orphaned_tasks(): int {
+ private function purge_orphaned_tasks(): int {
if (!$this->scheduled_tasks) {
Debug::log(__METHOD__ . ' was invoked before scheduled tasks have been registered. This should never happen.');
return 1;