Index: trunk/phase3/includes/User.php |
— | — | @@ -214,6 +214,8 @@ |
215 | 215 | $mBlockreason, $mBlock, $mEffectiveGroups, $mBlockedGlobally, |
216 | 216 | $mLocked, $mHideName, $mOptions; |
217 | 217 | //@} |
| 218 | + |
| 219 | + static $idCacheByName = array(); |
218 | 220 | |
219 | 221 | /** |
220 | 222 | * Lightweight constructor for an anonymous user. |
— | — | @@ -457,10 +459,8 @@ |
458 | 460 | return null; |
459 | 461 | } |
460 | 462 | |
461 | | - static $cache = array(); |
462 | | - |
463 | | - if ( isset($cache[$name]) ) { |
464 | | - return $cache[$name]; |
| 463 | + if ( isset(self::$idCacheByName[$name]) ) { |
| 464 | + return self::$idCacheByName[$name]; |
465 | 465 | } |
466 | 466 | |
467 | 467 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -472,10 +472,10 @@ |
473 | 473 | $result = $s->user_id; |
474 | 474 | } |
475 | 475 | |
476 | | - $cache[$name] = $result; |
| 476 | + self::$idCacheByName[$name] = $result; |
477 | 477 | |
478 | | - if ( count($cache) > 1000 ) { |
479 | | - $cache = array(); |
| 478 | + if ( count(self::$idCacheByName) > 1000 ) { |
| 479 | + self::$idCacheByName = array(); |
480 | 480 | } |
481 | 481 | |
482 | 482 | return $result; |