Index: trunk/extensions/GlobalUsage/SpecialGlobalUsage.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | global $wgOut, $wgRequest; |
19 | 19 | |
20 | 20 | $target = $par ? $par : $wgRequest->getVal( 'target' ); |
21 | | - $this->target = Title::newFromText( $target, NS_FILE ); |
| 21 | + $this->target = Title::makeTitleSafe( NS_FILE, $target ); |
22 | 22 | |
23 | 23 | $this->filterLocal = $wgRequest->getCheck( 'filterlocal' ); |
24 | 24 | |
— | — | @@ -127,7 +127,8 @@ |
128 | 128 | str_replace( '_', ' ', $page ) ); |
129 | 129 | } |
130 | 130 | |
131 | | - |
| 131 | + |
| 132 | + private static $queryCache = array(); |
132 | 133 | /** |
133 | 134 | * Get an executed query for use on image pages |
134 | 135 | * |
— | — | @@ -135,18 +136,20 @@ |
136 | 137 | * @return GlobalUsageQuery Query object, already executed |
137 | 138 | */ |
138 | 139 | private static function getImagePageQuery( $title ) { |
139 | | - static $queryCache = array(); |
140 | | - |
141 | 140 | $name = $title->getDBkey(); |
142 | | - if ( !isset( $queryCache[$name] ) ) { |
| 141 | + if ( !isset( self::$queryCache[$name] ) ) { |
143 | 142 | $query = new GlobalUsageQuery( $title ); |
144 | | - $query->filterLocal(); |
| 143 | + //$query->filterLocal(); |
145 | 144 | $query->execute(); |
146 | 145 | |
147 | | - $queryCache[$name] = $query; |
| 146 | + self::$queryCache[$name] = $query; |
| 147 | + |
| 148 | + // Limit cache size to 100 |
| 149 | + if ( count( self::$queryCache ) > 100 ) |
| 150 | + array_shift( self::$queryCache ); |
148 | 151 | } |
149 | 152 | |
150 | | - return $queryCache[$name]; |
| 153 | + return self::$queryCache[$name]; |
151 | 154 | } |
152 | 155 | |
153 | 156 | public static function onImagePageAfterImageLinks( $imagePage, &$html ) { |