Index: trunk/phase3/includes/logging/LogPager.php |
— | — | @@ -297,6 +297,10 @@ |
298 | 298 | $lb->add( $row->log_namespace, $row->log_title ); |
299 | 299 | $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); |
300 | 300 | $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) ); |
| 301 | + $formatter = LogFormatter::newFromRow( $row ); |
| 302 | + foreach ( $formatter->getPreloadTitles() as $title ) { |
| 303 | + $lb->addObj( $title ); |
| 304 | + } |
301 | 305 | } |
302 | 306 | $lb->execute(); |
303 | 307 | $this->mResult->seek( 0 ); |
Index: trunk/phase3/includes/logging/LogFormatter.php |
— | — | @@ -153,25 +153,13 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | | - * Extract parameters intented for action message from |
158 | | - * array of all parameters. There are three hardcoded |
159 | | - * parameters (array zero-indexed, this list not): |
160 | | - * - 1: user name with premade link |
161 | | - * - 2: usable for gender magic function |
162 | | - * - 3: target page with premade link |
| 157 | + * Extracts the optional extra parameters for use in action messages. |
| 158 | + * The array indexes start from number 3. |
163 | 159 | * @return array |
164 | 160 | */ |
165 | | - protected function getMessageParameters() { |
166 | | - if ( isset( $this->parsedParameters ) ) { |
167 | | - return $this->parsedParameters; |
168 | | - } |
169 | | - |
| 161 | + protected function extractParameters() { |
170 | 162 | $entry = $this->entry; |
171 | | - |
172 | 163 | $params = array(); |
173 | | - $params[0] = Message::rawParam( $this->getPerformerElement() ); |
174 | | - $params[1] = $entry->getPerformer()->getName(); |
175 | | - $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) ); |
176 | 164 | |
177 | 165 | if ( $entry->isLegacy() ) { |
178 | 166 | foreach ( $entry->getParameters() as $index => $value ) { |
— | — | @@ -196,7 +184,31 @@ |
197 | 185 | $params[$i] = ''; |
198 | 186 | } |
199 | 187 | } |
| 188 | + return $params; |
| 189 | + } |
200 | 190 | |
| 191 | + /** |
| 192 | + * Formats parameters intented for action message from |
| 193 | + * array of all parameters. There are three hardcoded |
| 194 | + * parameters (array is zero-indexed, this list not): |
| 195 | + * - 1: user name with premade link |
| 196 | + * - 2: usable for gender magic function |
| 197 | + * - 3: target page with premade link |
| 198 | + * @return array |
| 199 | + */ |
| 200 | + protected function getMessageParameters() { |
| 201 | + if ( isset( $this->parsedParameters ) ) { |
| 202 | + return $this->parsedParameters; |
| 203 | + } |
| 204 | + |
| 205 | + $entry = $this->entry; |
| 206 | + $params = $this->extractParameters(); |
| 207 | + $params[0] = Message::rawParam( $this->getPerformerElement() ); |
| 208 | + $params[1] = $entry->getPerformer()->getName(); |
| 209 | + $params[2] = Message::rawParam( $this->makePageLink( $entry->getTarget() ) ); |
| 210 | + |
| 211 | + // Bad things happens if the numbers are not in correct order |
| 212 | + ksort( $params ); |
201 | 213 | return $this->parsedParameters = $params; |
202 | 214 | } |
203 | 215 | |
— | — | @@ -300,6 +312,13 @@ |
301 | 313 | return $element; |
302 | 314 | } |
303 | 315 | |
| 316 | + /** |
| 317 | + * @return Array of titles that should be preloaded with LinkBatch. |
| 318 | + */ |
| 319 | + public function getPreloadTitles() { |
| 320 | + return array(); |
| 321 | + } |
| 322 | + |
304 | 323 | } |
305 | 324 | |
306 | 325 | /** |
— | — | @@ -334,6 +353,11 @@ |
335 | 354 | * @since 1.19 |
336 | 355 | */ |
337 | 356 | class MoveLogFormatter extends LogFormatter { |
| 357 | + public function getPreloadTitles() { |
| 358 | + $params = $this->extractParameters(); |
| 359 | + return array( Title::newFromText( $params[3] ) ); |
| 360 | + } |
| 361 | + |
338 | 362 | protected function getMessageKey() { |
339 | 363 | $key = parent::getMessageKey(); |
340 | 364 | $params = $this->getMessageParameters(); |