mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-09 09:47:25 +08:00
Fixed yii\console\controllers\AssetController does not create missing folders for the target bundles
This commit is contained in:
@ -6,6 +6,7 @@ Yii Framework 2 Change Log
|
|||||||
|
|
||||||
- Bug #6642: Fixed the bug that using confirmation dialog via `data-confirm` in an `ActiveForm` may cause the dialog to appear twice (pana1990, qiangxue)
|
- Bug #6642: Fixed the bug that using confirmation dialog via `data-confirm` in an `ActiveForm` may cause the dialog to appear twice (pana1990, qiangxue)
|
||||||
- Bug #6871: Fixed the bug that using defaults and hostnames in URL rules may cause an out-of-range index issue (qiangxue)
|
- Bug #6871: Fixed the bug that using defaults and hostnames in URL rules may cause an out-of-range index issue (qiangxue)
|
||||||
|
- Bug #7473: Fixed `yii\console\controllers\AssetController` does not create missing folders for the target bundles (schmunk42, klimov-paul)
|
||||||
- Bug #7529: Fixed `yii\web\Response::sendContentAsFile()` that was broken in 2.0.3 (samdark)
|
- Bug #7529: Fixed `yii\web\Response::sendContentAsFile()` that was broken in 2.0.3 (samdark)
|
||||||
- Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe)
|
- Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe)
|
||||||
- Bug #7757: Fix fetching tables schema for oci and mysql when PDO::ATTR_CASE is set (nineinchnick)
|
- Bug #7757: Fix fetching tables schema for oci and mysql when PDO::ATTR_CASE is set (nineinchnick)
|
||||||
|
|||||||
@ -11,6 +11,7 @@ use Yii;
|
|||||||
use yii\console\Exception;
|
use yii\console\Exception;
|
||||||
use yii\console\Controller;
|
use yii\console\Controller;
|
||||||
use yii\helpers\Console;
|
use yii\helpers\Console;
|
||||||
|
use yii\helpers\FileHelper;
|
||||||
use yii\helpers\VarDumper;
|
use yii\helpers\VarDumper;
|
||||||
use yii\web\AssetBundle;
|
use yii\web\AssetBundle;
|
||||||
|
|
||||||
@ -325,9 +326,7 @@ class AssetController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function buildTarget($target, $type, $bundles)
|
protected function buildTarget($target, $type, $bundles)
|
||||||
{
|
{
|
||||||
$tempFile = $target->basePath . '/' . strtr($target->$type, ['{hash}' => 'temp']);
|
|
||||||
$inputFiles = [];
|
$inputFiles = [];
|
||||||
|
|
||||||
foreach ($target->depends as $name) {
|
foreach ($target->depends as $name) {
|
||||||
if (isset($bundles[$name])) {
|
if (isset($bundles[$name])) {
|
||||||
if (!$this->isBundleExternal($bundles[$name])) {
|
if (!$this->isBundleExternal($bundles[$name])) {
|
||||||
@ -339,6 +338,15 @@ class AssetController extends Controller
|
|||||||
throw new Exception("Unknown bundle: '{$name}'");
|
throw new Exception("Unknown bundle: '{$name}'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($inputFiles)) {
|
||||||
|
$target->$type = [];
|
||||||
|
} else {
|
||||||
|
if (!file_exists($target->basePath)) {
|
||||||
|
FileHelper::createDirectory($target->basePath, $this->getAssetManager()->dirMode);
|
||||||
|
}
|
||||||
|
$tempFile = $target->basePath . '/' . strtr($target->$type, ['{hash}' => 'temp']);
|
||||||
|
|
||||||
if ($type === 'js') {
|
if ($type === 'js') {
|
||||||
$this->compressJsFiles($inputFiles, $tempFile);
|
$this->compressJsFiles($inputFiles, $tempFile);
|
||||||
} else {
|
} else {
|
||||||
@ -350,6 +358,7 @@ class AssetController extends Controller
|
|||||||
rename($tempFile, $outputFile);
|
rename($tempFile, $outputFile);
|
||||||
$target->$type = [$targetFile];
|
$target->$type = [$targetFile];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust dependencies between asset bundles in the way source bundles begin to depend on output ones.
|
* Adjust dependencies between asset bundles in the way source bundles begin to depend on output ones.
|
||||||
|
|||||||
Reference in New Issue
Block a user