mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 14:17:27 +02:00
Merge branch 'feature/move-purge_orphaned_scheduled_tasks' into 'master'
Move registration of 'purge_orphaned_scheduled_tasks' into Scheduler. See merge request tt-rss/tt-rss!128
This commit is contained in:
commit
d4faf2d369
@ -1702,12 +1702,6 @@ class RSSUtils {
|
||||
|
||||
$scheduler = Scheduler::getInstance();
|
||||
|
||||
$scheduler->add_scheduled_task('purge_orphaned_scheduled_tasks', '@weekly',
|
||||
function() use ($scheduler) {
|
||||
return $scheduler->purge_orphaned_tasks();
|
||||
}
|
||||
);
|
||||
|
||||
$scheduler->add_scheduled_task('purge_orphans', '@daily',
|
||||
function() {
|
||||
Article::_purge_orphans();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user