diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-02 22:51:07 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-02 22:51:07 +0300 |
| commit | d5d15072e193ba96f156fea3e32bcb0af96b7b63 (patch) | |
| tree | 53781fcc88f504013381933c7dc487140b4c1223 /classes/RSSUtils.php | |
| parent | 5256edd484d6d3efdd870fd04d09c289e2d23c61 (diff) | |
move scheduled tasks to a separate class, add some try-catches, improve/shorten logging and descriptions
Diffstat (limited to 'classes/RSSUtils.php')
| -rw-r--r-- | classes/RSSUtils.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php index 575a1eda1..bf05e0b98 100644 --- a/classes/RSSUtils.php +++ b/classes/RSSUtils.php @@ -1715,7 +1715,9 @@ class RSSUtils { static function init_housekeeping_tasks() : void { Debug::log('Registering scheduled tasks for housekeeping...'); - PluginHost::getInstance()->add_scheduled_task('purge_orphans', '@daily', + $scheduler = Scheduler::getInstance(); + + $scheduler->add_scheduled_task('purge_orphans', '@daily', function() { Article::_purge_orphans(); @@ -1723,7 +1725,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('disk_cache_expire_all', '@daily', + $scheduler->add_scheduled_task('disk_cache_expire_all', '@daily', function() { $cache = DiskCache::instance(""); $cache->expire_all(); @@ -1732,7 +1734,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('expire_error_log', '@hourly', + $scheduler->add_scheduled_task('expire_error_log', '@hourly', function() { self::expire_error_log(); @@ -1740,7 +1742,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('expire_lock_files', '@hourly', + $scheduler->add_scheduled_task('expire_lock_files', '@hourly', function() { self::expire_lock_files(); @@ -1748,7 +1750,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('disable_failed_feeds', '@daily', + $scheduler->add_scheduled_task('disable_failed_feeds', '@daily', function() { self::disable_failed_feeds(); @@ -1756,7 +1758,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('migrate_feed_icons', '@daily', + $scheduler->add_scheduled_task('migrate_feed_icons', '@daily', function() { self::migrate_feed_icons(); @@ -1764,7 +1766,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('cleanup_feed_icons', '@daily', + $scheduler->add_scheduled_task('cleanup_feed_icons', '@daily', function() { self::cleanup_feed_icons(); @@ -1772,7 +1774,7 @@ class RSSUtils { } ); - PluginHost::getInstance()->add_scheduled_task('send_headlines_digests', '@hourly', + $scheduler->add_scheduled_task('send_headlines_digests', '@hourly', function() { Digest::send_headlines_digests(); @@ -1782,7 +1784,8 @@ class RSSUtils { } static function housekeeping_common(): void { - PluginHost::getInstance()->run_due_tasks(); + Scheduler::getInstance()->run_due_tasks(); + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING); } |