Merge pull request #1274 from annando/issue-1218

Issue 1218: generate $argv and $argc from $_SERVER if it wasn't defined
This commit is contained in:
fabrixxm 2015-01-09 11:44:38 +01:00
commit 418ac91c31
15 changed files with 53 additions and 54 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());

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

@ -1346,6 +1346,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,7 +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,7 +15,7 @@
*/
if(($argc > 1) && isset($argv[1]))
echo $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"]);
}