Replaced $argv and $argc with the $_SERVER array

This commit is contained in:
Michael Vogel 2015-01-04 13:24:16 +01:00
parent b5beb4c69a
commit cce561708a
15 changed files with 47 additions and 57 deletions

View file

@ -435,7 +435,7 @@ if(! class_exists('App')) {
function __construct() {
global $default_timezone, $argv, $argc;
global $default_timezone;
$hostname = "";
@ -504,9 +504,9 @@ if(! class_exists('App')) {
if ($hostname != "")
$this->hostname = $hostname;
if (is_array($argv) && $argc>1 && substr(end($argv), 0, 4)=="http" ) {
$this->set_baseurl(array_pop($argv) );
$argc --;
if (is_array($_SERVER["argv"]) && $_SERVER["argc"]>1 && substr(end($_SERVER["argv"]), 0, 4)=="http" ) {
$this->set_baseurl(array_pop($_SERVER["argv"]) );
$_SERVER["argc"] --;
}
#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
@ -2388,11 +2388,3 @@ if(!function_exists('exif_imagetype')) {
return($size[2]);
}
}
// See https://github.com/friendica/friendica/issues/1218
// Try to get the values for $argv and $argc via the $_SERVER array
if (!isset($argv) && array_key_exists('argv', $_SERVER))
$argv = $_SERVER['argv'];
if (!isset($argc) && array_key_exists('argc', $_SERVER))
$argc = $_SERVER['argc'];

View file

@ -66,6 +66,6 @@ function cronhooks_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
cronhooks_run($argv,$argc);
cronhooks_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -1339,6 +1339,6 @@ function dbstructure_run(&$argv, &$argc) {
}
if (array_search(__file__,get_included_files())===0){
dbstructure_run($argv,$argc);
dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -23,6 +23,6 @@ function dbupdate_run(&$argv, &$argc) {
}
if (array_search(__file__,get_included_files())===0){
dbupdate_run($argv,$argc);
dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -565,6 +565,6 @@ function delivery_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
delivery_run($argv,$argc);
delivery_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -46,6 +46,6 @@ function directory_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
directory_run($argv,$argc);
directory_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -45,6 +45,6 @@ function dsprphotoq_run($argv, $argc){
if (array_search(__file__,get_included_files())===0){
dsprphotoq_run($argv,$argc);
dsprphotoq_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -55,6 +55,6 @@ function expire_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
expire_run($argv,$argc);
expire_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -63,6 +63,6 @@ function gprobe_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
gprobe_run($argv,$argc);
gprobe_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -1001,6 +1001,6 @@ function notifier_run(&$argv, &$argc){
if (array_search(__file__,get_included_files())===0){
notifier_run($argv,$argc);
notifier_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -602,6 +602,6 @@ function onepoll_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
onepoll_run($argv,$argc);
onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -301,6 +301,6 @@ function poller_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
poller_run($argv,$argc);
poller_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -265,6 +265,6 @@ function queue_run(&$argv, &$argc){
}
if (array_search(__file__,get_included_files())===0){
queue_run($argv,$argc);
queue_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

View file

@ -15,9 +15,7 @@
*/
if(($argc > 1) && isset($argv[1]))
echo $argv[1];
elseif(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
echo $_SERVER["argv"][1];
else
echo '';

View file

@ -124,5 +124,5 @@ function po2php_run(&$argv, &$argc) {
}
if (array_search(__file__,get_included_files())===0){
po2php_run($argv,$argc);
po2php_run($_SERVER["argv"],$_SERVER["argc"]);
}