Use config value to trigger automated rating
This commit is contained in:
parent
c4aebffd3b
commit
df75a24dc7
|
@ -602,7 +602,7 @@ class Feed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$dryRun) {
|
if (!$dryRun && DI::config()->get('system', 'adjust_poll_frequency')) {
|
||||||
self::adjustPollFrequency($contact, $creation_dates);
|
self::adjustPollFrequency($contact, $creation_dates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,8 +716,9 @@ class Feed
|
||||||
$priority = 3; // Poll once a day
|
$priority = 3; // Poll once a day
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['priority'] != $priority) {
|
if ($contact['rating'] != $priority) {
|
||||||
Logger::notice('Adjusting priority', ['old' => $contact['priority'], 'new' => $priority, 'id' => $contact['id'], 'uid' => $contact['uid'], 'url' => $contact['url']]);
|
Logger::notice('Adjusting priority', ['old' => $contact['rating'], 'new' => $priority, 'id' => $contact['id'], 'uid' => $contact['uid'], 'url' => $contact['url']]);
|
||||||
|
DBA::update('contact', ['rating' => $priority], ['id' => $contact['id']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ class Cron
|
||||||
Addon::reload();
|
Addon::reload();
|
||||||
|
|
||||||
$sql = "SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`,
|
$sql = "SELECT `contact`.`id`, `contact`.`nick`, `contact`.`name`, `contact`.`network`, `contact`.`archive`,
|
||||||
`contact`.`last-update`, `contact`.`priority`, `contact`.`rel`, `contact`.`subhub`
|
`contact`.`last-update`, `contact`.`priority`, `contact`.`rating`, `contact`.`rel`, `contact`.`subhub`
|
||||||
FROM `user`
|
FROM `user`
|
||||||
STRAIGHT_JOIN `contact`
|
STRAIGHT_JOIN `contact`
|
||||||
ON `contact`.`uid` = `user`.`uid` AND `contact`.`poll` != ''
|
ON `contact`.`uid` = `user`.`uid` AND `contact`.`poll` != ''
|
||||||
|
@ -217,6 +217,11 @@ class Cron
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($contact = DBA::fetch($contacts)) {
|
while ($contact = DBA::fetch($contacts)) {
|
||||||
|
// Use the "rating" field when auto adjusting the poll intervall
|
||||||
|
if (DI::config()->get('system', 'adjust_poll_frequency') && ($contact['network'] == Protocol::FEED)) {
|
||||||
|
$contact['priority'] = max($contact['rating'], $contact['priority']);
|
||||||
|
}
|
||||||
|
|
||||||
// Friendica and OStatus are checked once a day
|
// Friendica and OStatus are checked once a day
|
||||||
if (in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
|
if (in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
|
||||||
$contact['priority'] = 3;
|
$contact['priority'] = 3;
|
||||||
|
|
|
@ -82,6 +82,10 @@ return [
|
||||||
'php_path' => 'php',
|
'php_path' => 'php',
|
||||||
],
|
],
|
||||||
'system' => [
|
'system' => [
|
||||||
|
// adjust_poll_frequency (Boolean)
|
||||||
|
// Automatically detect and set the best feed poll frequency.
|
||||||
|
'adjust_poll_frequency' => false,
|
||||||
|
|
||||||
// allowed_link_protocols (Array)
|
// allowed_link_protocols (Array)
|
||||||
// Allowed protocols in links URLs, add at your own risk. http(s) is always allowed.
|
// Allowed protocols in links URLs, add at your own risk. http(s) is always allowed.
|
||||||
'allowed_link_protocols' => ['ftp://', 'ftps://', 'mailto:', 'cid:', 'gopher://'],
|
'allowed_link_protocols' => ['ftp://', 'ftps://', 'mailto:', 'cid:', 'gopher://'],
|
||||||
|
|
Loading…
Reference in a new issue