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