cleanup proc_run after messing it up with debugging yesterday
This commit is contained in:
parent
aefeda8c41
commit
b2f0d2d085
38
boot.php
38
boot.php
@ -1816,38 +1816,19 @@ function get_max_import_size() {
|
|||||||
*/
|
*/
|
||||||
function proc_run(){
|
function proc_run(){
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
||||||
$newargs = array();
|
$newargs = array();
|
||||||
|
|
||||||
if(! count($args))
|
if(! count($args))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// expand any arrays
|
$args = flatten_array_recursive($args);
|
||||||
|
|
||||||
foreach($args as $arg) {
|
|
||||||
if(is_array($arg)) {
|
|
||||||
foreach($arg as $n) {
|
|
||||||
if(is_array($n)) {
|
|
||||||
foreach($n as $w) {
|
|
||||||
$newargs[] = $w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$newargs[] = $n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$newargs[] = $arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
$args = $newargs;
|
|
||||||
|
|
||||||
$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'])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1855,8 +1836,8 @@ function proc_run(){
|
|||||||
$args[0] = ((x(App::$config,'system')) && (x(App::$config['system'],'php_path')) && (strlen(App::$config['system']['php_path'])) ? App::$config['system']['php_path'] : 'php');
|
$args[0] = ((x(App::$config,'system')) && (x(App::$config['system'],'php_path')) && (strlen(App::$config['system']['php_path'])) ? App::$config['system']['php_path'] : 'php');
|
||||||
|
|
||||||
|
|
||||||
// redirect proc_run statements of legacy daemon processes to the new Daemon Master object class
|
// redirect proc_run statements of legacy daemon processes to the newer Daemon Master object class
|
||||||
// We will keep this interface until everybody has transitioned.
|
// We will keep this interface until everybody has transitioned. (2016-05-20)
|
||||||
|
|
||||||
if(strstr($args[1],'include/')) {
|
if(strstr($args[1],'include/')) {
|
||||||
// convert 'include/foo.php' to 'Foo'
|
// convert 'include/foo.php' to 'Foo'
|
||||||
@ -1871,14 +1852,7 @@ function proc_run(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for($x = 0; $x < count($args); $x++) {
|
$args = array_map('escapeshellarg',$args);
|
||||||
if(is_array($args[$x])) {
|
|
||||||
logger('ERROR: shell args is array . ' . print_r($args,true));
|
|
||||||
btlogger('args:');
|
|
||||||
}
|
|
||||||
$args[$x] = escapeshellarg($args[$x]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cmdline = implode($args," ");
|
$cmdline = implode($args," ");
|
||||||
|
|
||||||
if(is_windows()) {
|
if(is_windows()) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php /** @file */
|
<?php /** @file */
|
||||||
require_once 'include/ITemplateEngine.php';
|
|
||||||
require_once("library/Smarty/libs/Smarty.class.php");
|
require_once('include/ITemplateEngine.php');
|
||||||
|
require_once('library/Smarty/libs/Smarty.class.php');
|
||||||
|
|
||||||
|
|
||||||
class FriendicaSmarty extends Smarty {
|
class FriendicaSmarty extends Smarty {
|
||||||
|
@ -2860,3 +2860,32 @@ function pdl_selector($uid, $current="") {
|
|||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* array flatten_array_recursive(array);
|
||||||
|
* returns a one-dimensional array from a multi-dimensional array
|
||||||
|
* empty values are discarded
|
||||||
|
* example: print_r(flatten_array_recursive(array('foo','bar',array('baz','blip',array('zob','glob')),'','grip')));
|
||||||
|
*
|
||||||
|
* Array ( [0] => foo [1] => bar [2] => baz [3] => blip [4] => zob [5] => glob [6] => grip )
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function flatten_array_recursive($arr) {
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
if(! $arr)
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
foreach($arr as $a) {
|
||||||
|
if(is_array($a)) {
|
||||||
|
$tmp = flatten_array_recursive($a);
|
||||||
|
if($tmp) {
|
||||||
|
$ret = array_merge($ret,$tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($a) {
|
||||||
|
$ret[] = $a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return($ret);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user