mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Merge branch 'master' of git.yiisoft.com:yii2
This commit is contained in:
@ -74,9 +74,6 @@ class UrlManager extends Component
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
if (is_string($this->cache)) {
|
||||
$this->cache = Yii::$app->getComponent($this->cache);
|
||||
}
|
||||
$this->compileRules();
|
||||
}
|
||||
|
||||
@ -88,6 +85,9 @@ class UrlManager extends Component
|
||||
if (!$this->enablePrettyUrl || $this->rules === array()) {
|
||||
return;
|
||||
}
|
||||
if (is_string($this->cache)) {
|
||||
$this->cache = Yii::$app->getComponent($this->cache);
|
||||
}
|
||||
if ($this->cache instanceof Cache) {
|
||||
$key = $this->cache->buildKey(__CLASS__);
|
||||
$hash = md5(json_encode($this->rules));
|
||||
@ -104,7 +104,7 @@ class UrlManager extends Component
|
||||
$this->rules[$i] = Yii::createObject($rule);
|
||||
}
|
||||
|
||||
if ($this->cache instanceof Cache) {
|
||||
if (isset($key, $hash)) {
|
||||
$this->cache->set($key, array($this->rules, $hash));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user