Browse Source

Fixes #16217: Fixed `yii\console\controllers\HelpController` to work well in Windows environment

tags/2.0.16
Alexander Makarov 6 years ago committed by GitHub
parent
commit
e4b559d720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .appveyor.yml
  2. 2
      framework/CHANGELOG.md
  3. 10
      framework/console/controllers/HelpController.php

1
.appveyor.yml

@ -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:

2
framework/CHANGELOG.md

@ -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)

10
framework/console/controllers/HelpController.php

@ -116,13 +116,13 @@ class HelpController extends Controller
}
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");
}
}
@ -251,16 +251,16 @@ class HelpController extends Controller
$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;
}

Loading…
Cancel
Save