]> git.mxchange.org Git - friendica.git/blobdiff - include/cron.php
Merge pull request #3902 from annando/worker-space
[friendica.git] / include / cron.php
index d4d19d8c86dc7e6f6a81418e2fd7f85e4a67826d..01989826da28716ea14ddeecdd3719824e18464b 100644 (file)
@@ -2,6 +2,7 @@
 
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
+use Friendica\Database\DBM;
 
 function cron_run(&$argv, &$argc){
        global $a;
@@ -14,9 +15,9 @@ function cron_run(&$argv, &$argc){
                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;
        }
@@ -59,7 +60,7 @@ function cron_run(&$argv, &$argc){
        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)) {
@@ -70,7 +71,7 @@ function cron_run(&$argv, &$argc){
 
                Worker::add(PRIORITY_LOW, "discover_poco", "suggestions");
 
-               set_config('system', 'last_expire_day', $d2);
+               Config::set('system', 'last_expire_day', $d2);
 
                Worker::add(PRIORITY_LOW, 'expire');
 
@@ -90,7 +91,7 @@ function cron_run(&$argv, &$argc){
 
        logger('cron: end');
 
-       set_config('system', 'last_cron', time());
+       Config::set('system', 'last_cron', time());
 
        return;
 }
@@ -135,7 +136,7 @@ function cron_poll_contacts($argc, $argv) {
        // 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;
        }
@@ -161,7 +162,7 @@ function cron_poll_contacts($argc, $argv) {
                dbesc(NETWORK_MAIL2)
        );
 
-       if (!dbm::is_result($contacts)) {
+       if (!DBM::is_result($contacts)) {
                return;
        }
 
@@ -171,7 +172,7 @@ function cron_poll_contacts($argc, $argv) {
                        intval($c['id'])
                );
 
-               if (!dbm::is_result($res)) {
+               if (!DBM::is_result($res)) {
                        continue;
                }
 
@@ -194,7 +195,7 @@ function cron_poll_contacts($argc, $argv) {
                                 * 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);
                        }
 
@@ -251,7 +252,7 @@ function cron_poll_contacts($argc, $argv) {
                        } else {
                                $priority = PRIORITY_LOW;
                        }
-                       Worker::add(array('priority' => $priority, 'dont_fork' => true), 'onepoll', (int)$contact['id']);
+                       Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']);
                }
        }
 }