Commit 8264c5c5 by Tobias Munk

refactored param parsing

parent c73ab910
...@@ -80,17 +80,17 @@ class InstallHandler ...@@ -80,17 +80,17 @@ class InstallHandler
} }
} }
// prepare console application
require(__DIR__ . '/../../../yii2/yii/Yii.php'); require(__DIR__ . '/../../../yii2/yii/Yii.php');
$application = new \yii\console\Application($config);
$request = $application->getRequest();
foreach ((array)$options['run'] as $rawParams) { // run commands from extra.run
// TODO: we're doing about the same here like console\Request::resolve() foreach ((array)$options['run'] as $rawCommand) {
$command = $rawParams[0]; $opts = str_getcsv($rawCommand, ' '); // see http://stackoverflow.com/a/6609509/291573
unset($rawParams[0]); $request->setParams($opts);
$params[\yii\console\Request::ANONYMOUS_PARAMS] = $rawParams; list($command, $params) = $request->resolve();
// TODO end
echo "Running command: {$command}\n"; echo "Running command: {$command}\n";
$application = new \yii\console\Application($config);
$application->runAction($command, $params); $application->runAction($command, $params);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment