Index: trunk/extensions/GlobalBlocking/GlobalBlocking.class.php |
— | — | @@ -25,6 +25,11 @@ |
26 | 26 | } |
27 | 27 | |
28 | 28 | static function getUserBlockErrors( $user, $ip ) { |
| 29 | + static $result = null; |
| 30 | + |
| 31 | + // Instance cache |
| 32 | + if (!is_null($result)) return $result; |
| 33 | + |
29 | 34 | $dbr = GlobalBlocking::getGlobalBlockingSlave(); |
30 | 35 | |
31 | 36 | $hex_ip = IP::toHex( $ip ); |
— | — | @@ -46,12 +51,12 @@ |
47 | 52 | // Check for local whitelisting |
48 | 53 | if (GlobalBlocking::getWhitelistInfo( $block->gb_id ) ) { |
49 | 54 | // Block has been whitelisted. |
50 | | - return array(); |
| 55 | + return $result = array(); |
51 | 56 | } |
52 | 57 | |
53 | 58 | if ( $user->isAllowed( 'ipblock-exempt' ) ) { |
54 | 59 | // User is exempt from IP blocks. |
55 | | - return array(); |
| 60 | + return $result = array(); |
56 | 61 | } |
57 | 62 | |
58 | 63 | $expiry = Block::formatExpiry( $block->gb_expiry ); |
— | — | @@ -61,9 +66,9 @@ |
62 | 67 | $display_wiki = self::getWikiName( $block->gb_by_wiki ); |
63 | 68 | $user_display = self::maybeLinkUserpage( $block->gb_by_wiki, $block->gb_by ); |
64 | 69 | |
65 | | - return array('globalblocking-blocked', $user_display, $display_wiki, $block->gb_reason, $expiry); |
| 70 | + return $result = array('globalblocking-blocked', $user_display, $display_wiki, $block->gb_reason, $expiry); |
66 | 71 | } |
67 | | - return array(); |
| 72 | + return $result = array(); |
68 | 73 | } |
69 | 74 | |
70 | 75 | static function getGlobalBlockingMaster() { |
— | — | @@ -262,4 +267,4 @@ |
263 | 268 | |
264 | 269 | return array(); |
265 | 270 | } |
266 | | -} |
\ No newline at end of file |
| 271 | +} |