]> git.mxchange.org Git - friendica.git/commitdiff
move php path setting inside proc_run
authorFriendika <info@friendika.com>
Wed, 23 Feb 2011 23:16:12 +0000 (15:16 -0800)
committerFriendika <info@friendika.com>
Wed, 23 Feb 2011 23:16:12 +0000 (15:16 -0800)
16 files changed:
addon/poormancron/poormancron.php
boot.php
include/poller.php
mod/contacts.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/follow.php
mod/item.php
mod/like.php
mod/message.php
mod/photos.php
mod/profile_photo.php
mod/profiles.php
mod/register.php
mod/regmod.php
mod/settings.php

index c31d2772c8f57f6f0f666fc96f9452337ce32bc5..830c10ddfebaa96cca2cfa1f8a0158cc3f26a2b4 100644 (file)
@@ -27,8 +27,7 @@ function poormancron_hook($a,&$b) {
     // 300 secs, 5 mins
     if (!$lastupdate || ($now-$lastupdate)>300) {
         set_config('poormancron','lastupdate', $now);
-        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-        proc_run($php_path,"include/poller.php");
+        proc_run('php',"include/poller.php");
     }
 }
 
index 530baa7b915f09ff9486ed0165f0ce4d02b29aa8..d9786edcd5af64d44b01f034f4182366d4a68501 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2434,6 +2434,9 @@ if(! function_exists('proc_run')) {
 function proc_run($cmd){
        $args = func_get_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){
                $arg = escapeshellarg($arg);
index 66df080a9dbdce632b77e153a735072892cd0334..d54c88e0533febdc3b38d70f25b93671c495aa34 100644 (file)
@@ -27,8 +27,7 @@ function poller_run($argv, $argc){
        
        // 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_path,"include/queue.php");
+       proc_run('php',"include/queue.php");
        
        // clear old cache
        q("DELETE FROM `cache` WHERE `updated`<'%s'",
index 36f42f8e59eef54c9c880fd8dbd46cd566df56a8..8e069b2bd646795f970f3054feae0e28daeb85cb 100644 (file)
@@ -124,9 +124,7 @@ function contacts_content(&$a) {
                if($cmd === 'update') {
 
                        // 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_path,"include/poller.php","$contact_id");
+                       proc_run('php',"include/poller.php","$contact_id");
                        goaway($a->get_baseurl() . '/contacts/' . $contact_id);
                        // NOTREACHED
                }
index 24e8bf106a9a938dcf6e0ddf3352b2839fcbf38f..1b42c13b8ac8203984e5fb3df404c18b5551deeb 100644 (file)
@@ -435,11 +435,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                                $arr['last-child'] = 1;
 
                                $i = item_store($arr);
-
-                               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
-                           //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", array(),$foo));
-                           proc_run($php_path,"include/notifier.php","activity","$i");
+                               if($i)
+                               proc_run('php',"include/notifier.php","activity","$i");
 
                        }
 
index cd7b0cff018ad92265b323f9b8c3f845c53318c1..0102727392fd06ec1bb62b68b39fa406057e46f5 100644 (file)
@@ -369,9 +369,7 @@ function dfrn_notify_post(&$a) {
 
                                        if($posted_id && $parent) {
                                
-                                               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
-                                               proc_run($php_path,"include/notifier.php","comment-import","$posted_id");
+                                               proc_run('php',"include/notifier.php","comment-import","$posted_id");
                                        
                                                if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
                                                        require_once('bbcode.php');
index 28441eae8fbd589010019a86e3a637b56cd6332b..f3bd84669f6dfbc3e2417c8e4862fcd8028415ce 100644 (file)
@@ -253,9 +253,7 @@ function follow_post(&$a) {
 
        // 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_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
-       proc_run($php_path,"include/poller.php","$contact_id");
+       proc_run('php',"include/poller.php","$contact_id");
 
        // create a follow slap
 
index 8c6b181c0d557dfdbd4631e45fb09359d0375877..c2487435e49e172f6a246726c602029486336e6b 100644 (file)
@@ -460,11 +460,7 @@ function item_post(&$a) {
                // NOTREACHED
        }
 
-       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
-       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");
+       proc_run('php', "include/notifier.php", $notify_type, "$post_id");
 
        $datarray['id'] = $post_id;
 
@@ -595,12 +591,10 @@ function item_content(&$a) {
                                }       
                        }
                        $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
 
-                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo));
-                       proc_run($php_path,"include/notifier.php","drop","$drop_id");
+                       proc_run('php',"include/notifier.php","drop","$drop_id");
 
                        goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
                        //NOTREACHED
index c78c1f030ca71d364d9e732f9ad0f28e1983d64d..3a8ca4b7d3a0e82cf6bfdaa78de8018deb35753c 100644 (file)
@@ -101,9 +101,7 @@ function like_content(&$a) {
                        intval($r[0]['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");
+               proc_run('php',"include/notifier.php","like","$post_id");
                return;
        }
 
@@ -173,11 +171,7 @@ EOT;
                );
        }                       
 
-
-       $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");
+       proc_run('php',"include/notifier.php","like","$post_id");
 
        return; // NOTREACHED
 }
\ No newline at end of file
index ef3be2c5e9cd05a7e5e7a89cff96c1c480c16bfc..466b0befa869390ce67d2c7472e3b21a492abc79 100644 (file)
@@ -96,16 +96,9 @@ function message_post(&$a) {
                        }
                }
        }
-
-
-
-
-
-       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
        
        if($post_id) {
-               //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", array(),$foo));
-               proc_run($php_path,"include/notifier.php","mail","$post_id");
+               proc_run('php',"include/notifier.php","mail","$post_id");
                notice( t('Message sent.') . EOL );
        }
        else {
index d4835ba5ea65edb515a35087c08483f8ac3419e9..bd48cfc9f9b2e38743fa311e2916b66a95e07423 100644 (file)
@@ -182,13 +182,11 @@ foreach($_FILES AS $key => $val) {
                                        );
 
                                        $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
 
                                        if($rr['visible'])
-                                               //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",array(),$foo));
-                                               proc_run($php_path,"include/notifier.php","drop","$drop_id");
+                                               proc_run('php',"include/notifier.php","drop","$drop_id");
                                }
                        }
                }
