1
1
Fork 0

Merge remote-tracking branch 'upstream/3.5.2rc' into 1705-dbclean-advanced

This commit is contained in:
Michael 2017-05-24 20:55:12 +00:00
commit d649873f80
8 changed files with 11046 additions and 14 deletions

View file

@ -55,6 +55,7 @@ Example: To set the directory value please add this line to your .htconfig.php:
* **max_batch_queue** - Default value is 1000. * **max_batch_queue** - Default value is 1000.
* **max_processes_backend** - Maximum number of concurrent database processes for background tasks. Default value is 5. * **max_processes_backend** - Maximum number of concurrent database processes for background tasks. Default value is 5.
* **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20. * **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20.
* **min_poll_interval** - minimal distance in minutes between two polls for a contact. Default is 1. Reasonable values are between 1 and 59.
* **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated. * **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated.
* **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'. * **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'.
* **memcache_port** - Portnumber of the memcache daemon. Default is 11211. * **memcache_port** - Portnumber of the memcache daemon. Default is 11211.

View file

@ -122,6 +122,8 @@ function cron_poll_contacts($argc, $argv) {
$force = true; $force = true;
} }
$min_poll_interval = Config::get('system', 'min_poll_interval', 1);
$sql_extra = (($manual_id) ? " AND `id` = $manual_id " : ""); $sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");
reload_plugins(); reload_plugins();
@ -195,7 +197,7 @@ function cron_poll_contacts($argc, $argv) {
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
} }
if ($contact['priority'] AND !$force) { if (($contact['priority'] >= 0) AND !$force) {
$update = false; $update = false;
$t = $contact['last-update']; $t = $contact['last-update'];
@ -225,11 +227,16 @@ function cron_poll_contacts($argc, $argv) {
} }
break; break;
case 1: case 1:
default:
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) { if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
$update = true; $update = true;
} }
break; break;
case 0:
default:
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + ".$min_poll_interval." minute")) {
$update = true;
}
break;
} }
if (!$update) { if (!$update) {
continue; continue;

View file

@ -2076,7 +2076,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
drop_item($item['id'], false); drop_item($item['id'], false);
} }
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid); proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
} }
@ -2099,7 +2099,7 @@ function drop_items($items) {
// multiple threads may have been deleted, send an expire notification // multiple threads may have been deleted, send an expire notification
if ($uid) { if ($uid) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid); proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
} }
} }
@ -2290,11 +2290,12 @@ function drop_item($id, $interactive = true) {
} }
} }
// send the notification upstream/downstream
// The priority depends on how the deletion is done.
$drop_id = intval($item['id']); $drop_id = intval($item['id']);
$priority = ($interactive ? PRIORITY_HIGH : PRIORITY_LOW);
// send the notification upstream/downstream as the case may be proc_run($priority, "include/notifier.php", "drop", $drop_id);
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
if (! $interactive) { if (! $interactive) {
return $owner; return $owner;

View file

@ -55,6 +55,17 @@ function notifier_run(&$argv, &$argc){
return; return;
} }
// Inherit the priority
$queue = dba::select('workerqueue', array('priority'), array('pid' => getmypid()), array('limit' => 1));
if (dbm::is_result($queue)) {
$priority = (int)$queue['priority'];
logger('inherited priority: '.$priority);
} else {
// Normally this shouldn't happen.
$priority = PRIORITY_HIGH;
logger('no inherited priority! Something is wrong.');
}
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG); logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
$cmd = $argv[1]; $cmd = $argv[1];
@ -348,7 +359,7 @@ function notifier_run(&$argv, &$argc){
// a delivery fork. private groups (forum_mode == 2) do not uplink // a delivery fork. private groups (forum_mode == 2) do not uplink
if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) { if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
proc_run(PRIORITY_HIGH,'include/notifier.php','uplink',$item_id); proc_run($priority, 'include/notifier.php', 'uplink', $item_id);
} }
$conversants = array(); $conversants = array();
@ -487,7 +498,7 @@ function notifier_run(&$argv, &$argc){
} }
logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG); logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
proc_run(PRIORITY_HIGH,'include/delivery.php', $cmd, $item_id, $contact['id']); proc_run($priority, 'include/delivery.php', $cmd, $item_id, $contact['id']);
} }
} }
@ -552,7 +563,7 @@ function notifier_run(&$argv, &$argc){
if ((! $mail) && (! $fsuggest) && (! $followup)) { if ((! $mail) && (! $fsuggest) && (! $followup)) {
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]); logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$rr['id']); proc_run($priority, 'include/delivery.php', $cmd, $item_id, $rr['id']);
} }
} }
} }
@ -592,7 +603,7 @@ function notifier_run(&$argv, &$argc){
} }
// Handling the pubsubhubbub requests // Handling the pubsubhubbub requests
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php'); proc_run($priority, 'include/pubsubpublish.php');
} }
logger('notifier: calling hooks', LOGGER_DEBUG); logger('notifier: calling hooks', LOGGER_DEBUG);

