Browse Source

Fixes issue #476

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
607f3a5987
  1. 7
      framework/yii/caching/FileCache.php

7
framework/yii/caching/FileCache.php

@ -25,8 +25,9 @@ class FileCache extends Cache
{ {
/** /**
* @var string the directory to store cache files. You may use path alias here. * @var string the directory to store cache files. You may use path alias here.
* If not set, it will use the "cache" subdirectory under the application runtime path.
*/ */
public $cachePath = '@app/runtime/cache'; public $cachePath;
/** /**
* @var string cache file suffix. Defaults to '.bin'. * @var string cache file suffix. Defaults to '.bin'.
*/ */
@ -51,7 +52,11 @@ class FileCache extends Cache
public function init() public function init()
{ {
parent::init(); parent::init();
if ($this->cachePath === null) {
$this->cachePath = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
} else {
$this->cachePath = Yii::getAlias($this->cachePath); $this->cachePath = Yii::getAlias($this->cachePath);
}
if (!is_dir($this->cachePath)) { if (!is_dir($this->cachePath)) {
mkdir($this->cachePath, 0777, true); mkdir($this->cachePath, 0777, true);
} }

Loading…
Cancel
Save