Cleanup a few unused globals
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
1 <?php
2 /**
3 * Implements Special:Movepage
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page that allows users to change page titles
26 *
27 * @ingroup SpecialPage
28 */
29 class MovePageForm extends UnlistedSpecialPage {
30
31 /**
32 * @var Title
33 */
34 var $oldTitle, $newTitle; # Objects
35 var $reason; # Text input
36 var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; # Checks
37
38 private $watch = false;
39
40 public function __construct() {
41 parent::__construct( 'Movepage' );
42 }
43
44 public function execute( $par ) {
45 $this->checkReadOnly();
46
47 $this->setHeaders();
48 $this->outputHeader();
49
50 $request = $this->getRequest();
51 $target = !is_null( $par ) ? $par : $request->getVal( 'target' );
52
53 // Yes, the use of getVal() and getText() is wanted, see bug 20365
54
55 $oldTitleText = $request->getVal( 'wpOldTitle', $target );
56 $this->oldTitle = Title::newFromText( $oldTitleText );
57
58 $newTitleTextMain = $request->getText( 'wpNewTitleMain' );
59 $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle->getNamespace() );
60 // Backwards compatibility for forms submitting here from other sources
61 // which is more common than it should be..
62 $newTitleText_bc = $request->getText( 'wpNewTitle' );
63 $this->newTitle = strlen( $newTitleText_bc ) > 0
64 ? Title::newFromText( $newTitleText_bc )
65 : Title::makeTitleSafe( $newTitleTextNs, $newTitleTextMain );
66
67 if( is_null( $this->oldTitle ) ) {
68 throw new ErrorPageError( 'notargettitle', 'notargettext' );
69 }
70 if( !$this->oldTitle->exists() ) {
71 throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
72 }
73
74 $user = $this->getUser();
75
76 # Check rights
77 $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user );
78 if ( count( $permErrors ) ) {
79 // Auto-block user's IP if the account was "hard" blocked
80 $user->spreadAnyEditBlock();
81 throw new PermissionsError( 'move', $permErrors );
82 }
83
84 $def = !$request->wasPosted();
85
86 $this->reason = $request->getText( 'wpReason' );
87 $this->moveTalk = $request->getBool( 'wpMovetalk', $def );
88 $this->fixRedirects = $request->getBool( 'wpFixRedirects', $def );
89 $this->leaveRedirect = $request->getBool( 'wpLeaveRedirect', $def );
90 $this->moveSubpages = $request->getBool( 'wpMovesubpages', false );
91 $this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' );
92 $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile', false );
93 $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
94
95 if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
96 && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
97 $this->doSubmit();
98 } else {
99 $this->showForm( array() );
100 }
101 }
102
103 /**
104 * Show the form
105 *
106 * @param $err Array: error messages. Each item is an error message.
107 * It may either be a string message name or array message name and
108 * parameters, like the second argument to OutputPage::wrapWikiMsg().
109 */
110 function showForm( $err ) {
111 global $wgContLang, $wgFixDoubleRedirects, $wgMaximumMovedPages;
112
113 $this->getSkin()->setRelevantTitle( $this->oldTitle );
114
115 $oldTitleLink = Linker::link( $this->oldTitle );
116
117 $out = $this->getOutput();
118 $out->setPageTitle( $this->msg( 'move-page', $this->oldTitle->getPrefixedText() ) );
119 $out->addModules( 'mediawiki.special.movePage' );
120
121 $newTitle = $this->newTitle;
122
123 if ( !$newTitle ) {
124 # Show the current title as a default
125 # when the form is first opened.
126 $newTitle = $this->oldTitle;
127 } elseif ( !count( $err ) ) {
128 # If a title was supplied, probably from the move log revert
129 # link, check for validity. We can then show some diagnostic
130 # information and save a click.
131 $newerr = $this->oldTitle->isValidMoveOperation( $newTitle );
132 if( is_array( $newerr ) ) {
133 $err = $newerr;
134 }
135 }
136
137 $user = $this->getUser();
138
139 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists'
140 && $newTitle->quickUserCan( 'delete', $user )
141 ) {
142 $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
143 $movepagebtn = wfMsg( 'delete_and_move' );
144 $submitVar = 'wpDeleteAndMove';
145 $confirm = "
146 <tr>
147 <td></td>
148 <td class='mw-input'>" .
149 Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) .
150 "</td>
151 </tr>";
152 $err = array();
153 } else {
154 if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
155 $out->wrapWikiMsg( "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>", 'moveuserpage-warning' );
156 }
157 $out->addWikiMsg( $wgFixDoubleRedirects ? 'movepagetext' :
158 'movepagetext-noredirectfixer' );
159 $movepagebtn = wfMsg( 'movepagebtn' );
160 $submitVar = 'wpMove';
161 $confirm = false;
162 }
163
164 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
165 && $user->isAllowed( 'reupload-shared' )
166 ) {
167 $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
168 $submitVar = 'wpMoveOverSharedFile';
169 $err = array();
170 }
171
172 $oldTalk = $this->oldTitle->getTalkPage();
173 $oldTitleSubpages = $this->oldTitle->hasSubpages();
174 $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
175
176 $canMoveSubpage = ( $oldTitleSubpages || $oldTitleTalkSubpages ) &&
177 !count( $this->oldTitle->getUserPermissionsErrors( 'move-subpages', $user ) );
178
179 # We also want to be able to move assoc. subpage talk-pages even if base page
180 # has no associated talk page, so || with $oldTitleTalkSubpages.
181 $considerTalk = !$this->oldTitle->isTalkPage() &&
182 ( $oldTalk->exists()
183 || ( $oldTitleTalkSubpages && $canMoveSubpage ) );
184
185 $dbr = wfGetDB( DB_SLAVE );
186 if ( $wgFixDoubleRedirects ) {
187 $hasRedirects = $dbr->selectField( 'redirect', '1',
188 array(
189 'rd_namespace' => $this->oldTitle->getNamespace(),
190 'rd_title' => $this->oldTitle->getDBkey(),
191 ) , __METHOD__ );
192 } else {
193 $hasRedirects = false;
194 }
195
196 if ( $considerTalk ) {
197 $out->addWikiMsg( 'movepagetalktext' );
198 }
199
200 if ( count( $err ) ) {
201 $out->addHTML( "<div class='error'>\n" );
202 $action_desc = $this->msg( 'action-move' )->plain();
203 $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc );
204
205 if ( count( $err ) == 1 ) {
206 $errMsg = $err[0];
207 $errMsgName = array_shift( $errMsg );
208 if ( $errMsgName == 'hookaborted' ) {
209 $out->addHTML( "<p>{$errMsg[0]}</p>\n" );
210 } else {
211 $out->addWikiMsgArray( $errMsgName, $errMsg );
212 }
213 } else {
214 $errStr = array();
215 foreach( $err as $errMsg ) {
216 if( $errMsg[0] == 'hookaborted' ) {
217 $errStr[] = $errMsg[1];
218 } else {
219 $errMsgName = array_shift( $errMsg );
220 $errStr[] = $this->msg( $errMsgName, $errMsg )->parse();
221 }
222 }
223
224 $out->addHTML( '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n" );
225 }
226 $out->addHTML( "</div>\n" );
227 }
228
229 if ( $this->oldTitle->isProtected( 'move' ) ) {
230 # Is the title semi-protected?
231 if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
232 $noticeMsg = 'semiprotectedpagemovewarning';
233 $classes[] = 'mw-textarea-sprotected';
234 } else {
235 # Then it must be protected based on static groups (regular)
236 $noticeMsg = 'protectedpagemovewarning';
237 $classes[] = 'mw-textarea-protected';
238 }
239 $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
240 $out->addWikiMsg( $noticeMsg );
241 LogEventsList::showLogExtract( $out, 'protect', $this->oldTitle, '', array( 'lim' => 1 ) );
242 $out->addHTML( "</div>\n" );
243 }
244
245 // Byte limit (not string length limit) for wpReason and wpNewTitleMain
246 // is enforced in the mediawiki.special.movePage module
247
248 $out->addHTML(
249 Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
250 Xml::openElement( 'fieldset' ) .
251 Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
252 Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
253 "<tr>
254 <td class='mw-label'>" .
255 wfMsgHtml( 'movearticle' ) .
256 "</td>
257 <td class='mw-input'>
258 <strong>{$oldTitleLink}</strong>
259 </td>
260 </tr>
261 <tr>
262 <td class='mw-label'>" .
263 Xml::label( wfMsg( 'newtitle' ), 'wpNewTitleMain' ) .
264 "</td>
265 <td class='mw-input'>" .
266 Html::namespaceSelector(
267 array( 'selected' => $newTitle->getNamespace() ),
268 array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' )
269 ) .
270 Xml::input( 'wpNewTitleMain', 60, $wgContLang->recodeForEdit( $newTitle->getText() ), array(
271 'type' => 'text',
272 'id' => 'wpNewTitleMain',
273 'maxlength' => 255,
274 ) ) .
275 Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
276 "</td>
277 </tr>
278 <tr>
279 <td class='mw-label'>" .
280 Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
281 "</td>
282 <td class='mw-input'>" .
283 Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
284 'maxlength' => 200 ), $this->reason ) .
285 "</td>
286 </tr>"
287 );
288
289 if( $considerTalk ) {
290 $out->addHTML( "
291 <tr>
292 <td></td>
293 <td class='mw-input'>" .
294 Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
295 "</td>
296 </tr>"
297 );
298 }
299
300 if ( $user->isAllowed( 'suppressredirect' ) ) {
301 $out->addHTML( "
302 <tr>
303 <td></td>
304 <td class='mw-input' >" .
305 Xml::checkLabel( wfMsg( 'move-leave-redirect' ), 'wpLeaveRedirect',
306 'wpLeaveRedirect', $this->leaveRedirect ) .
307 "</td>
308 </tr>"
309 );
310 }
311
312 if ( $hasRedirects ) {
313 $out->addHTML( "
314 <tr>
315 <td></td>
316 <td class='mw-input' >" .
317 Xml::checkLabel( wfMsg( 'fix-double-redirects' ), 'wpFixRedirects',
318 'wpFixRedirects', $this->fixRedirects ) .
319 "</td>
320 </tr>"
321 );
322 }
323
324 if( $canMoveSubpage ) {
325 $out->addHTML( "
326 <tr>
327 <td></td>
328 <td class=\"mw-input\">" .
329 Xml::check(
330 'wpMovesubpages',
331 # Don't check the box if we only have talk subpages to
332 # move and we aren't moving the talk page.
333 $this->moveSubpages && ($this->oldTitle->hasSubpages() || $this->moveTalk),
334 array( 'id' => 'wpMovesubpages' )
335 ) . '&#160;' .
336 Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
337 wfMsgExt(
338 ( $this->oldTitle->hasSubpages()
339 ? 'move-subpages'
340 : 'move-talk-subpages' ),
341 array( 'parseinline' ),
342 $this->getLanguage()->formatNum( $wgMaximumMovedPages ),
343 # $2 to allow use of PLURAL in message.
344 $wgMaximumMovedPages
345 )
346 ) .
347 "</td>
348 </tr>"
349 );
350 }
351
352 $watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption( 'watchmoves' )
353 || $this->oldTitle->userIsWatching());
354 # Don't allow watching if user is not logged in
355 if( $user->isLoggedIn() ) {
356 $out->addHTML( "
357 <tr>
358 <td></td>
359 <td class='mw-input'>" .
360 Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
361 "</td>
362 </tr>");
363 }
364
365 $out->addHTML( "
366 {$confirm}
367 <tr>
368 <td>&#160;</td>
369 <td class='mw-submit'>" .
370 Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) .
371 "</td>
372 </tr>" .
373 Xml::closeElement( 'table' ) .
374 Html::hidden( 'wpEditToken', $user->getEditToken() ) .
375 Xml::closeElement( 'fieldset' ) .
376 Xml::closeElement( 'form' ) .
377 "\n"
378 );
379
380 $this->showLogFragment( $this->oldTitle );
381 $this->showSubpages( $this->oldTitle );
382
383 }
384
385 function doSubmit() {
386 global $wgMaximumMovedPages, $wgFixDoubleRedirects;
387
388 $user = $this->getUser();
389
390 if ( $user->pingLimiter( 'move' ) ) {
391 throw new ThrottledError;
392 }
393
394 $ot = $this->oldTitle;
395 $nt = $this->newTitle;
396
397 # don't allow moving to pages with # in
398 if ( !$nt || $nt->getFragment() != '' ) {
399 $this->showForm( array( array( 'badtitletext' ) ) );
400 return;
401 }
402
403 # Show a warning if the target file exists on a shared repo
404 if ( $nt->getNamespace() == NS_FILE
405 && !( $this->moveOverShared && $user->isAllowed( 'reupload-shared' ) )
406 && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
407 && wfFindFile( $nt ) )
408 {
409 $this->showForm( array( array( 'file-exists-sharedrepo' ) ) );
410 return;
411
412 }
413
414 # Delete to make way if requested
415 if ( $this->deleteAndMove ) {
416 $permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
417 if ( count( $permErrors ) ) {
418 # Only show the first error
419 $this->showForm( $permErrors );
420 return;
421 }
422
423 $reason = wfMessage( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
424
425 // Delete an associated image if there is
426 if ( $nt->getNamespace() == NS_FILE ) {
427 $file = wfLocalFile( $nt );
428 if ( $file->exists() ) {
429 $file->delete( $reason, false );
430 }
431 }
432
433 $error = ''; // passed by ref
434 $page = WikiPage::factory( $nt );
435 if ( !$page->doDeleteArticle( $reason, false, 0, true, $error, $user ) ) {
436 $this->showForm( array( array( 'cannotdelete', wfEscapeWikiText( $nt->getPrefixedText() ) ) ) );
437 return;
438 }
439 }
440
441 if ( $user->isAllowed( 'suppressredirect' ) ) {
442 $createRedirect = $this->leaveRedirect;
443 } else {
444 $createRedirect = true;
445 }
446
447 # Do the actual move.
448 $error = $ot->moveTo( $nt, true, $this->reason, $createRedirect );
449 if ( $error !== true ) {
450 $this->showForm( $error );
451 return;
452 }
453
454 if ( $wgFixDoubleRedirects && $this->fixRedirects ) {
455 DoubleRedirectJob::fixRedirects( 'move', $ot, $nt );
456 }
457
458 wfRunHooks( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
459
460 $out = $this->getOutput();
461 $out->setPageTitle( $this->msg( 'pagemovedsub' ) );
462
463 $oldLink = Linker::link(
464 $ot,
465 null,
466 array(),
467 array( 'redirect' => 'no' )
468 );
469 $newLink = Linker::linkKnown( $nt );
470 $oldText = $ot->getPrefixedText();
471 $newText = $nt->getPrefixedText();
472
473 $msgName = $createRedirect ? 'movepage-moved-redirect' : 'movepage-moved-noredirect';
474 $out->addHTML( wfMessage( 'movepage-moved' )->rawParams( $oldLink, $newLink, $oldText, $newText )->parseAsBlock() );
475 $out->addWikiMsg( $msgName );
476
477 # Now we move extra pages we've been asked to move: subpages and talk
478 # pages. First, if the old page or the new page is a talk page, we
479 # can't move any talk pages: cancel that.
480 if( $ot->isTalkPage() || $nt->isTalkPage() ) {
481 $this->moveTalk = false;
482 }
483
484 if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) {
485 $this->moveSubpages = false;
486 }
487
488 # Next make a list of id's. This might be marginally less efficient
489 # than a more direct method, but this is not a highly performance-cri-
490 # tical code path and readable code is more important here.
491 #
492 # Note: this query works nicely on MySQL 5, but the optimizer in MySQL
493 # 4 might get confused. If so, consider rewriting as a UNION.
494 #
495 # If the target namespace doesn't allow subpages, moving with subpages
496 # would mean that you couldn't move them back in one operation, which
497 # is bad.
498 # @todo FIXME: A specific error message should be given in this case.
499
500 // @todo FIXME: Use Title::moveSubpages() here
501 $dbr = wfGetDB( DB_MASTER );
502 if( $this->moveSubpages && (
503 MWNamespace::hasSubpages( $nt->getNamespace() ) || (
504 $this->moveTalk &&
505 MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
506 )
507 ) ) {
508 $conds = array(
509 'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
510 .' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
511 );
512 $conds['page_namespace'] = array();
513 if( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
514 $conds['page_namespace'] []= $ot->getNamespace();
515 }
516 if( $this->moveTalk && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() ) ) {
517 $conds['page_namespace'] []= $ot->getTalkPage()->getNamespace();
518 }
519 } elseif( $this->moveTalk ) {
520 $conds = array(
521 'page_namespace' => $ot->getTalkPage()->getNamespace(),
522 'page_title' => $ot->getDBkey()
523 );
524 } else {
525 # Skip the query
526 $conds = null;
527 }
528
529 $extraPages = array();
530 if( !is_null( $conds ) ) {
531 $extraPages = TitleArray::newFromResult(
532 $dbr->select( 'page',
533 array( 'page_id', 'page_namespace', 'page_title' ),
534 $conds,
535 __METHOD__
536 )
537 );
538 }
539
540 $extraOutput = array();
541 $count = 1;
542 foreach( $extraPages as $oldSubpage ) {
543 if( $ot->equals( $oldSubpage ) ) {
544 # Already did this one.
545 continue;
546 }
547
548 $newPageName = preg_replace(
549 '#^'.preg_quote( $ot->getDBkey(), '#' ).'#',
550 StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
551 $oldSubpage->getDBkey()
552 );
553 if( $oldSubpage->isTalkPage() ) {
554 $newNs = $nt->getTalkPage()->getNamespace();
555 } else {
556 $newNs = $nt->getSubjectPage()->getNamespace();
557 }
558 # Bug 14385: we need makeTitleSafe because the new page names may
559 # be longer than 255 characters.
560 $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
561 if( !$newSubpage ) {
562 $oldLink = Linker::linkKnown( $oldSubpage );
563 $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
564 htmlspecialchars(Title::makeName( $newNs, $newPageName )));
565 continue;
566 }
567
568 # This was copy-pasted from Renameuser, bleh.
569 if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
570 $link = Linker::linkKnown( $newSubpage );
571 $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
572 } else {
573 $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
574 if( $success === true ) {
575 if ( $this->fixRedirects ) {
576 DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
577 }
578 $oldLink = Linker::link(
579 $oldSubpage,
580 null,
581 array(),
582 array( 'redirect' => 'no' )
583 );
584 $newLink = Linker::linkKnown( $newSubpage );
585 $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
586 ++$count;
587 if( $count >= $wgMaximumMovedPages ) {
588 $extraOutput []= wfMsgExt( 'movepage-max-pages', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $wgMaximumMovedPages ) );
589 break;
590 }
591 } else {
592 $oldLink = Linker::linkKnown( $oldSubpage );
593 $newLink = Linker::link( $newSubpage );
594 $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
595 }
596 }
597
598 }
599
600 if( $extraOutput !== array() ) {
601 $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
602 }
603
604 # Deal with watches (we don't watch subpages)
605 if( $this->watch && $user->isLoggedIn() ) {
606 $user->addWatch( $ot );
607 $user->addWatch( $nt );
608 } else {
609 $user->removeWatch( $ot );
610 $user->removeWatch( $nt );
611 }
612
613 # Re-clear the file redirect cache, which may have been polluted by
614 # parsing in messages above. See CR r56745.
615 # @todo FIXME: Needs a more robust solution inside FileRepo.
616 if( $ot->getNamespace() == NS_FILE ) {
617 RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot );
618 }
619 }
620
621 function showLogFragment( $title ) {
622 $out = $this->getOutput();
623 $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
624 LogEventsList::showLogExtract( $out, 'move', $title );
625 }
626
627 function showSubpages( $title ) {
628 if( !MWNamespace::hasSubpages( $title->getNamespace() ) )
629 return;
630
631 $subpages = $title->getSubpages();
632 $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
633
634 $out = $this->getOutput();
635 $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
636
637 # No subpages.
638 if ( $count == 0 ) {
639 $out->addWikiMsg( 'movenosubpage' );
640 return;
641 }
642
643 $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) );
644 $out->addHTML( "<ul>\n" );
645
646 foreach( $subpages as $subpage ) {
647 $link = Linker::link( $subpage );
648 $out->addHTML( "<li>$link</li>\n" );
649 }
650 $out->addHTML( "</ul>\n" );
651 }
652 }