@@ -232,11 +230,9 @@ foreach($_FILES AS $key => $val) {
 
                                $url = $a->get_baseurl();
                                $drop_id = intval($i[0]['id']);
-                               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
 
                                if($i[0]['visible'])
-                                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",       array(),$foo));
-                                       proc_run($php_path,"include/notifier.php","drop","$drop_id");
+                                       proc_run('php',"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>';
 
                                        $item_id = item_store($arr);
-                                       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-                                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",array(),$foo));
-                                       proc_run($php_path,"include/notifier.php","tag","$item_id");
+                                       if($item_id)
+                                               proc_run('php',"include/notifier.php","tag","$item_id");
                                }
 
                        }
index 4f0d567f407a265bf0cf8441e8ff532a33f52260..0f84a85c9235b529214c2f2d87fe933d9bb6ea15 100644 (file)
@@ -87,11 +87,9 @@ function profile_photo_post(&$a) {
                                );
 
                                // Update global directory in background
-                               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                                $url = $_SESSION['my_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_path,"include/directory.php","$url");
+                                       proc_run('php',"include/directory.php","$url");
                        }
                        else
                                notice( t('Unable to process image') . EOL);
@@ -169,11 +167,9 @@ function profile_photo_content(&$a) {
                        );
                        
                        // Update global directory in background
-                       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                        $url = $_SESSION['my_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_path,"include/directory.php","$url");
+                               proc_run('php',"include/directory.php","$url");
                        
                        goaway($a->get_baseurl() . '/profiles');
                        return; // NOTREACHED
index d74219501a0ce3501888994bf715e908320188af..4e3f03799a4dd5e02bb8ecba4c087cea19b29dfd 100644 (file)
@@ -200,11 +200,9 @@ function profiles_post(&$a) {
 
                if($is_default) {
                        // Update global directory in background
-                       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                        $url = $_SESSION['my_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_path,"include/directory.php","$url");
+                               proc_run('php',"include/directory.php","$url");
                }
        }
 }
index d885362325014e3b5d8fa7112fd0cf40be5d87e6..97038def0ba15a0d6b8b02d85aad9c10762372b9 100644 (file)
@@ -292,9 +292,8 @@ function register_post(&$a) {
        }
 
        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";
-               proc_run($php_path,"include/directory.php","$url");
+               proc_run('php',"include/directory.php","$url");
        }
 
 
index f662902d8dbcf71eb3516bc5cf4395fba56164ca..00cfa06e21e45b115962abae7ef7fb604c8826dc 100644 (file)
@@ -74,10 +74,9 @@ function regmod_content(&$a) {
                        intval($user[0]['uid'])
                );
                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'];
                        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");
index dbbac8bdeb3c9b14f2eededb6a74242c64889d29..ebe07612eb1fa152a0a5d6c74ec60ec15e8c73cf 100644 (file)
@@ -179,11 +179,9 @@ function settings_post(&$a) {
 
        if($old_visibility != $net_publish) {
                // Update global directory in background
-               $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                $url = $_SESSION['my_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_path,"include/directory.php","$url");
+                       proc_run('php',"include/directory.php","$url");
        }
 
        $_SESSION['theme'] = $theme;