]> git.mxchange.org Git - friendica.git/commitdiff
"proc_run" is now called with priority.
authorMichael Vogel <icarus@dabo.de>
Mon, 1 Aug 2016 05:48:43 +0000 (07:48 +0200)
committerMichael Vogel <icarus@dabo.de>
Mon, 1 Aug 2016 05:48:43 +0000 (07:48 +0200)
31 files changed:
boot.php
include/Contact.php
include/cron.php
include/follow.php
include/identity.php
include/items.php
include/like.php
include/message.php
include/notifier.php
include/poller.php
include/queue.php
include/socgraph.php
include/uimport.php
mod/admin.php
mod/contacts.php
mod/dfrn_confirm.php
mod/dirfind.php
mod/events.php
mod/fsuggest.php
mod/item.php
mod/mood.php
mod/photos.php
mod/poke.php
mod/profile_photo.php
mod/profiles.php
mod/register.php
mod/regmod.php
mod/settings.php
mod/tagger.php
mod/videos.php
update.php

index cad4094c7de259332ab5a43b01feeaa28bac0ceb..1e59ba3b54d8787f7c487f6188effe5506b22ffb 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -386,6 +386,17 @@ define ( 'GRAVITY_LIKE',         3);
 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
 if (!defined("SIGTERM"))
@@ -1241,13 +1252,34 @@ class App {
                                        logger("killed stale process");
                                        // Calling a new instance
                                        if ($task != "")
-                                               proc_run('php', $task);
+                                               proc_run(PRIORITY_MEDIUM, $task);
                                }
                                return true;
                        }
                }
                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;
        }
        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
  *     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
  * 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 ""
  * 
@@ -1753,7 +1786,7 @@ function proc_run($cmd){
        $args = func_get_args();
 
        $newargs = array();
-       if(! count($args))
+       if (!count($args))
                return;
 
        // expand any arrays
@@ -1763,8 +1796,7 @@ function proc_run($cmd){
                        foreach($arg as $n) {
                                $newargs[] = $n;
                        }
-               }
-               else
+               } else
                        $newargs[] = $arg;
        }
 
@@ -1773,81 +1805,55 @@ function proc_run($cmd){
        $arr = array('args' => $args, 'run_cmd' => true);
 
        call_hooks("proc_run", $arr);
-       if(! $arr['run_cmd'])
+       if (!$arr['run_cmd'] OR !count($args))
                return;
 
-       if(count($args) && $args[0] === 'php') {
-
-               if (get_config("system", "worker")) {
-                       $argv = $args;
-                       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');
+       if (!get_config("system", "worker") OR
+               (($args[0] != 'php') AND !is_int($args[0]))) {
+               $a->proc_run($args);
+               return;
        }
 
-       // add baseurl to args. cli scripts can't construct it
-       $args[] = $a->get_baseurl();
+       if (is_int($args[0]))
+               $priority = $args[0];
+       else
+               $priority = PRIORITY_MEDIUM;
 
-       for($x = 0; $x < count($args); $x ++)
-               $args[$x] = escapeshellarg($args[$x]);
+       $argv = $args;
+       array_shift($argv);
 
-       $cmdline = implode($args," ");
+       $parameters = json_encode($argv);
+       $found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'",
+               dbesc($parameters));
 
-       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__)));
+       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(){
index 10005d3e3caad6cd4c662601a8dc044f057980c3..e466d7f908490c396632ea9270a1a1d03f3db590 100644 (file)
@@ -45,10 +45,10 @@ function user_remove($uid) {
        // don't delete yet, will be done later when contacts have deleted my stuff
        // 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));
-       proc_run('php', "include/notifier.php", "removeme", $uid);
+       proc_run(PRIORITY_HIGH, "include/notifier.php", "removeme", $uid);
 
        // 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()) {
                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
                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
        if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) {
index c1e4338d6fe4edece32d3aa0cc5e91c095ea2221..c54fef8a9ce59563d4fb900d9aaacf0df5b17fa7 100644 (file)
@@ -70,15 +70,15 @@ function cron_run(&$argv, &$argc){
 
        // 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
 
-       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
 
-       proc_run('php',"include/discover_poco.php", "checkcontact");
+       proc_run(PRIORITY_LOW,"include/discover_poco.php", "checkcontact");
 
        // expire any expired accounts
 
@@ -126,11 +126,11 @@ function cron_run(&$argv, &$argc){
 
                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);
 
-               proc_run('php','include/expire.php');
+               proc_run(PRIORITY_LOW,'include/expire.php');
        }
 
        // Clear cache entries
@@ -272,7 +272,7 @@ function cron_run(&$argv, &$argc){
 
                        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)
                                @time_sleep_until(microtime(true) + (float) $interval);
index 2461bf0356b63ae9fd0ffd2d31f3dbbb89fa2fd3..08e74e02f3443d3b8a5849442ca4aee4710a20b6 100644 (file)
@@ -270,7 +270,7 @@ function new_contact($uid,$url,$interactive = false) {
 
        // 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
 
index 4dffe72559395f195dcc39757f12a5ac6eef534f..9b75ebccdbd4875e224da7137c9b7c89cf4379e3 100644 (file)
@@ -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);
                call_hooks('zrl_init',$arr);
        }
index 1d2a775c49d27c822ef474bec1fa0093ea808393..754d5b0882a121a84fec75d0a03642d922aaf8e0 100644 (file)
@@ -917,7 +917,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        check_item_notification($current_post, $uid);
 
        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;
 }
