From 9a472c8323667f264ee4946a81c1e43eb4ff93bf Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sun, 19 May 2013 16:17:02 +0300 Subject: [PATCH] "yii\console\controllers\AssetController::getAssetManager()" has been updated enforcing 'basePath' and 'baseUrl' config parameters. --- yii/console/controllers/AssetController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/yii/console/controllers/AssetController.php b/yii/console/controllers/AssetController.php index fd75096..59cf1f5 100644 --- a/yii/console/controllers/AssetController.php +++ b/yii/console/controllers/AssetController.php @@ -60,7 +60,7 @@ class AssetController extends Controller * @var string|callback Java Script file compressor. * If a string, it is treated as shell command template, which should contain * placeholders {from} - source file name - and {to} - output file name. - * If an array, it is treated as PHP callback, which should perform the compression. + * Otherwise, it is treated as PHP callback, which should perform the compression. * * Default value relies on usage of "Closure Compiler" * @see https://developers.google.com/closure/compiler/ @@ -70,7 +70,7 @@ class AssetController extends Controller * @var string|callback CSS file compressor. * If a string, it is treated as shell command template, which should contain * placeholders {from} - source file name - and {to} - output file name. - * If an array, it is treated as PHP callback, which should perform the compression. + * Otherwise, it is treated as PHP callback, which should perform the compression. * * Default value relies on usage of "YUI Compressor" * @see https://github.com/yui/yuicompressor/ @@ -78,6 +78,8 @@ class AssetController extends Controller public $cssCompressor = 'java -jar yuicompressor.jar {from} -o {to}'; /** + * Returns the asset manager instance. + * @throws \yii\console\Exception on invalid configuration. * @return \yii\web\AssetManager asset manager instance. */ public function getAssetManager() @@ -87,12 +89,19 @@ class AssetController extends Controller if (!isset($options['class'])) { $options['class'] = 'yii\\web\\AssetManager'; } + if (!isset($options['basePath'])) { + throw new Exception("Please specify 'basePath' for the 'assetManager' option."); + } + if (!isset($options['baseUrl'])) { + throw new Exception("Please specify 'baseUrl' for the 'assetManager' option."); + } $this->_assetManager = Yii::createObject($options); } return $this->_assetManager; } /** + * Sets asset manager instance or configuration. * @param \yii\web\AssetManager|array $assetManager asset manager instance or its array configuration. * @throws \yii\console\Exception on invalid argument type. */