<?php
use Friendica\Core\Config;
+use Friendica\Core\Worker;
+use Friendica\Database\DBM;
function cron_run(&$argv, &$argc){
global $a;
return;
}
- $last = get_config('system', 'last_cron');
+ $last = Config::get('system', 'last_cron');
- $poll_interval = intval(get_config('system', 'cron_interval'));
+ $poll_interval = intval(Config::get('system', 'cron_interval'));
if (! $poll_interval) {
$poll_interval = 10;
}
logger('cron: start');
// run queue delivery process in the background
- proc_run(PRIORITY_NEGLIGIBLE, "include/queue.php");
+ Worker::add(PRIORITY_NEGLIGIBLE, "queue");
// run the process to discover global contacts in the background
- proc_run(PRIORITY_LOW, "include/discover_poco.php");
+ Worker::add(PRIORITY_LOW, "discover_poco");
// run the process to update locally stored global contacts in the background
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "checkcontact");
+ Worker::add(PRIORITY_LOW, "discover_poco", "checkcontact");
// Expire and remove user entries
- proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "expire_and_remove_users");
-
- // Check OStatus conversations
- proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_mentions");
-
- // Check every conversation
- proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "ostatus_conversations");
+ Worker::add(PRIORITY_MEDIUM, "cronjobs", "expire_and_remove_users");
// Call possible post update functions
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "post_update");
+ Worker::add(PRIORITY_LOW, "cronjobs", "post_update");
// update nodeinfo data
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "nodeinfo");
+ Worker::add(PRIORITY_LOW, "cronjobs", "nodeinfo");
// Clear cache entries
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "clear_cache");
+ Worker::add(PRIORITY_LOW, "cronjobs", "clear_cache");
// Repair missing Diaspora values in contacts
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "repair_diaspora");
+ Worker::add(PRIORITY_LOW, "cronjobs", "repair_diaspora");
// Repair entries in the database
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "repair_database");
+ Worker::add(PRIORITY_LOW, "cronjobs", "repair_database");
// once daily run birthday_updates and then expire in background
- $d1 = get_config('system', 'last_expire_day');
+ $d1 = Config::get('system', 'last_expire_day');
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
if ($d2 != intval($d1)) {
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_contact_birthdays");
+ Worker::add(PRIORITY_LOW, "cronjobs", "update_contact_birthdays");
+
+ Worker::add(PRIORITY_LOW, "discover_poco", "update_server");
+
+ Worker::add(PRIORITY_LOW, "discover_poco", "suggestions");
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server");
+ Config::set('system', 'last_expire_day', $d2);
- proc_run(PRIORITY_LOW, "include/discover_poco.php", "suggestions");
+ Worker::add(PRIORITY_LOW, 'expire');
- set_config('system', 'last_expire_day', $d2);
+ Worker::add(PRIORITY_MEDIUM, 'dbclean');
- proc_run(PRIORITY_LOW, 'include/expire.php');
+ Worker::add(PRIORITY_LOW, "cronjobs", "update_photo_albums");
- proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
+ // Delete all done workerqueue entries
+ dba::delete('workerqueue', array('`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR'));
- proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_photo_albums");
+ // check upstream version?
+ Worker::add(PRIORITY_LOW, 'checkversion');
}
// Poll contacts
logger('cron: end');
- set_config('system', 'last_cron', time());
+ Config::set('system', 'last_cron', time());
return;
}
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
- $abandon_days = intval(get_config('system', 'account_abandon_days'));
+ $abandon_days = intval(Config::get('system', 'account_abandon_days'));
if ($abandon_days < 1) {
$abandon_days = 0;
}
dbesc(NETWORK_MAIL2)
);
- if (!dbm::is_result($contacts)) {
+ if (!DBM::is_result($contacts)) {
return;
}
intval($c['id'])
);
- if (!dbm::is_result($res)) {
+ if (!DBM::is_result($res)) {
continue;
}
* This also lets us update our subscription to the hub, and add or replace hubs in case it
* changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
*/
- $poll_interval = get_config('system', 'pushpoll_frequency');
+ $poll_interval = Config::get('system', 'pushpoll_frequency');
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
}
} else {
$priority = PRIORITY_LOW;
}
- proc_run(array('priority' => $priority, 'dont_fork' => true), 'include/onepoll.php', intval($contact['id']));
+ Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']);
}
}
}