X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FCron.php;h=6afa61601623c81ae07feb43b2dad782e86e532b;hb=ed9c50ea2e2f3ad261bab215723d4ab8ed0877b4;hp=43c33103b3cf375f1798538cbc48d4b5c525686d;hpb=f41c891a6b255373d3bccc63c2e455a96ddaf0f8;p=friendica.git diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 43c33103b3..6afa616016 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -9,6 +9,8 @@ use Friendica\Core\Worker; use Friendica\Database\DBM; use dba; +require_once 'include/dba.php'; + Class Cron { public static function execute($parameter = '', $generation = 0) { global $a; @@ -153,17 +155,14 @@ Class Cron { : '' ); - $contacts = q("SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, - `contact`.`last-update`, `contact`.`priority`, `contact`.`subhub` + $contacts = q("SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`, + `contact`.`last-update`, `contact`.`priority`, `contact`.`rel`, `contact`.`subhub` FROM `user` STRAIGHT_JOIN `contact` - ON `contact`.`uid` = `user`.`uid` AND `contact`.`rel` IN (%d, %d) AND `contact`.`poll` != '' + ON `contact`.`uid` = `user`.`uid` AND `contact`.`poll` != '' AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s') $sql_extra - AND NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly` - AND NOT `contact`.`archive` + AND NOT `contact`.`self` AND NOT `contact`.`blocked` WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql", - intval(CONTACT_IS_SHARING), - intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), @@ -181,6 +180,7 @@ Class Cron { $contact['last-update'] = NULL_DATE; } + // Friendica and OStatus are checked once a day if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS))) { $contact['priority'] = 2; } @@ -193,7 +193,17 @@ Class Cron { * changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'. */ $poll_interval = Config::get('system', 'pushpoll_frequency'); - $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); + $contact['priority'] = (!is_null($poll_interval) ? intval($poll_interval) : 3); + } + + // Check Diaspora contacts or followers once a week + if (($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == CONTACT_IS_FOLLOWER)) { + $contact['priority'] = 4; + } + + // Check archived contacts once a month + if ($contact['archive']) { + $contact['priority'] = 5; } if (($contact['priority'] >= 0) && !$force) { @@ -242,13 +252,16 @@ Class Cron { } } - logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact["nick"] . " " . $contact["name"]); - if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) { $priority = PRIORITY_MEDIUM; + } elseif ($contact['archive']) { + $priority = PRIORITY_NEGLIGIBLE; } else { $priority = PRIORITY_LOW; } + + logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]); + Worker::add(array('priority' => $priority, 'dont_fork' => true), 'OnePoll', (int)$contact['id']); } }