"proc_run" is now called with priority.
This commit is contained in:
parent
89227813fc
commit
668da905e2
31 changed files with 149 additions and 137 deletions
158
boot.php
158
boot.php
|
@ -386,6 +386,17 @@ define ( 'GRAVITY_LIKE', 3);
|
||||||
define ( 'GRAVITY_COMMENT', 6);
|
define ( 'GRAVITY_COMMENT', 6);
|
||||||
/* @}*/
|
/* @}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Priority
|
||||||
|
*
|
||||||
|
* Process priority for the worker
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
define('PRIORITY_HIGH', 1);
|
||||||
|
define('PRIORITY_MEDIUM', 2);
|
||||||
|
define('PRIORITY_LOW', 3);
|
||||||
|
/* @}*/
|
||||||
|
|
||||||
|
|
||||||
// Normally this constant is defined - but not if "pcntl" isn't installed
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||||
if (!defined("SIGTERM"))
|
if (!defined("SIGTERM"))
|
||||||
|
@ -1241,13 +1252,34 @@ class App {
|
||||||
logger("killed stale process");
|
logger("killed stale process");
|
||||||
// Calling a new instance
|
// Calling a new instance
|
||||||
if ($task != "")
|
if ($task != "")
|
||||||
proc_run('php', $task);
|
proc_run(PRIORITY_MEDIUM, $task);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function proc_run($args) {
|
||||||
|
|
||||||
|
// Add the php path if it is a php call
|
||||||
|
if (count($args) && $args[0] === 'php')
|
||||||
|
$args[0] = ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php');
|
||||||
|
|
||||||
|
// add baseurl to args. cli scripts can't construct it
|
||||||
|
$args[] = $this->get_baseurl();
|
||||||
|
|
||||||
|
for($x = 0; $x < count($args); $x ++)
|
||||||
|
$args[$x] = escapeshellarg($args[$x]);
|
||||||
|
|
||||||
|
$cmdline = implode($args," ");
|
||||||
|
|
||||||
|
if(get_config('system','proc_windows'))
|
||||||
|
proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__)));
|
||||||
|
else
|
||||||
|
proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__)));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1363,7 +1395,7 @@ function check_db() {
|
||||||
$build = DB_UPDATE_VERSION;
|
$build = DB_UPDATE_VERSION;
|
||||||
}
|
}
|
||||||
if($build != DB_UPDATE_VERSION)
|
if($build != DB_UPDATE_VERSION)
|
||||||
proc_run('php', 'include/dbupdate.php');
|
proc_run(PRIORITY_HIGH, 'include/dbupdate.php');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,10 +1768,11 @@ function get_max_import_size() {
|
||||||
* @brief Wrap calls to proc_close(proc_open()) and call hook
|
* @brief Wrap calls to proc_close(proc_open()) and call hook
|
||||||
* so plugins can take part in process :)
|
* so plugins can take part in process :)
|
||||||
*
|
*
|
||||||
* @param string $cmd program to run
|
* @param (string|integer) $cmd program to run or priority
|
||||||
*
|
*
|
||||||
* next args are passed as $cmd command line
|
* next args are passed as $cmd command line
|
||||||
* e.g.: proc_run("ls","-la","/tmp");
|
* e.g.: proc_run("ls","-la","/tmp");
|
||||||
|
* or: proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
*
|
*
|
||||||
* @note $cmd and string args are surrounded with ""
|
* @note $cmd and string args are surrounded with ""
|
||||||
*
|
*
|
||||||
|
@ -1753,7 +1786,7 @@ function proc_run($cmd){
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
||||||
$newargs = array();
|
$newargs = array();
|
||||||
if(! count($args))
|
if (!count($args))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// expand any arrays
|
// expand any arrays
|
||||||
|
@ -1763,8 +1796,7 @@ function proc_run($cmd){
|
||||||
foreach($arg as $n) {
|
foreach($arg as $n) {
|
||||||
$newargs[] = $n;
|
$newargs[] = $n;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$newargs[] = $arg;
|
$newargs[] = $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1773,81 +1805,55 @@ function proc_run($cmd){
|
||||||
$arr = array('args' => $args, 'run_cmd' => true);
|
$arr = array('args' => $args, 'run_cmd' => true);
|
||||||
|
|
||||||
call_hooks("proc_run", $arr);
|
call_hooks("proc_run", $arr);
|
||||||
if(! $arr['run_cmd'])
|
if (!$arr['run_cmd'] OR !count($args))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(count($args) && $args[0] === 'php') {
|
if (!get_config("system", "worker") OR
|
||||||
|
(($args[0] != 'php') AND !is_int($args[0]))) {
|
||||||
if (get_config("system", "worker")) {
|
$a->proc_run($args);
|
||||||
$argv = $args;
|
return;
|
||||||
array_shift($argv);
|
|
||||||
|
|
||||||
$parameters = json_encode($argv);
|
|
||||||
$found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
|
|
||||||
dbesc($parameters));
|
|
||||||
|
|
||||||
$funcname = str_replace(".php", "", basename($argv[0]))."_run";
|
|
||||||
|
|
||||||
// Define the processes that have priority over any other process
|
|
||||||
/// @todo Better check for priority processes
|
|
||||||
$high_priority = array("delivery_run", "notifier_run", "pubsubpublish_run");
|
|
||||||
$low_priority = array("queue_run", "gprobe_run", "discover_poco_run");
|
|
||||||
|
|
||||||
if (in_array($funcname, $high_priority))
|
|
||||||
$priority = 1;
|
|
||||||
elseif (in_array($funcname, $low_priority))
|
|
||||||
$priority = 3;
|
|
||||||
else
|
|
||||||
$priority = 2;
|
|
||||||
|
|
||||||
if (!$found)
|
|
||||||
// quickfix for the delivery problems, 2106-07-28
|
|
||||||
/// @todo find better solution
|
|
||||||
//q("INSERT INTO `workerqueue` (`function`, `parameter`, `created`, `priority`)
|
|
||||||
// VALUES ('%s', '%s', '%s', %d)",
|
|
||||||
// dbesc($funcname),
|
|
||||||
q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`)
|
|
||||||
VALUES ('%s', '%s', %d)",
|
|
||||||
dbesc($parameters),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
intval($priority));
|
|
||||||
|
|
||||||
// Should we quit and wait for the poller to be called as a cronjob?
|
|
||||||
if (get_config("system", "worker_dont_fork"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Checking number of workers
|
|
||||||
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
|
|
||||||
|
|
||||||
// Get number of allowed number of worker threads
|
|
||||||
$queues = intval(get_config("system", "worker_queues"));
|
|
||||||
|
|
||||||
if ($queues == 0)
|
|
||||||
$queues = 4;
|
|
||||||
|
|
||||||
// If there are already enough workers running, don't fork another one
|
|
||||||
if ($workers[0]["workers"] >= $queues)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Now call the poller to execute the jobs that we just added to the queue
|
|
||||||
$args = array("php", "include/poller.php", "no_cron");
|
|
||||||
}
|
|
||||||
|
|
||||||
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add baseurl to args. cli scripts can't construct it
|
if (is_int($args[0]))
|
||||||
$args[] = $a->get_baseurl();
|
$priority = $args[0];
|
||||||
|
|
||||||
for($x = 0; $x < count($args); $x ++)
|
|
||||||
$args[$x] = escapeshellarg($args[$x]);
|
|
||||||
|
|
||||||
$cmdline = implode($args," ");
|
|
||||||
|
|
||||||
if(get_config('system','proc_windows'))
|
|
||||||
proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__)));
|
|
||||||
else
|
else
|
||||||
proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__)));
|
$priority = PRIORITY_MEDIUM;
|
||||||
|
|
||||||
|
$argv = $args;
|
||||||
|
array_shift($argv);
|
||||||
|
|
||||||
|
$parameters = json_encode($argv);
|
||||||
|
$found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
|
||||||
|
dbesc($parameters));
|
||||||
|
|
||||||
|
if (!$found)
|
||||||
|
q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`)
|
||||||
|
VALUES ('%s', '%s', %d)",
|
||||||
|
dbesc($parameters),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
intval($priority));
|
||||||
|
|
||||||
|
// Should we quit and wait for the poller to be called as a cronjob?
|
||||||
|
if (get_config("system", "worker_dont_fork"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Checking number of workers
|
||||||
|
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
|
||||||
|
|
||||||
|
// Get number of allowed number of worker threads
|
||||||
|
$queues = intval(get_config("system", "worker_queues"));
|
||||||
|
|
||||||
|
if ($queues == 0)
|
||||||
|
$queues = 4;
|
||||||
|
|
||||||
|
// If there are already enough workers running, don't fork another one
|
||||||
|
if ($workers[0]["workers"] >= $queues)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Now call the poller to execute the jobs that we just added to the queue
|
||||||
|
$args = array("php", "include/poller.php", "no_cron");
|
||||||
|
|
||||||
|
$a->proc_run($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function current_theme(){
|
function current_theme(){
|
||||||
|
|
|
@ -45,10 +45,10 @@ function user_remove($uid) {
|
||||||
// don't delete yet, will be done later when contacts have deleted my stuff
|
// don't delete yet, will be done later when contacts have deleted my stuff
|
||||||
// q("DELETE FROM `user` WHERE `uid` = %d", intval($uid));
|
// q("DELETE FROM `user` WHERE `uid` = %d", intval($uid));
|
||||||
q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid));
|
q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid));
|
||||||
proc_run('php', "include/notifier.php", "removeme", $uid);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "removeme", $uid);
|
||||||
|
|
||||||
// Send an update to the directory
|
// Send an update to the directory
|
||||||
proc_run('php', "include/directory.php", $r[0]['url']);
|
proc_run(PRIORITY_LOW, "include/directory.php", $r[0]['url']);
|
||||||
|
|
||||||
if($uid == local_user()) {
|
if($uid == local_user()) {
|
||||||
unset($_SESSION['authenticated']);
|
unset($_SESSION['authenticated']);
|
||||||
|
@ -275,7 +275,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
||||||
|
|
||||||
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND
|
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND
|
||||||
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
||||||
proc_run('php',"include/update_gcontact.php", $profile["gid"]);
|
proc_run(PRIORITY_LOW, "include/update_gcontact.php", $profile["gid"]);
|
||||||
|
|
||||||
// Show contact details of Diaspora contacts only if connected
|
// Show contact details of Diaspora contacts only if connected
|
||||||
if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) {
|
if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) {
|
||||||
|
|
|
@ -70,15 +70,15 @@ function cron_run(&$argv, &$argc){
|
||||||
|
|
||||||
// run queue delivery process in the background
|
// run queue delivery process in the background
|
||||||
|
|
||||||
proc_run('php',"include/queue.php");
|
proc_run(PRIORITY_LOW,"include/queue.php");
|
||||||
|
|
||||||
// run the process to discover global contacts in the background
|
// run the process to discover global contacts in the background
|
||||||
|
|
||||||
proc_run('php',"include/discover_poco.php");
|
proc_run(PRIORITY_LOW,"include/discover_poco.php");
|
||||||
|
|
||||||
// run the process to update locally stored global contacts in the background
|
// run the process to update locally stored global contacts in the background
|
||||||
|
|
||||||
proc_run('php',"include/discover_poco.php", "checkcontact");
|
proc_run(PRIORITY_LOW,"include/discover_poco.php", "checkcontact");
|
||||||
|
|
||||||
// expire any expired accounts
|
// expire any expired accounts
|
||||||
|
|
||||||
|
@ -126,11 +126,11 @@ function cron_run(&$argv, &$argc){
|
||||||
|
|
||||||
update_contact_birthdays();
|
update_contact_birthdays();
|
||||||
|
|
||||||
proc_run('php',"include/discover_poco.php", "suggestions");
|
proc_run(PRIORITY_LOW,"include/discover_poco.php", "suggestions");
|
||||||
|
|
||||||
set_config('system','last_expire_day',$d2);
|
set_config('system','last_expire_day',$d2);
|
||||||
|
|
||||||
proc_run('php','include/expire.php');
|
proc_run(PRIORITY_LOW,'include/expire.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear cache entries
|
// Clear cache entries
|
||||||
|
@ -272,7 +272,7 @@ function cron_run(&$argv, &$argc){
|
||||||
|
|
||||||
logger("Polling ".$contact["network"]." ".$contact["id"]." ".$contact["nick"]." ".$contact["name"]);
|
logger("Polling ".$contact["network"]." ".$contact["id"]." ".$contact["nick"]." ".$contact["name"]);
|
||||||
|
|
||||||
proc_run('php','include/onepoll.php',$contact['id']);
|
proc_run(PRIORITY_MEDIUM,'include/onepoll.php',$contact['id']);
|
||||||
|
|
||||||
if($interval)
|
if($interval)
|
||||||
@time_sleep_until(microtime(true) + (float) $interval);
|
@time_sleep_until(microtime(true) + (float) $interval);
|
||||||
|
|
|
@ -270,7 +270,7 @@ function new_contact($uid,$url,$interactive = false) {
|
||||||
|
|
||||||
// pull feed and consume it, which should subscribe to the hub.
|
// pull feed and consume it, which should subscribe to the hub.
|
||||||
|
|
||||||
proc_run('php',"include/onepoll.php","$contact_id", "force");
|
proc_run(PRIORITY_MEDIUM, "include/onepoll.php", $contact_id, "force");
|
||||||
|
|
||||||
// create a follow slap
|
// create a follow slap
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,7 @@ function zrl_init(&$a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_run('php','include/gprobe.php',bin2hex($tmp_str));
|
proc_run(PRIORITY_LOW, 'include/gprobe.php',bin2hex($tmp_str));
|
||||||
$arr = array('zrl' => $tmp_str, 'url' => $a->cmd);
|
$arr = array('zrl' => $tmp_str, 'url' => $a->cmd);
|
||||||
call_hooks('zrl_init',$arr);
|
call_hooks('zrl_init',$arr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -917,7 +917,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
||||||
check_item_notification($current_post, $uid);
|
check_item_notification($current_post, $uid);
|
||||||
|
|
||||||
if ($notify)
|
if ($notify)
|
||||||
proc_run('php', "include/notifier.php", $notify_type, $current_post);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $current_post);
|
||||||
|
|
||||||
return $current_post;
|
return $current_post;
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1156,7 @@ function tag_deliver($uid,$item_id) {
|
||||||
);
|
);
|
||||||
update_thread($item_id);
|
update_thread($item_id);
|
||||||
|
|
||||||
proc_run('php','include/notifier.php','tgroup',$item_id);
|
proc_run(PRIORITY_HIGH,'include/notifier.php', 'tgroup', $item_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1763,7 +1763,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
|
||||||
drop_item($item['id'],false);
|
drop_item($item['id'],false);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","expire","$uid");
|
proc_run(PRIORITY_HIGH,"include/notifier.php", "expire", $uid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1785,7 +1785,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('php',"include/notifier.php","expire","$uid");
|
proc_run(PRIORITY_HIGH,"include/notifier.php", "expire", $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1998,7 +1998,7 @@ function drop_item($id,$interactive = true) {
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
// send the notification upstream/downstream as the case may be
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
proc_run(PRIORITY_HIGH,"include/notifier.php", "drop", $drop_id);
|
||||||
|
|
||||||
if(! $interactive)
|
if(! $interactive)
|
||||||
return $owner;
|
return $owner;
|
||||||
|
|
|
@ -153,7 +153,7 @@ function do_like($item_id, $verb) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$like_item_id = $like_item['id'];
|
$like_item_id = $like_item['id'];
|
||||||
proc_run('php',"include/notifier.php","like","$like_item_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $like_item_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ EOT;
|
||||||
|
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","like","$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
|
||||||
}
|
}
|
||||||
|
|
||||||
if($post_id) {
|
if($post_id) {
|
||||||
proc_run('php',"include/notifier.php","mail","$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "mail", $post_id);
|
||||||
return intval($post_id);
|
return intval($post_id);
|
||||||
} else {
|
} else {
|
||||||
return -3;
|
return -3;
|
||||||
|
|
|
@ -16,7 +16,7 @@ require_once('include/salmon.php');
|
||||||
/*
|
/*
|
||||||
* The notifier is typically called with:
|
* The notifier is typically called with:
|
||||||
*
|
*
|
||||||
* proc_run('php', "include/notifier.php", COMMAND, ITEM_ID);
|
* proc_run(PRIORITY_HIGH, "include/notifier.php", COMMAND, ITEM_ID);
|
||||||
*
|
*
|
||||||
* where COMMAND is one of the following:
|
* where COMMAND is one of the following:
|
||||||
*
|
*
|
||||||
|
@ -355,7 +355,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('php','include/notifier.php','uplink',$item_id);
|
proc_run(PRIORITY_HIGH,'include/notifier.php','uplink',$item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$conversants = array();
|
$conversants = array();
|
||||||
|
@ -538,7 +538,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
$this_batch[] = $contact['id'];
|
$this_batch[] = $contact['id'];
|
||||||
|
|
||||||
if(count($this_batch) >= $deliveries_per_process) {
|
if(count($this_batch) >= $deliveries_per_process) {
|
||||||
proc_run('php','include/delivery.php',$cmd,$item_id,$this_batch);
|
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$this_batch);
|
||||||
$this_batch = array();
|
$this_batch = array();
|
||||||
if($interval)
|
if($interval)
|
||||||
@time_sleep_until(microtime(true) + (float) $interval);
|
@time_sleep_until(microtime(true) + (float) $interval);
|
||||||
|
@ -548,7 +548,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
|
|
||||||
// be sure to pick up any stragglers
|
// be sure to pick up any stragglers
|
||||||
if(count($this_batch))
|
if(count($this_batch))
|
||||||
proc_run('php','include/delivery.php',$cmd,$item_id,$this_batch);
|
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$this_batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
||||||
|
@ -619,7 +619,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('php','include/delivery.php',$cmd,$item_id,$rr['id']);
|
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$rr['id']);
|
||||||
if($interval)
|
if($interval)
|
||||||
@time_sleep_until(microtime(true) + (float) $interval);
|
@time_sleep_until(microtime(true) + (float) $interval);
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling the pubsubhubbub requests
|
// Handling the pubsubhubbub requests
|
||||||
proc_run('php','include/pubsubpublish.php');
|
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('notifier: calling hooks', LOGGER_DEBUG);
|
logger('notifier: calling hooks', LOGGER_DEBUG);
|
||||||
|
|
|
@ -275,6 +275,13 @@ function poller_too_much_workers() {
|
||||||
|
|
||||||
logger("Current load: ".$load." - maximum: ".$maxsysload." - current queues: ".$active."/".$entries." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
|
logger("Current load: ".$load." - maximum: ".$maxsysload." - current queues: ".$active."/".$entries." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
// Are there fewer workers running as possible? Then fork a new one.
|
||||||
|
if (!get_config("system", "worker_dont_fork") AND ($queues > ($active + 1)) AND ($entries > 1)) {
|
||||||
|
logger("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
|
||||||
|
$args = array("php", "include/poller.php", "no_cron");
|
||||||
|
$a = get_app();
|
||||||
|
$a->proc_run($args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return($active >= $queues);
|
return($active >= $queues);
|
||||||
|
|
|
@ -48,7 +48,7 @@ function queue_run(&$argv, &$argc){
|
||||||
logger('queue: start');
|
logger('queue: start');
|
||||||
|
|
||||||
// Handling the pubsubhubbub requests
|
// Handling the pubsubhubbub requests
|
||||||
proc_run('php','include/pubsubpublish.php');
|
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
|
||||||
|
|
||||||
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
|
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ function queue_run(&$argv, &$argc){
|
||||||
if($r) {
|
if($r) {
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
logger('queue: deliverq');
|
logger('queue: deliverq');
|
||||||
proc_run('php','include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']);
|
proc_run(PRIORITY_HIGH,'include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']);
|
||||||
if($interval)
|
if($interval)
|
||||||
@time_sleep_until(microtime(true) + (float) $interval);
|
@time_sleep_until(microtime(true) + (float) $interval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1507,7 +1507,7 @@ function get_gcontact_id($contact) {
|
||||||
|
|
||||||
if ($doprobing) {
|
if ($doprobing) {
|
||||||
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
||||||
proc_run('php', 'include/gprobe.php', bin2hex($contact["url"]));
|
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
|
if ((count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
|
||||||
|
|
|
@ -287,7 +287,7 @@ function import_account(&$a, $file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send relocate messages
|
// send relocate messages
|
||||||
proc_run('php', 'include/notifier.php', 'relocate', $newuid);
|
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $newuid);
|
||||||
|
|
||||||
info(t("Done. You can now login with your username and password"));
|
info(t("Done. You can now login with your username and password"));
|
||||||
goaway($a->get_baseurl() . "/login");
|
goaway($a->get_baseurl() . "/login");
|
||||||
|
|
|
@ -549,7 +549,7 @@ function admin_page_site_post(&$a) {
|
||||||
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
proc_run('php', 'include/notifier.php', 'relocate', $user['uid']);
|
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
info("Relocation started. Could take a while to complete.");
|
info("Relocation started. Could take a while to complete.");
|
||||||
|
|
|
@ -237,7 +237,7 @@ function _contact_update($contact_id) {
|
||||||
intval($contact_id));
|
intval($contact_id));
|
||||||
} else
|
} else
|
||||||
// pull feed and consume it, which should subscribe to the hub.
|
// pull feed and consume it, which should subscribe to the hub.
|
||||||
proc_run('php',"include/onepoll.php","$contact_id", "force");
|
proc_run(PRIORITY_MEDIUM, "include/onepoll.php", $contact_id, "force");
|
||||||
}
|
}
|
||||||
|
|
||||||
function _contact_update_profile($contact_id) {
|
function _contact_update_profile($contact_id) {
|
||||||
|
|
|
@ -487,7 +487,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
|
|
||||||
$i = item_store($arr);
|
$i = item_store($arr);
|
||||||
if($i)
|
if($i)
|
||||||
proc_run('php',"include/notifier.php","activity","$i");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
|
|
||||||
$i = item_store($arr);
|
$i = item_store($arr);
|
||||||
if($i)
|
if($i)
|
||||||
proc_run('php',"include/notifier.php","activity","$i");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ function dirfind_content(&$a, $prefix = "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add found profiles from the global directory to the local directory
|
// Add found profiles from the global directory to the local directory
|
||||||
proc_run('php','include/discover_poco.php', "dirsearch", urlencode($search));
|
proc_run(PRIORITY_LOW, 'include/discover_poco.php', "dirsearch", urlencode($search));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
|
$p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
|
||||||
|
|
|
@ -177,7 +177,7 @@ function events_post(&$a) {
|
||||||
$item_id = event_store($datarray);
|
$item_id = event_store($datarray);
|
||||||
|
|
||||||
if(! $cid)
|
if(! $cid)
|
||||||
proc_run('php',"include/notifier.php","event","$item_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "event", $item_id);
|
||||||
|
|
||||||
goaway($_SESSION['return_url']);
|
goaway($_SESSION['return_url']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ function fsuggest_post(&$a) {
|
||||||
intval($fsuggest_id),
|
intval($fsuggest_id),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
proc_run('php', 'include/notifier.php', 'suggest' , $fsuggest_id);
|
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'suggest', $fsuggest_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
info( t('Friend suggestion sent.') . EOL);
|
info( t('Friend suggestion sent.') . EOL);
|
||||||
|
|
|
@ -783,7 +783,7 @@ function item_post(&$a) {
|
||||||
// update filetags in pconfig
|
// update filetags in pconfig
|
||||||
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
|
file_tag_update_pconfig($uid,$categories_old,$categories_new,'category');
|
||||||
|
|
||||||
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", 'edit_post', $post_id);
|
||||||
if((x($_REQUEST,'return')) && strlen($return_path)) {
|
if((x($_REQUEST,'return')) && strlen($return_path)) {
|
||||||
logger('return: ' . $return_path);
|
logger('return: ' . $return_path);
|
||||||
goaway($a->get_baseurl() . "/" . $return_path );
|
goaway($a->get_baseurl() . "/" . $return_path );
|
||||||
|
@ -1032,7 +1032,7 @@ function item_post(&$a) {
|
||||||
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
|
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
|
||||||
// or cut back on plugins which do remote deliveries.
|
// or cut back on plugins which do remote deliveries.
|
||||||
|
|
||||||
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $post_id);
|
||||||
|
|
||||||
logger('post_complete');
|
logger('post_complete');
|
||||||
|
|
||||||
|
|
|
@ -95,13 +95,13 @@ function mood_init(&$a) {
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","like","$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,7 +306,7 @@ function photos_post(&$a) {
|
||||||
// send the notification upstream/downstream as the case may be
|
// send the notification upstream/downstream as the case may be
|
||||||
|
|
||||||
if($rr['visible'])
|
if($rr['visible'])
|
||||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ function photos_post(&$a) {
|
||||||
$drop_id = intval($i[0]['id']);
|
$drop_id = intval($i[0]['id']);
|
||||||
|
|
||||||
if($i[0]['visible'])
|
if($i[0]['visible'])
|
||||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ function photos_post(&$a) {
|
||||||
|
|
||||||
$item_id = item_store($arr);
|
$item_id = item_store($arr);
|
||||||
if($item_id) {
|
if($item_id) {
|
||||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ function photos_post(&$a) {
|
||||||
$item_id = item_store($arr);
|
$item_id = item_store($arr);
|
||||||
|
|
||||||
if($visible)
|
if($visible)
|
||||||
proc_run('php', "include/notifier.php", 'wall-new', $item_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
|
||||||
|
|
||||||
call_hooks('photo_post_end',intval($item_id));
|
call_hooks('photo_post_end',intval($item_id));
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,13 @@ function poke_init(&$a) {
|
||||||
// intval($uid),
|
// intval($uid),
|
||||||
// intval($item_id)
|
// intval($item_id)
|
||||||
//);
|
//);
|
||||||
proc_run('php',"include/notifier.php","tag","$item_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","like","$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ function profile_photo_post(&$a) {
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
$url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
|
|
||||||
require_once('include/profile_update.php');
|
require_once('include/profile_update.php');
|
||||||
profile_change();
|
profile_change();
|
||||||
|
@ -224,7 +224,7 @@ function profile_photo_content(&$a) {
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $_SESSION['my_url'];
|
$url = $_SESSION['my_url'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
|
|
||||||
goaway($a->get_baseurl() . '/profiles');
|
goaway($a->get_baseurl() . '/profiles');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
|
|
@ -496,7 +496,7 @@ function profiles_post(&$a) {
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $_SESSION['my_url'];
|
$url = $_SESSION['my_url'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
|
|
||||||
require_once('include/profile_update.php');
|
require_once('include/profile_update.php');
|
||||||
profile_change();
|
profile_change();
|
||||||
|
@ -587,9 +587,8 @@ function profile_activity($changed, $value) {
|
||||||
$arr['deny_gid'] = $a->user['deny_gid'];
|
$arr['deny_gid'] = $a->user['deny_gid'];
|
||||||
|
|
||||||
$i = item_store($arr);
|
$i = item_store($arr);
|
||||||
if($i) {
|
if($i)
|
||||||
proc_run('php',"include/notifier.php","activity","$i");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ function register_post(&$a) {
|
||||||
|
|
||||||
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
|
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
|
||||||
$url = $a->get_baseurl() . '/profile/' . $user['nickname'];
|
$url = $a->get_baseurl() . '/profile/' . $user['nickname'];
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$using_invites = get_config('system','invitation_only');
|
$using_invites = get_config('system','invitation_only');
|
||||||
|
|
|
@ -37,7 +37,7 @@ function user_allow($hash) {
|
||||||
if(count($r) && $r[0]['net-publish']) {
|
if(count($r) && $r[0]['net-publish']) {
|
||||||
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
|
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
push_lang($register[0]['language']);
|
push_lang($register[0]['language']);
|
||||||
|
|
|
@ -352,7 +352,7 @@ function settings_post(&$a) {
|
||||||
check_form_security_token_redirectOnErr('/settings', 'settings');
|
check_form_security_token_redirectOnErr('/settings', 'settings');
|
||||||
|
|
||||||
if (x($_POST,'resend_relocate')) {
|
if (x($_POST,'resend_relocate')) {
|
||||||
proc_run('php', 'include/notifier.php', 'relocate', local_user());
|
proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', local_user());
|
||||||
info(t("Relocate message has been send to your contacts"));
|
info(t("Relocate message has been send to your contacts"));
|
||||||
goaway('settings');
|
goaway('settings');
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ function settings_post(&$a) {
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $_SESSION['my_url'];
|
$url = $_SESSION['my_url'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
proc_run('php',"include/directory.php","$url");
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('include/profile_update.php');
|
require_once('include/profile_update.php');
|
||||||
|
|
|
@ -211,7 +211,7 @@ EOT;
|
||||||
|
|
||||||
call_hooks('post_local_end', $arr);
|
call_hooks('post_local_end', $arr);
|
||||||
|
|
||||||
proc_run('php',"include/notifier.php","tag","$post_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $post_id);
|
||||||
|
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ function videos_post(&$a) {
|
||||||
$drop_id = intval($i[0]['id']);
|
$drop_id = intval($i[0]['id']);
|
||||||
|
|
||||||
if($i[0]['visible'])
|
if($i[0]['visible'])
|
||||||
proc_run('php',"include/notifier.php","drop","$drop_id");
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1595,7 +1595,7 @@ function update_1169() {
|
||||||
if (!$r)
|
if (!$r)
|
||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
proc_run('php',"include/threadupdate.php");
|
proc_run(PRIORITY_LOW, "include/threadupdate.php");
|
||||||
|
|
||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1636,7 +1636,7 @@ function update_1178() {
|
||||||
set_config('system','community_page_style', CP_NO_COMMUNITY_PAGE);
|
set_config('system','community_page_style', CP_NO_COMMUNITY_PAGE);
|
||||||
|
|
||||||
// Update the central item storage with uid=0
|
// Update the central item storage with uid=0
|
||||||
proc_run('php',"include/threadupdate.php");
|
proc_run(PRIORITY_LOW, "include/threadupdate.php");
|
||||||
|
|
||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1644,7 +1644,7 @@ function update_1178() {
|
||||||
function update_1180() {
|
function update_1180() {
|
||||||
|
|
||||||
// Fill the new fields in the term table.
|
// Fill the new fields in the term table.
|
||||||
proc_run('php',"include/tagupdate.php");
|
proc_run(PRIORITY_LOW, "include/tagupdate.php");
|
||||||
|
|
||||||
return UPDATE_SUCCESS;
|
return UPDATE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue