[*] Core: you can now pass a query string with php-cli which will merged with for cronjobs and other things

This commit is contained in:
Rémi Gaillard
2013-05-15 14:46:40 +02:00
parent 35463be99a
commit 2c10ba5359
3 changed files with 30 additions and 2 deletions
+21
View File
@@ -2198,6 +2198,27 @@ exit;
return (PHP_INT_MAX == '9223372036854775807');
}
/**
*
* @return bool true if php-cli is used
*/
public static function isPHPCLI()
{
return (defined('STDIN') || (Tools::strtolower(php_sapi_name()) == 'cli' && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))));
}
public static function argvToGET($argc, $argv)
{
if ($argc <= 1)
return;
// get the first argument and parse it like a query string
parse_str($argv[1], $args);
if (!is_array($args) || !count($args))
return;
$_GET = array_merge($args, $_GET);
}
/**
* Get max file upload size considering server settings and optional max value
*