Browse Source

"yii\console\controllers\AssetController::getAssetManager()" has been updated enforcing 'basePath' and 'baseUrl' config parameters.

tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
9a472c8323
  1. 13
      yii/console/controllers/AssetController.php

13
yii/console/controllers/AssetController.php

@ -60,7 +60,7 @@ class AssetController extends Controller
* @var string|callback Java Script file compressor. * @var string|callback Java Script file compressor.
* If a string, it is treated as shell command template, which should contain * If a string, it is treated as shell command template, which should contain
* placeholders {from} - source file name - and {to} - output file name. * 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" * Default value relies on usage of "Closure Compiler"
* @see https://developers.google.com/closure/compiler/ * @see https://developers.google.com/closure/compiler/
@ -70,7 +70,7 @@ class AssetController extends Controller
* @var string|callback CSS file compressor. * @var string|callback CSS file compressor.
* If a string, it is treated as shell command template, which should contain * If a string, it is treated as shell command template, which should contain
* placeholders {from} - source file name - and {to} - output file name. * 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" * Default value relies on usage of "YUI Compressor"
* @see https://github.com/yui/yuicompressor/ * @see https://github.com/yui/yuicompressor/
@ -78,6 +78,8 @@ class AssetController extends Controller
public $cssCompressor = 'java -jar yuicompressor.jar {from} -o {to}'; 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. * @return \yii\web\AssetManager asset manager instance.
*/ */
public function getAssetManager() public function getAssetManager()
@ -87,12 +89,19 @@ class AssetController extends Controller
if (!isset($options['class'])) { if (!isset($options['class'])) {
$options['class'] = 'yii\\web\\AssetManager'; $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); $this->_assetManager = Yii::createObject($options);
} }
return $this->_assetManager; return $this->_assetManager;
} }
/** /**
* Sets asset manager instance or configuration.
* @param \yii\web\AssetManager|array $assetManager asset manager instance or its array configuration. * @param \yii\web\AssetManager|array $assetManager asset manager instance or its array configuration.
* @throws \yii\console\Exception on invalid argument type. * @throws \yii\console\Exception on invalid argument type.
*/ */

Loading…
Cancel
Save