Skip to content

Commit

Permalink
Fixes yiisoft#16217: Fixed yii\console\controllers\HelpController t…
Browse files Browse the repository at this point in the history
…o work well in Windows environment
  • Loading branch information
samdark authored May 12, 2018
1 parent 1945dc6 commit e4b559d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ install:
- echo extension=php_intl.dll >> php.ini
- echo extension=php_mbstring.dll >> php.ini
- echo extension=php_openssl.dll >> php.ini
- echo extension=php_pdo_sqlite.dll >> php.ini
- IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/1.4.1/composer.phar)

before_test:
Expand Down
2 changes: 1 addition & 1 deletion framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Yii Framework 2 Change Log
- Bug #16091: Make `yii\test\InitDbFixture` work with non-SQL DBMS (cebe)
- Bug #16184: Fixed `yii\base\Widget` to access `stack` property with `self` instead of `static` (yanggs07)
- Bug #16039: Fixed implicit conversion from `char` to `varbinnary` in MSSQL (vsivsivsi)
- Bug #16217: Fixed `yii\console\controllers\HelpController` to work well in Windows environment (samdark)
- Bug #14636: Views can now use relative paths even when using themed views (sammousa)
- Bug #16245: Fixed `__isset()` in `BaseActiveRecord` not catching errors (sammousa)
- Enh #16191: Enhanced `yii\helpers\Inflector` to work correctly with UTF-8 (silverfire)

- Bug: Fixed bad instnaceof check in `yii\db\Schema::getTableMetadata()` (samdark)


Expand Down
10 changes: 5 additions & 5 deletions framework/console/controllers/HelpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ public function actionListActionOptions($action)
}

foreach ($controller->getActionArgsHelp($action) as $argument => $help) {
$description = str_replace("\n", '', addcslashes($help['comment'], ':')) ?: $argument;
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':')) ?: $argument;
$this->stdout($argument . ':' . $description . "\n");
}

$this->stdout("\n");
foreach ($controller->getActionOptionsHelp($action) as $argument => $help) {
$description = str_replace("\n", '', addcslashes($help['comment'], ':'));
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':'));
$this->stdout('--' . $argument . ($description ? ':' . $description : '') . "\n");
}
}
Expand Down Expand Up @@ -251,16 +251,16 @@ protected function getModuleCommands($module)
$file = $matches[0];
$relativePath = str_replace($controllerPath, '', $file);
$class = strtr($relativePath, [
DIRECTORY_SEPARATOR => '\\',
'/' => '\\',
'.php' => '',
]);
$controllerClass = $module->controllerNamespace . $class;
if ($this->validateControllerClass($controllerClass)) {
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), DIRECTORY_SEPARATOR);
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), '\\/');

$command = Inflector::camel2id(substr(basename($file), 0, -14), '-', true);
if (!empty($dir)) {
$command = $dir . DIRECTORY_SEPARATOR . $command;
$command = $dir . '/' . $command;
}
$commands[] = $prefix . $command;
}
Expand Down

0 comments on commit e4b559d

Please sign in to comment.