diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/contact_widgets.php | 2 | ||||
-rw-r--r-- | include/delivery.php | 11 | ||||
-rw-r--r-- | include/network.php | 6 | ||||
-rw-r--r-- | include/notifier.php | 4 | ||||
-rw-r--r-- | include/poller.php | 13 | ||||
-rw-r--r-- | include/socgraph.php | 1 |
6 files changed, 32 insertions, 5 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index bf3a86958..4dab6a53e 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -143,7 +143,7 @@ function common_friends_visitor_widget($profile_uid) { $cid = $zcid = 0; if(can_write_wall($a,$profile_uid)) - $cid = local_user(); + $cid = remote_user(); else { if(get_my_url()) { $r = q("select id from contact where nurl = '%s' and uid = %d limit 1", diff --git a/include/delivery.php b/include/delivery.php index 794b8f27a..28d81226a 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -51,6 +51,17 @@ function delivery_run($argv, $argc){ return; } + $maxsysload = intval(get_config('system','maxloadavg')); + if($maxsysload < 1) + $maxsysload = 50; + if(function_exists('sys_getloadavg')) { + $load = sys_getloadavg(); + if(intval($load[0]) > $maxsysload) { + logger('system: load ' . $load . ' too high. Delivery deferred to next queue run.'); + return; + } + } + // It's ours to deliver. Remove it from the queue. q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1", diff --git a/include/network.php b/include/network.php index 4bec4a172..27a45ec40 100644 --- a/include/network.php +++ b/include/network.php @@ -583,7 +583,7 @@ function fetch_xrd_links($url) { // Take a URL from the wild, prepend http:// if necessary -// and check DNS to see if it's real +// and check DNS to see if it's real (or check if is a valid IP address) // return true if it's OK, false if something is wrong with it if(! function_exists('validate_url')) { @@ -596,7 +596,7 @@ function validate_url(&$url) { $url = 'http://' . $url; $h = @parse_url($url); - if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) { + if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return true; } return false; @@ -611,7 +611,7 @@ function validate_email($addr) { return false; $h = substr($addr,strpos($addr,'@') + 1); - if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX))) { + if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return true; } return false; diff --git a/include/notifier.php b/include/notifier.php index 922e869f6..6ce281372 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -47,7 +47,7 @@ function notifier_run($argv, $argc){ $a->set_baseurl(get_config('system','url')); - logger('notifier: invoked: ' . print_r($argv,true)); + logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG); $cmd = $argv[1]; @@ -833,6 +833,8 @@ function notifier_run($argv, $argc){ } + logger('notifier: calling hooks', LOGGER_DEBUG); + if($normal_mode) call_hooks('notifier_normal',$target_item); diff --git a/include/poller.php b/include/poller.php index 0a0e66b86..f6553c846 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,6 +30,17 @@ function poller_run($argv, $argc){ load_config('config'); load_config('system'); + $maxsysload = intval(get_config('system','maxloadavg')); + if($maxsysload < 1) + $maxsysload = 50; + if(function_exists('sys_getloadavg')) { + $load = sys_getloadavg(); + if(intval($load[0]) > $maxsysload) { + logger('system: load ' . $load . ' too high. Poller deferred to next scheduled run.'); + return; + } + } + $lockpath = get_config('system','lockpath'); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'poller.lck'); @@ -39,6 +50,8 @@ function poller_run($argv, $argc){ } } + + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/socgraph.php b/include/socgraph.php index a67b3d9e3..b7c4ccc71 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -176,6 +176,7 @@ function count_common_friends($uid,$cid) { intval($cid) ); +// logger("count_common_friends: $uid $cid {$r[0]['total']}"); if(count($r)) return $r[0]['total']; return 0; |