Browse Source

Fixes #10309: Extracted `yii\web\UrlManager` rule cache key into `$cacheKey` protected property

tags/2.0.8
Juuso Leinonen 9 years ago committed by Alexander Makarov
parent
commit
396bd9f714
  1. 1
      framework/CHANGELOG.md
  2. 8
      framework/web/UrlManager.php

1
framework/CHANGELOG.md

@ -211,6 +211,7 @@ Yii Framework 2 Change Log
- Enh #10255: Added Yii warning to session initialization if session was already started (AnatolyRugalev)
- Enh #10264: Generation of HTML tags in Yii's JavaScript now uses jQuery style (silverfire)
- Enh #10267: `yii.js` - added original event passing to `pjaxOptions` for links with `data-method` and `data-pjax` (servocoder, silverfire)
- Enh #10309: Extracted `yii\web\UrlManager` rule cache key into `$cacheKey` protected property (lordthorzonus)
- Enh #10319: `yii\helpers\VarDumper::dump()` now respects PHP magic method `__debugInfo()` (klimov-paul)
- Enh #10359: Support wildcard category name in `yii/console/controllers/MessageController` (rmrevin)
- Enh #10390: Added ability to disable outer tag for `\yii\helpers\BaseHtml::radiolist()`, `::checkboxList()` (TianJinRong, githubjeka, silverfire)

8
framework/web/UrlManager.php

@ -126,6 +126,12 @@ class UrlManager extends Component
*/
public $ruleConfig = ['class' => 'yii\web\UrlRule'];
/**
* @var string the cache key for cached rules
* @since 2.0.8
*/
protected $cacheKey = __CLASS__;
private $_baseUrl;
private $_scriptUrl;
private $_hostInfo;
@ -146,7 +152,7 @@ class UrlManager extends Component
$this->cache = Yii::$app->get($this->cache, false);
}
if ($this->cache instanceof Cache) {
$cacheKey = __CLASS__;
$cacheKey = $this->cacheKey;
$hash = md5(json_encode($this->rules));
if (($data = $this->cache->get($cacheKey)) !== false && isset($data[1]) && $data[1] === $hash) {
$this->rules = $data[0];

Loading…
Cancel
Save