move php path setting inside proc_run

This commit is contained in:
Friendika 2011-02-23 15:16:12 -08:00
parent fdc469ae4c
commit 755c2245e8
16 changed files with 25 additions and 67 deletions

View file

@ -27,8 +27,7 @@ function poormancron_hook($a,&$b) {
// 300 secs, 5 mins // 300 secs, 5 mins
if (!$lastupdate || ($now-$lastupdate)>300) { if (!$lastupdate || ($now-$lastupdate)>300) {
set_config('poormancron','lastupdate', $now); set_config('poormancron','lastupdate', $now);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/poller.php");
proc_run($php_path,"include/poller.php");
} }
} }

View file

@ -2435,6 +2435,9 @@ function proc_run($cmd){
$args = func_get_args(); $args = func_get_args();
call_hooks("proc_run", $args); call_hooks("proc_run", $args);
if(count($args) && $args[0] === 'php')
$args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
foreach ($args as $arg){ foreach ($args as $arg){
$arg = escapeshellarg($arg); $arg = escapeshellarg($arg);
} }

View file

@ -27,8 +27,7 @@ function poller_run($argv, $argc){
// run queue delivery process in the background // run queue delivery process in the background
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/queue.php");
proc_run($php_path,"include/queue.php");
// clear old cache // clear old cache
q("DELETE FROM `cache` WHERE `updated`<'%s'", q("DELETE FROM `cache` WHERE `updated`<'%s'",

View file

@ -124,9 +124,7 @@ function contacts_content(&$a) {
if($cmd === 'update') { if($cmd === 'update') {
// 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/poller.php","$contact_id");
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
proc_run($php_path,"include/poller.php","$contact_id");
goaway($a->get_baseurl() . '/contacts/' . $contact_id); goaway($a->get_baseurl() . '/contacts/' . $contact_id);
// NOTREACHED // NOTREACHED
} }

View file

@ -435,11 +435,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$arr['last-child'] = 1; $arr['last-child'] = 1;
$i = item_store($arr); $i = item_store($arr);
if($i)
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/notifier.php","activity","$i");
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", array(),$foo));
proc_run($php_path,"include/notifier.php","activity","$i");
} }

View file

@ -369,9 +369,7 @@ function dfrn_notify_post(&$a) {
if($posted_id && $parent) { if($posted_id && $parent) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/notifier.php","comment-import","$posted_id");
proc_run($php_path,"include/notifier.php","comment-import","$posted_id");
if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) { if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
require_once('bbcode.php'); require_once('bbcode.php');

View file

@ -253,9 +253,7 @@ function follow_post(&$a) {
// pull feed and consume it, which should subscribe to the hub. // pull feed and consume it, which should subscribe to the hub.
$php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/poller.php","$contact_id");
//proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
proc_run($php_path,"include/poller.php","$contact_id");
// create a follow slap // create a follow slap

View file

@ -460,11 +460,7 @@ function item_post(&$a) {
// NOTREACHED // NOTREACHED
} }
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php', "include/notifier.php", $notify_type, "$post_id");
logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
proc_run($php_path, "include/notifier.php", $notify_type, "$post_id");
$datarray['id'] = $post_id; $datarray['id'] = $post_id;
@ -595,12 +591,10 @@ function item_content(&$a) {
} }
} }
$drop_id = intval($item['id']); $drop_id = intval($item['id']);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
// send the notification upstream/downstream as the case may be // send the notification upstream/downstream as the case may be
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo)); proc_run('php',"include/notifier.php","drop","$drop_id");
proc_run($php_path,"include/notifier.php","drop","$drop_id");
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
//NOTREACHED //NOTREACHED

View file

@ -101,9 +101,7 @@ function like_content(&$a) {
intval($r[0]['id']) intval($r[0]['id'])
); );
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); proc_run('php',"include/notifier.php","like","$post_id");
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
proc_run($php_path,"include/notifier.php","like","$post_id");
return; return;
} }
@ -173,11 +171,7 @@ EOT;
); );
} }
proc_run('php',"include/notifier.php","like","$post_id");
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
proc_run($php_path,"include/notifier.php","like","$post_id");
return; // NOTREACHED return; // NOTREACHED
} }

