Index: typo3/sysext/lowlevel/class.tx_lowlevel_cleaner_core.php =================================================================== --- typo3/sysext/lowlevel/class.tx_lowlevel_cleaner_core.php (revision 6288) +++ typo3/sysext/lowlevel/class.tx_lowlevel_cleaner_core.php (working copy) @@ -132,6 +132,8 @@ */ function cli_main($argv) { + $this->cli_setArguments($argv); + // Force user to admin state and set workspace to "Live": $GLOBALS['BE_USER']->user['admin'] = 1; $GLOBALS['BE_USER']->setWorkspace(0); Index: t3lib/class.t3lib_cli.php =================================================================== --- t3lib/class.t3lib_cli.php (revision 6288) +++ t3lib/class.t3lib_cli.php (working copy) @@ -87,7 +87,7 @@ */ function t3lib_cli() { // Loads the cli_args array with command line arguments - $this->cli_args = $this->cli_getArgIndex(); + $this->cli_setArguments($_SERVER['argv']); } /** @@ -135,12 +135,18 @@ * Argument names (eg. "-s") will be keys and values after (eg. "-s value1 value2 ..." or "-s=value1") will be in the array. * Array is empty if no values * + * @param array $argv Configuration options * @return array */ - function cli_getArgIndex() { + function cli_getArgIndex ($argv) { $cli_options = array(); $index = '_DEFAULT'; - foreach($_SERVER['argv'] as $token) { + + if (!is_array($argv)) { + $argv = array(); + } + + foreach($argv as $token) { if ($token{0}==='-' && !t3lib_div::testInt($token{1})) { // Options starting with a number is invalid - they could be negative values... ! list($index,$opt) = explode('=',$token,2); if (isset($cli_options[$index])) { @@ -198,6 +204,17 @@ } /** + * Set environment array to $cli_args + * + * @param array $argv Configuration options + * @return void + */ + function cli_setArguments ($argv) { + $this->cli_args = $this->cli_getArgIndex ($argv); + } + + + /** * Asks stdin for keyboard input and returns the line (after enter is pressed) * * @return string