@@ -1156,7 +1156,7 @@ function tag_deliver($uid,$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);
        }
 
-       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
 
        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
 
-               proc_run('php',"include/notifier.php","drop","$drop_id");
+               proc_run(PRIORITY_HIGH,"include/notifier.php", "drop", $drop_id);
 
                if(! $interactive)
                        return $owner;
index 9ceff2303a9ef7bfe4709a810024b8611dccf005..118ec81ca1c35e47ca966c997c254a2a379234d1 100644 (file)
@@ -153,7 +153,7 @@ function do_like($item_id, $verb) {
                );
 
                $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;
        }
@@ -245,7 +245,7 @@ EOT;
 
        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;
 }
index 0f4b53c626964a8122b1494032a000326f94990b..51f3ad805a667fcbd45242625bb4f539d96d145c 100644 (file)
@@ -150,7 +150,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
        }
 
        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);
        } else {
                return -3;
index 446824a26ae065164374d23b599b8bba464a4dee..cfe4e184120cb7c5307e537782e0ba87db14a2e5 100644 (file)
@@ -16,7 +16,7 @@ require_once('include/salmon.php');
 /*
  * 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:
  *
@@ -355,7 +355,7 @@ function notifier_run(&$argv, &$argc){
                        // a delivery fork. private groups (forum_mode == 2) do not 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();
@@ -538,7 +538,7 @@ function notifier_run(&$argv, &$argc){
                        $this_batch[] = $contact['id'];
 
                        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();
                                if($interval)
                                        @time_sleep_until(microtime(true) + (float) $interval);
@@ -548,7 +548,7 @@ function notifier_run(&$argv, &$argc){
 
                // be sure to pick up any stragglers
                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
@@ -619,7 +619,7 @@ function notifier_run(&$argv, &$argc){
 
                                if((! $mail) && (! $fsuggest) && (! $followup)) {
                                        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)
                                                @time_sleep_until(microtime(true) + (float) $interval);
                                }
@@ -659,7 +659,7 @@ function notifier_run(&$argv, &$argc){
                }
 
                // Handling the pubsubhubbub requests
-               proc_run('php','include/pubsubpublish.php');
+               proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
        }
 
        logger('notifier: calling hooks', LOGGER_DEBUG);
index ec6653b4882b83f3abaf5664793b7918c927b15f..b54757b00bf1bb9f9b5aa7ffc9eb9fee3b4dd7e2 100644 (file)
@@ -275,6 +275,13 @@ function poller_too_much_workers() {
 
                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);
index 878c149731d7b1a8c443f052efda6bdbde4d216b..9779a0733d3f65bcb5916fe37beefccacaf86f6d 100644 (file)
@@ -48,7 +48,7 @@ function queue_run(&$argv, &$argc){
        logger('queue: start');
 
        // 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')));
 
@@ -60,7 +60,7 @@ function queue_run(&$argv, &$argc){
        if($r) {
                foreach($r as $rr) {
                        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)
                                @time_sleep_until(microtime(true) + (float) $interval);
                }
index cb2fd97b39b33140f4ef69675e34ad08a839b29a..89897aaa7ce5eceeeaa41a2b299b15cad5e5edfa 100644 (file)
@@ -1507,7 +1507,7 @@ function get_gcontact_id($contact) {
 
        if ($doprobing) {
                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"] != ""))
index bd271e91a85c65a4a120ba6a5ccf446610159e41..937a16710a9211214547600da5555b4d13134d69 100644 (file)
@@ -287,7 +287,7 @@ function import_account(&$a, $file) {
        }\r
 \r
        // send relocate messages\r
-       proc_run('php', 'include/notifier.php', 'relocate', $newuid);\r
+       proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $newuid);\r
 \r
        info(t("Done. You can now login with your username and password"));\r
        goaway($a->get_baseurl() . "/login");\r
index 547c37fb6c9191158f44cc5f82da9cde75107e28..d49673fc0fb9e9521dc31a080577d7798d8c80dd 100644 (file)
@@ -549,7 +549,7 @@ function admin_page_site_post(&$a) {
                $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
 
                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.");
index f9e9f6b73596df0e73f735294830b734b8d68652..ba8ad45c39926568deceb9fab40f1e945cefef86 100644 (file)
@@ -237,7 +237,7 @@ function _contact_update($contact_id) {
                                intval($contact_id));
        } else
                // 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) {
index 25694a67f32dc2b479fbf74095a396798f864c8c..51cd59c62fe100b203e6caf8683571725491318c 100644 (file)
@@ -487,7 +487,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
 
                                        $i = item_store($arr);
                                        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);
                                        if($i)
-                                       proc_run('php',"include/notifier.php","activity","$i");
+                                               proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
 
                                }
                        }
index 0638fe14fa07438e204eeb266f896809e7ed4444..52e16175543abb5e92b0afbb2cff6ffb5cf0d264 100644 (file)
@@ -156,7 +156,7 @@ function dirfind_content(&$a, $prefix = "") {
                        }
 
                        // 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 {
 
                        $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : '');
index 878bf841d2967c407988c2f8ab60046f5489f11f..636cf6c579ff437e1a8a6813177614cc367ee6aa 100644 (file)
@@ -177,7 +177,7 @@ function events_post(&$a) {
        $item_id = event_store($datarray);
 
        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']);
 }
index 6b1cbd7533be8ca44f6e9ce19c32609cdbf74490..ad407d5f32a0ca80552fbe36a02e638296282d25 100644 (file)
@@ -57,7 +57,7 @@ function fsuggest_post(&$a) {
                                        intval($fsuggest_id),
                                        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);
index 6f5f8fc1eab2e144f2c009489f834241b946655a..9a9b5895bdd719e0c8b04d8abec606c7bc5eafac 100644 (file)
@@ -783,7 +783,7 @@ function item_post(&$a) {
                // update filetags in pconfig
                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)) {
                        logger('return: ' . $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,
        // 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');
 
index 5e6ca0fcfc068533751908e8bc2e4d91ba7beed1..f804af0c00819ec0d9ed93714867e44b49396502 100644 (file)
@@ -95,13 +95,13 @@ function mood_init(&$a) {
                        intval($uid),
                        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);
 
-       proc_run('php',"include/notifier.php","like","$post_id");
+       proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
 
        return;
 }
index 4ac4e1a0eef6ca67fe439ddc9e4496a2197e30e1..ec71cc09d83845a38b53e7904e0602b6fc8665d3 100644 (file)
@@ -306,7 +306,7 @@ function photos_post(&$a) {
                                        // send the notification upstream/downstream as the case may be
 
                                        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']);
 
                                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);
                                        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);
 
        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));
 
index 4a643435be229acda46beee3fe352af8ed3e830a..435da4dcd4facd27229767709633724529c690be 100644 (file)
@@ -131,13 +131,13 @@ function poke_init(&$a) {
                //      intval($uid),
                //      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);
 
-       proc_run('php',"include/notifier.php","like","$post_id");
+       proc_run(PRIORITY_HIGH, "include/notifier.php", "like", $post_id);
 
        return;
 }
index 4e8d279a972b7ce7ec54b03ee12416a8ec627659..11e671afc58a2f58e5ef51655d55a473e78aa708 100644 (file)
@@ -125,7 +125,7 @@ function profile_photo_post(&$a) {
                                // Update global directory in background
                                $url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
                                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');
                                profile_change();
@@ -224,7 +224,7 @@ function profile_photo_content(&$a) {
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
                        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');
                        return; // NOTREACHED
index c3bd068b0b57478da70f774fd89d22ddcea5e135..d770e75c3af21f52549517f359f8aee257d08817 100644 (file)
@@ -496,7 +496,7 @@ function profiles_post(&$a) {
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
                        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');
                        profile_change();
@@ -587,9 +587,8 @@ function profile_activity($changed, $value) {
        $arr['deny_gid']  = $a->user['deny_gid'];
 
        $i = item_store($arr);
-       if($i) {
-               proc_run('php',"include/notifier.php","activity","$i");
-       }
+       if($i)
+               proc_run(PRIORITY_HIGH, "include/notifier.php", "activity", $i);
 }
 
 
index 4c4fcc2af12e7b980bcc3a7b4ec6c658ab87c7f1..6fc5887ef5c32734d27ad3900c3037cfd82016e2 100644 (file)
@@ -64,7 +64,7 @@ function register_post(&$a) {
 
        if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
                $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');
index 5a90db1f902d0b0265d26c1da3104bb1b5ce3e70..bbe733003a56dfe11ea9affceabd03f7be00fcb0 100644 (file)
@@ -37,7 +37,7 @@ function user_allow($hash) {
        if(count($r) && $r[0]['net-publish']) {
                $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
                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']);
index 89406b7072bfc179e6577c7da56c250493ab262e..e2d3f4d367bf94ebdea47c62c85d3df3fb5d8f22 100644 (file)
@@ -352,7 +352,7 @@ function settings_post(&$a) {
        check_form_security_token_redirectOnErr('/settings', 'settings');
 
        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"));
                goaway('settings');
        }
@@ -614,7 +614,7 @@ function settings_post(&$a) {
                // Update global directory in background
                $url = $_SESSION['my_url'];
                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');
index 26166a3cc0458efb7885f3c8175521aaceb6bc72..e0ef1ceb02091496c4cf6d963daf02d903d4d88d 100644 (file)
@@ -211,7 +211,7 @@ EOT;
 
        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();
 
index bf8d696b60f90cceef1b14d825ba70151cde932f..e5a0887bb9f3a2e6e22c1ade3fe262977d94886f 100644 (file)
@@ -167,7 +167,7 @@ function videos_post(&$a) {
                                $drop_id = intval($i[0]['id']);
 
                                if($i[0]['visible'])
-                                       proc_run('php',"include/notifier.php","drop","$drop_id");
+                                       proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
                        }
                }
 
index 41f238e91300a0cd2bcae16ec3922c273d955181..a150fe39fa2108d75c78cf2d10630b2aa61e5433 100644 (file)
@@ -1595,7 +1595,7 @@ function update_1169() {
        if (!$r)
                return UPDATE_FAILED;
 
-       proc_run('php',"include/threadupdate.php");
+       proc_run(PRIORITY_LOW, "include/threadupdate.php");
 
        return UPDATE_SUCCESS;
 }
@@ -1636,7 +1636,7 @@ function update_1178() {
                set_config('system','community_page_style', CP_NO_COMMUNITY_PAGE);
 
        // Update the central item storage with uid=0
-       proc_run('php',"include/threadupdate.php");
+       proc_run(PRIORITY_LOW, "include/threadupdate.php");
 
        return UPDATE_SUCCESS;
 }
@@ -1644,7 +1644,7 @@ function update_1178() {
 function update_1180() {
 
        // Fill the new fields in the term table.
-       proc_run('php',"include/tagupdate.php");
+       proc_run(PRIORITY_LOW, "include/tagupdate.php");
 
        return UPDATE_SUCCESS;
 }