View file

@ -97,15 +97,8 @@ function message_post(&$a) {
} }
} }
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($post_id) { if($post_id) {
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", array(),$foo)); proc_run('php',"include/notifier.php","mail","$post_id");
proc_run($php_path,"include/notifier.php","mail","$post_id");
notice( t('Message sent.') . EOL ); notice( t('Message sent.') . EOL );
} }
else { else {

View file

@ -182,13 +182,11 @@ foreach($_FILES AS $key => $val) {
); );
$drop_id = intval($rr['id']); $drop_id = intval($rr['id']);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
// 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_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",array(),$foo)); proc_run('php',"include/notifier.php","drop","$drop_id");
proc_run($php_path,"include/notifier.php","drop","$drop_id");
} }
} }
} }
@ -232,11 +230,9 @@ foreach($_FILES AS $key => $val) {
$url = $a->get_baseurl(); $url = $a->get_baseurl();
$drop_id = intval($i[0]['id']); $drop_id = intval($i[0]['id']);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($i[0]['visible']) if($i[0]['visible'])
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ", array(),$foo)); proc_run('php',"include/notifier.php","drop","$drop_id");
proc_run($php_path,"include/notifier.php","drop","$drop_id");
} }
} }
@ -474,9 +470,8 @@ foreach($_FILES AS $key => $val) {
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="image/jpeg" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '" />') . '</link></target>'; $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="image/jpeg" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '" />') . '</link></target>';
$item_id = item_store($arr); $item_id = item_store($arr);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); if($item_id)
//proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",array(),$foo)); proc_run('php',"include/notifier.php","tag","$item_id");
proc_run($php_path,"include/notifier.php","tag","$item_id");
} }
} }

View file

@ -87,11 +87,9 @@ function profile_photo_post(&$a) {
); );
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
//proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo)); proc_run('php',"include/directory.php","$url");
proc_run($php_path,"include/directory.php","$url");
} }
else else
notice( t('Unable to process image') . EOL); notice( t('Unable to process image') . EOL);
@ -169,11 +167,9 @@ function profile_photo_content(&$a) {
); );
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
//proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo)); proc_run('php',"include/directory.php","$url");
proc_run($php_path,"include/directory.php","$url");
goaway($a->get_baseurl() . '/profiles'); goaway($a->get_baseurl() . '/profiles');
return; // NOTREACHED return; // NOTREACHED

View file

@ -200,11 +200,9 @@ function profiles_post(&$a) {
if($is_default) { if($is_default) {
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
//proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", array(),$foo)); proc_run('php',"include/directory.php","$url");
proc_run($php_path,"include/directory.php","$url");
} }
} }
} }

View file

@ -292,9 +292,8 @@ function register_post(&$a) {
} }
if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) { if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $a->get_baseurl() . "/profile/$nickname"; $url = $a->get_baseurl() . "/profile/$nickname";
proc_run($php_path,"include/directory.php","$url"); proc_run('php',"include/directory.php","$url");
} }

View file

@ -74,10 +74,9 @@ function regmod_content(&$a) {
intval($user[0]['uid']) intval($user[0]['uid'])
); );
if(count($r) && $r[0]['net-publish']) { if(count($r) && $r[0]['net-publish']) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $a->get_baseurl() . '/profile/' . $user[0]['nickname']; $url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
proc_run($php_path,"include/directory.php","$url"); proc_run('php',"include/directory.php","$url");
} }
$email_tpl = load_view_file("view/register_open_eml.tpl"); $email_tpl = load_view_file("view/register_open_eml.tpl");

View file

@ -179,11 +179,9 @@ function settings_post(&$a) {
if($old_visibility != $net_publish) { if($old_visibility != $net_publish) {
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url']; $url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url'))) if($url && strlen(get_config('system','directory_submit_url')))
//proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo)); proc_run('php',"include/directory.php","$url");
proc_run($php_path,"include/directory.php","$url");
} }
$_SESSION['theme'] = $theme; $_SESSION['theme'] = $theme;