View file

@ -1,8 +1,7 @@
<?php <?php
use Friendica\App; use Friendica\App;
use Friendica\Network\Probe;
require_once 'include/probe.php';
function probe_content(App $a) { function probe_content(App $a) {
@ -22,7 +21,7 @@ function probe_content(App $a) {
if (x($_GET, 'addr')) { if (x($_GET, 'addr')) {
$addr = trim($_GET['addr']); $addr = trim($_GET['addr']);
$res = probe_url($addr); $res = Probe::uri($addr, "", 0, false);
$o .= '<pre>'; $o .= '<pre>';
$o .= str_replace("\n", '<br />', print_r($res, true)); $o .= str_replace("\n", '<br />', print_r($res, true));
$o .= '</pre>'; $o .= '</pre>';

View file

@ -79,6 +79,8 @@ class Probe {
$xrd_timeout = Config::get('system', 'xrd_timeout', 20); $xrd_timeout = Config::get('system', 'xrd_timeout', 20);
$redirects = 0; $redirects = 0;
logger("Probing for ".$host, LOGGER_DEBUG);
$ret = z_fetch_url($ssl_url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml')); $ret = z_fetch_url($ssl_url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) { if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
return false; return false;
@ -101,6 +103,7 @@ class Probe {
$links = xml::element_to_array($xrd); $links = xml::element_to_array($xrd);
if (!isset($links["xrd"]["link"])) { if (!isset($links["xrd"]["link"])) {
logger("No xrd data found for ".$host, LOGGER_DEBUG);
return false; return false;
} }
@ -214,6 +217,7 @@ class Probe {
} }
if (!$lrdd) { if (!$lrdd) {
logger("No lrdd data found for ".$uri, LOGGER_DEBUG);
return array(); return array();
} }
@ -249,6 +253,7 @@ class Probe {
} }
if (!is_array($webfinger["links"])) { if (!is_array($webfinger["links"])) {
logger("No webfinger links found for ".$uri, LOGGER_DEBUG);
return false; return false;
} }
@ -435,6 +440,7 @@ class Probe {
$addr = $uri; $addr = $uri;
} else { } else {
logger("Uri ".$uri." was not detectable", LOGGER_DEBUG);
return false; return false;
} }
@ -544,6 +550,7 @@ class Probe {
$webfinger = json_decode($data, true); $webfinger = json_decode($data, true);
if (!isset($webfinger["links"])) { if (!isset($webfinger["links"])) {
logger("No json webfinger links for ".$url, LOGGER_DEBUG);
return false; return false;
} }
@ -552,6 +559,7 @@ class Probe {
$xrd_arr = xml::element_to_array($xrd); $xrd_arr = xml::element_to_array($xrd);
if (!isset($xrd_arr["xrd"]["link"])) { if (!isset($xrd_arr["xrd"]["link"])) {
logger("No XML webfinger links for ".$url, LOGGER_DEBUG);
return false; return false;
} }
@ -599,11 +607,13 @@ class Probe {
} }
$content = $ret['body']; $content = $ret['body'];
if (!$content) { if (!$content) {
logger("Empty body for ".$noscrape_url, LOGGER_DEBUG);
return false; return false;
} }
$json = json_decode($content, true); $json = json_decode($content, true);
if (!is_array($json)) { if (!is_array($json)) {
logger("No json data for ".$noscrape_url, LOGGER_DEBUG);
return false; return false;
} }

8941
view/lang/en-GB/messages.po Normal file

File diff suppressed because it is too large Load diff

2062
view/lang/en-GB/strings.php Normal file

File diff suppressed because it is too large Load diff