3 * Implements Special:Movepage
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.
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.
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
21 * @ingroup SpecialPage
25 * A special page that allows users to change page titles
27 * @ingroup SpecialPage
29 class MovePageForm
extends UnlistedSpecialPage
{
31 protected $oldTitle = null;
36 /** @var string Text input */
45 protected $deleteAndMove;
48 protected $moveSubpages;
51 protected $fixRedirects;
54 protected $leaveRedirect;
57 protected $moveOverShared;
59 private $watch = false;
61 public function __construct() {
62 parent
::__construct( 'Movepage' );
65 public function execute( $par ) {
66 $this->useTransactionalTimeLimit();
68 $this->checkReadOnly();
71 $this->outputHeader();
73 $request = $this->getRequest();
74 $target = !is_null( $par ) ?
$par : $request->getVal( 'target' );
76 // Yes, the use of getVal() and getText() is wanted, see bug 20365
78 $oldTitleText = $request->getVal( 'wpOldTitle', $target );
79 $this->oldTitle
= Title
::newFromText( $oldTitleText );
81 if ( !$this->oldTitle
) {
82 // Either oldTitle wasn't passed, or newFromText returned null
83 throw new ErrorPageError( 'notargettitle', 'notargettext' );
85 if ( !$this->oldTitle
->exists() ) {
86 throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
89 $newTitleTextMain = $request->getText( 'wpNewTitleMain' );
90 $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle
->getNamespace() );
91 // Backwards compatibility for forms submitting here from other sources
92 // which is more common than it should be..
93 $newTitleText_bc = $request->getText( 'wpNewTitle' );
94 $this->newTitle
= strlen( $newTitleText_bc ) > 0
95 ? Title
::newFromText( $newTitleText_bc )
96 : Title
::makeTitleSafe( $newTitleTextNs, $newTitleTextMain );
98 $user = $this->getUser();
101 $permErrors = $this->oldTitle
->getUserPermissionsErrors( 'move', $user );
102 if ( count( $permErrors ) ) {
103 // Auto-block user's IP if the account was "hard" blocked
104 DeferredUpdates
::addCallableUpdate( function() use ( $user ) {
105 $user->spreadAnyEditBlock();
107 throw new PermissionsError( 'move', $permErrors );
110 $def = !$request->wasPosted();
112 $this->reason
= $request->getText( 'wpReason' );
113 $this->moveTalk
= $request->getBool( 'wpMovetalk', $def );
114 $this->fixRedirects
= $request->getBool( 'wpFixRedirects', $def );
115 $this->leaveRedirect
= $request->getBool( 'wpLeaveRedirect', $def );
116 $this->moveSubpages
= $request->getBool( 'wpMovesubpages', false );
117 $this->deleteAndMove
= $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' );
118 $this->moveOverShared
= $request->getBool( 'wpMoveOverSharedFile', false );
119 $this->watch
= $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
121 if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
122 && $user->matchEditToken( $request->getVal( 'wpEditToken' ) )
126 $this->showForm( array() );
133 * @param array $err Error messages. Each item is an error message.
134 * It may either be a string message name or array message name and
135 * parameters, like the second argument to OutputPage::wrapWikiMsg().
137 function showForm( $err ) {
140 $this->getSkin()->setRelevantTitle( $this->oldTitle
);
142 $out = $this->getOutput();
143 $out->setPageTitle( $this->msg( 'move-page', $this->oldTitle
->getPrefixedText() ) );
144 $out->addModules( 'mediawiki.special.movePage' );
145 $out->addModuleStyles( 'mediawiki.special.movePage.styles' );
146 $this->addHelpLink( 'Help:Moving a page' );
148 if ( $this->oldTitle
->getNamespace() == NS_USER
&& !$this->oldTitle
->isSubpage() ) {
150 "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
151 'moveuserpage-warning'
153 } elseif ( $this->oldTitle
->getNamespace() == NS_CATEGORY
) {
155 "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
156 'movecategorypage-warning'
160 $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
162 'movepagetext-noredirectfixer'
164 $submitVar = 'wpMove';
167 $newTitle = $this->newTitle
;
170 # Show the current title as a default
171 # when the form is first opened.
172 $newTitle = $this->oldTitle
;
173 } elseif ( !count( $err ) ) {
174 # If a title was supplied, probably from the move log revert
175 # link, check for validity. We can then show some diagnostic
176 # information and save a click.
177 $newerr = $this->oldTitle
->isValidMoveOperation( $newTitle );
178 if ( is_array( $newerr ) ) {
183 $user = $this->getUser();
185 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists'
186 && $newTitle->quickUserCan( 'delete', $user )
188 $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
189 $submitVar = 'wpDeleteAndMove';
194 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
195 && $user->isAllowed( 'reupload-shared' )
197 $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
198 $submitVar = 'wpMoveOverSharedFile';
202 $oldTalk = $this->oldTitle
->getTalkPage();
203 $oldTitleSubpages = $this->oldTitle
->hasSubpages();
204 $oldTitleTalkSubpages = $this->oldTitle
->getTalkPage()->hasSubpages();
206 $canMoveSubpage = ( $oldTitleSubpages ||
$oldTitleTalkSubpages ) &&
207 !count( $this->oldTitle
->getUserPermissionsErrors( 'move-subpages', $user ) );
209 # We also want to be able to move assoc. subpage talk-pages even if base page
210 # has no associated talk page, so || with $oldTitleTalkSubpages.
211 $considerTalk = !$this->oldTitle
->isTalkPage() &&
213 ||
( $oldTitleTalkSubpages && $canMoveSubpage ) );
215 $dbr = wfGetDB( DB_SLAVE
);
216 if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) {
217 $hasRedirects = $dbr->selectField( 'redirect', '1',
219 'rd_namespace' => $this->oldTitle
->getNamespace(),
220 'rd_title' => $this->oldTitle
->getDBkey(),
223 $hasRedirects = false;
226 if ( count( $err ) ) {
227 $out->addHTML( "<div class='error'>\n" );
228 $action_desc = $this->msg( 'action-move' )->plain();
229 $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc );
231 if ( count( $err ) == 1 ) {
233 $errMsgName = array_shift( $errMsg );
235 if ( $errMsgName == 'hookaborted' ) {
236 $out->addHTML( "<p>{$errMsg[0]}</p>\n" );
238 $out->addWikiMsgArray( $errMsgName, $errMsg );
243 foreach ( $err as $errMsg ) {
244 if ( $errMsg[0] == 'hookaborted' ) {
245 $errStr[] = $errMsg[1];
247 $errMsgName = array_shift( $errMsg );
248 $errStr[] = $this->msg( $errMsgName, $errMsg )->parse();
252 $out->addHTML( '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n" );
254 $out->addHTML( "</div>\n" );
257 if ( $this->oldTitle
->isProtected( 'move' ) ) {
258 # Is the title semi-protected?
259 if ( $this->oldTitle
->isSemiProtected( 'move' ) ) {
260 $noticeMsg = 'semiprotectedpagemovewarning';
261 $classes[] = 'mw-textarea-sprotected';
263 # Then it must be protected based on static groups (regular)
264 $noticeMsg = 'protectedpagemovewarning';
265 $classes[] = 'mw-textarea-protected';
267 $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
268 $out->addWikiMsg( $noticeMsg );
269 LogEventsList
::showLogExtract(
276 $out->addHTML( "</div>\n" );
279 // Byte limit (not string length limit) for wpReason and wpNewTitleMain
280 // is enforced in the mediawiki.special.movePage module
282 $immovableNamespaces = array();
283 foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
284 if ( !MWNamespace
::isMovable( $nsId ) ) {
285 $immovableNamespaces[] = $nsId;
289 $handler = ContentHandler
::getForTitle( $this->oldTitle
);
294 $fields[] = new OOUI\
FieldLayout(
295 new MediaWiki\Widget\
ComplexTitleInputWidget( array(
296 'id' => 'wpNewTitle',
297 'namespace' => array(
298 'id' => 'wpNewTitleNs',
299 'name' => 'wpNewTitleNs',
300 'value' => $newTitle->getNamespace(),
301 'exclude' => $immovableNamespaces,
304 'id' => 'wpNewTitleMain',
305 'name' => 'wpNewTitleMain',
306 'value' => $wgContLang->recodeForEdit( $newTitle->getText() ),
307 // Inappropriate, since we're expecting the user to input a non-existent page's title
308 'suggestions' => false,
313 'label' => $this->msg( 'newtitle' )->text(),
318 $fields[] = new OOUI\
FieldLayout(
319 new OOUI\
TextInputWidget( array(
320 'name' => 'wpReason',
324 'value' => $this->reason
,
327 'label' => $this->msg( 'movereason' )->text(),
332 if ( $considerTalk ) {
333 $fields[] = new OOUI\
FieldLayout(
334 new OOUI\
CheckboxInputWidget( array(
335 'name' => 'wpMovetalk',
336 'id' => 'wpMovetalk',
338 'selected' => $this->moveTalk
,
341 'label' => $this->msg( 'movetalk' )->text(),
342 'help' => new OOUI\
HtmlSnippet( $this->msg( 'movepagetalktext' )->parseAsBlock() ),
349 if ( $user->isAllowed( 'suppressredirect' ) ) {
350 if ( $handler->supportsRedirects() ) {
351 $isChecked = $this->leaveRedirect
;
357 $fields[] = new OOUI\
FieldLayout(
358 new OOUI\
CheckboxInputWidget( array(
359 'name' => 'wpLeaveRedirect',
360 'id' => 'wpLeaveRedirect',
362 'selected' => $isChecked,
363 'disabled' => $isDisabled,
366 'label' => $this->msg( 'move-leave-redirect' )->text(),
372 if ( $hasRedirects ) {
373 $fields[] = new OOUI\
FieldLayout(
374 new OOUI\
CheckboxInputWidget( array(
375 'name' => 'wpFixRedirects',
376 'id' => 'wpFixRedirects',
378 'selected' => $this->fixRedirects
,
381 'label' => $this->msg( 'fix-double-redirects' )->text(),
387 if ( $canMoveSubpage ) {
388 $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' );
389 $fields[] = new OOUI\
FieldLayout(
390 new OOUI\
CheckboxInputWidget( array(
391 'name' => 'wpMovesubpages',
392 'id' => 'wpMovesubpages',
394 # Don't check the box if we only have talk subpages to
395 # move and we aren't moving the talk page.
396 'selected' => $this->moveSubpages
&& ( $this->oldTitle
->hasSubpages() ||
$this->moveTalk
),
399 'label' => new OOUI\
HtmlSnippet(
401 ( $this->oldTitle
->hasSubpages()
403 : 'move-talk-subpages' )
404 )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse()
411 # Don't allow watching if user is not logged in
412 if ( $user->isLoggedIn() ) {
413 $watchChecked = $user->isLoggedIn() && ( $this->watch ||
$user->getBoolOption( 'watchmoves' )
414 ||
$user->isWatched( $this->oldTitle
) );
415 $fields[] = new OOUI\
FieldLayout(
416 new OOUI\
CheckboxInputWidget( array(
418 'id' => 'watch', # ew
420 'selected' => $watchChecked,
423 'label' => $this->msg( 'move-watch' )->text(),
430 $fields[] = new OOUI\
FieldLayout(
431 new OOUI\
CheckboxInputWidget( array(
432 'name' => 'wpConfirm',
437 'label' => $this->msg( 'delete_and_move_confirm' )->text(),
443 $fields[] = new OOUI\
FieldLayout(
444 new OOUI\
ButtonInputWidget( array(
445 'name' => $submitVar,
446 'value' => $this->msg( 'movepagebtn' )->text(),
447 'label' => $this->msg( 'movepagebtn' )->text(),
448 'flags' => array( 'constructive', 'primary' ),
456 $fieldset = new OOUI\
FieldsetLayout( array(
457 'label' => $this->msg( 'move-page-legend' )->text(),
458 'id' => 'mw-movepage-table',
462 $form = new OOUI\
FormLayout( array(
464 'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ),
467 $form->appendContent(
469 new OOUI\
HtmlSnippet(
470 Html
::hidden( 'wpOldTitle', $this->oldTitle
->getPrefixedText() ) .
471 Html
::hidden( 'wpEditToken', $user->getEditToken() )
476 new OOUI\
PanelLayout( array(
477 'classes' => array( 'movepage-wrapper' ),
485 $this->showLogFragment( $this->oldTitle
);
486 $this->showSubpages( $this->oldTitle
);
489 function doSubmit() {
490 $user = $this->getUser();
492 if ( $user->pingLimiter( 'move' ) ) {
493 throw new ThrottledError
;
496 $ot = $this->oldTitle
;
497 $nt = $this->newTitle
;
499 # don't allow moving to pages with # in
500 if ( !$nt ||
$nt->hasFragment() ) {
501 $this->showForm( array( array( 'badtitletext' ) ) );
506 # Show a warning if the target file exists on a shared repo
507 if ( $nt->getNamespace() == NS_FILE
508 && !( $this->moveOverShared
&& $user->isAllowed( 'reupload-shared' ) )
509 && !RepoGroup
::singleton()->getLocalRepo()->findFile( $nt )
512 $this->showForm( array( array( 'file-exists-sharedrepo' ) ) );
517 # Delete to make way if requested
518 if ( $this->deleteAndMove
) {
519 $permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
520 if ( count( $permErrors ) ) {
521 # Only show the first error
522 $this->showForm( $permErrors );
527 $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
529 // Delete an associated image if there is
530 if ( $nt->getNamespace() == NS_FILE
) {
531 $file = wfLocalFile( $nt );
532 $file->load( File
::READ_LATEST
);
533 if ( $file->exists() ) {
534 $file->delete( $reason, false, $user );
538 $error = ''; // passed by ref
539 $page = WikiPage
::factory( $nt );
540 $deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
541 if ( !$deleteStatus->isGood() ) {
542 $this->showForm( $deleteStatus->getErrorsArray() );
548 $handler = ContentHandler
::getForTitle( $ot );
550 if ( !$handler->supportsRedirects() ) {
551 $createRedirect = false;
552 } elseif ( $user->isAllowed( 'suppressredirect' ) ) {
553 $createRedirect = $this->leaveRedirect
;
555 $createRedirect = true;
558 # Do the actual move.
559 $mp = new MovePage( $ot, $nt );
560 $valid = $mp->isValidMove();
561 if ( !$valid->isOK() ) {
562 $this->showForm( $valid->getErrorsArray() );
566 $permStatus = $mp->checkPermissions( $user, $this->reason
);
567 if ( !$permStatus->isOK() ) {
568 $this->showForm( $permStatus->getErrorsArray() );
572 $status = $mp->move( $user, $this->reason
, $createRedirect );
573 if ( !$status->isOK() ) {
574 $this->showForm( $status->getErrorsArray() );
578 if ( $this->getConfig()->get( 'FixDoubleRedirects' ) && $this->fixRedirects
) {
579 DoubleRedirectJob
::fixRedirects( 'move', $ot, $nt );
582 $out = $this->getOutput();
583 $out->setPageTitle( $this->msg( 'pagemovedsub' ) );
585 $oldLink = Linker
::link(
588 array( 'id' => 'movepage-oldlink' ),
589 array( 'redirect' => 'no' )
591 $newLink = Linker
::linkKnown(
594 array( 'id' => 'movepage-newlink' )
596 $oldText = $ot->getPrefixedText();
597 $newText = $nt->getPrefixedText();
599 if ( $ot->exists() ) {
600 // NOTE: we assume that if the old title exists, it's because it was re-created as
601 // a redirect to the new title. This is not safe, but what we did before was
602 // even worse: we just determined whether a redirect should have been created,
603 // and reported that it was created if it should have, without any checks.
604 // Also note that isRedirect() is unreliable because of bug 37209.
605 $msgName = 'movepage-moved-redirect';
607 $msgName = 'movepage-moved-noredirect';
610 $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
611 $newLink )->params( $oldText, $newText )->parseAsBlock() );
612 $out->addWikiMsg( $msgName );
614 Hooks
::run( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
616 # Now we move extra pages we've been asked to move: subpages and talk
617 # pages. First, if the old page or the new page is a talk page, we
618 # can't move any talk pages: cancel that.
619 if ( $ot->isTalkPage() ||
$nt->isTalkPage() ) {
620 $this->moveTalk
= false;
623 if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) {
624 $this->moveSubpages
= false;
628 * Next make a list of id's. This might be marginally less efficient
629 * than a more direct method, but this is not a highly performance-cri-
630 * tical code path and readable code is more important here.
632 * If the target namespace doesn't allow subpages, moving with subpages
633 * would mean that you couldn't move them back in one operation, which
635 * @todo FIXME: A specific error message should be given in this case.
638 // @todo FIXME: Use Title::moveSubpages() here
639 $dbr = wfGetDB( DB_MASTER
);
640 if ( $this->moveSubpages
&& (
641 MWNamespace
::hasSubpages( $nt->getNamespace() ) ||
(
643 && MWNamespace
::hasSubpages( $nt->getTalkPage()->getNamespace() )
647 'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
648 . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
650 $conds['page_namespace'] = array();
651 if ( MWNamespace
::hasSubpages( $nt->getNamespace() ) ) {
652 $conds['page_namespace'][] = $ot->getNamespace();
654 if ( $this->moveTalk
&&
655 MWNamespace
::hasSubpages( $nt->getTalkPage()->getNamespace() )
657 $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
659 } elseif ( $this->moveTalk
) {
661 'page_namespace' => $ot->getTalkPage()->getNamespace(),
662 'page_title' => $ot->getDBkey()
669 $extraPages = array();
670 if ( !is_null( $conds ) ) {
671 $extraPages = TitleArray
::newFromResult(
672 $dbr->select( 'page',
673 array( 'page_id', 'page_namespace', 'page_title' ),
680 $extraOutput = array();
682 foreach ( $extraPages as $oldSubpage ) {
683 if ( $ot->equals( $oldSubpage ) ||
$nt->equals( $oldSubpage ) ) {
684 # Already did this one.
688 $newPageName = preg_replace(
689 '#^' . preg_quote( $ot->getDBkey(), '#' ) . '#',
690 StringUtils
::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
691 $oldSubpage->getDBkey()
694 if ( $oldSubpage->isSubpage() && ( $ot->isTalkPage() xor $nt->isTalkPage() ) ) {
695 // Moving a subpage from a subject namespace to a talk namespace or vice-versa
696 $newNs = $nt->getNamespace();
697 } elseif ( $oldSubpage->isTalkPage() ) {
698 $newNs = $nt->getTalkPage()->getNamespace();
700 $newNs = $nt->getSubjectPage()->getNamespace();
703 # Bug 14385: we need makeTitleSafe because the new page names may
704 # be longer than 255 characters.
705 $newSubpage = Title
::makeTitleSafe( $newNs, $newPageName );
706 if ( !$newSubpage ) {
707 $oldLink = Linker
::linkKnown( $oldSubpage );
708 $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink )
709 ->params( Title
::makeName( $newNs, $newPageName ) )->escaped();
713 # This was copy-pasted from Renameuser, bleh.
714 if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
715 $link = Linker
::linkKnown( $newSubpage );
716 $extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
718 $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason
, $createRedirect );
720 if ( $success === true ) {
721 if ( $this->fixRedirects
) {
722 DoubleRedirectJob
::fixRedirects( 'move', $oldSubpage, $newSubpage );
724 $oldLink = Linker
::link(
728 array( 'redirect' => 'no' )
731 $newLink = Linker
::linkKnown( $newSubpage );
732 $extraOutput[] = $this->msg( 'movepage-page-moved' )
733 ->rawParams( $oldLink, $newLink )->escaped();
736 $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' );
737 if ( $count >= $maximumMovedPages ) {
738 $extraOutput[] = $this->msg( 'movepage-max-pages' )
739 ->numParams( $maximumMovedPages )->escaped();
743 $oldLink = Linker
::linkKnown( $oldSubpage );
744 $newLink = Linker
::link( $newSubpage );
745 $extraOutput[] = $this->msg( 'movepage-page-unmoved' )
746 ->rawParams( $oldLink, $newLink )->escaped();
751 if ( $extraOutput !== array() ) {
752 $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
755 # Deal with watches (we don't watch subpages)
756 WatchAction
::doWatchOrUnwatch( $this->watch
, $ot, $user );
757 WatchAction
::doWatchOrUnwatch( $this->watch
, $nt, $user );
760 function showLogFragment( $title ) {
761 $moveLogPage = new LogPage( 'move' );
762 $out = $this->getOutput();
763 $out->addHTML( Xml
::element( 'h2', null, $moveLogPage->getName()->text() ) );
764 LogEventsList
::showLogExtract( $out, 'move', $title );
767 function showSubpages( $title ) {
768 if ( !MWNamespace
::hasSubpages( $title->getNamespace() ) ) {
772 $subpages = $title->getSubpages();
773 $count = $subpages instanceof TitleArray ?
$subpages->count() : 0;
775 $out = $this->getOutput();
776 $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
780 $out->addWikiMsg( 'movenosubpage' );
785 $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) );
786 $out->addHTML( "<ul>\n" );
788 foreach ( $subpages as $subpage ) {
789 $link = Linker
::link( $subpage );
790 $out->addHTML( "<li>$link</li>\n" );
792 $out->addHTML( "</ul>\n" );
796 * Return an array of subpages beginning with $search that this special page will accept.
798 * @param string $search Prefix to search for
799 * @param int $limit Maximum number of results to return (usually 10)
800 * @param int $offset Number of results to skip (usually 0)
801 * @return string[] Matching subpages
803 public function prefixSearchSubpages( $search, $limit, $offset ) {
804 $title = Title
::newFromText( $search );
805 if ( !$title ||
!$title->canExist() ) {
806 // No prefix suggestion in special and media namespace
809 // Autocomplete subpage the same as a normal search
810 $prefixSearcher = new StringPrefixSearch
;
811 $result = $prefixSearcher->search( $search, $limit, array(), $offset );
815 protected function getGroupName() {