r78995 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78994‎ | r78995 | r78996 >
Date:12:24, 25 December 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Don't load the same accesskey message four times (in the worst case)
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1674,10 +1674,16 @@
16751675 public function accesskey( $name ) {
16761676 wfProfileIn( __METHOD__ );
16771677
1678 - if ( wfEmptyMsg( "accesskey-$name" ) ) {
 1678+ if ( isset( $this->accesskeycache[$name] ) ) {
 1679+ return $this->accesskeycache[$name];
 1680+ }
 1681+
 1682+ $message = wfMessage( "accesskey-$name" );
 1683+
 1684+ if ( !$message->exists() ) {
16791685 $accesskey = false;
16801686 } else {
1681 - $accesskey = wfMsg( "accesskey-$name" );
 1687+ $accesskey = $message->plain();
16821688 if ( $accesskey === '' || $accesskey === '-' ) {
16831689 # FIXME: Per standard MW behavior, a value of '-' means to suppress the
16841690 # attribute, but this is broken for accesskey: that might be a useful
@@ -1687,7 +1693,7 @@
16881694 }
16891695
16901696 wfProfileOut( __METHOD__ );
1691 - return $accesskey;
 1697+ return $this->accesskeycache[$name] = $accesskey;
16921698 }
16931699
16941700 /**

Sign-offs

UserFlagDate
Happy-meloninspected21:24, 23 March 2011

Status & tagging log