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 doesWrites() {
69 public function execute( $par ) {
70 $this->useTransactionalTimeLimit();
72 $this->checkReadOnly();
75 $this->outputHeader();
77 $request = $this->getRequest();
78 $target = !is_null( $par ) ?
$par : $request->getVal( 'target' );
80 // Yes, the use of getVal() and getText() is wanted, see bug 20365
82 $oldTitleText = $request->getVal( 'wpOldTitle', $target );
83 $this->oldTitle
= Title
::newFromText( $oldTitleText );
85 if ( !$this->oldTitle
) {
86 // Either oldTitle wasn't passed, or newFromText returned null
87 throw new ErrorPageError( 'notargettitle', 'notargettext' );
89 if ( !$this->oldTitle
->exists() ) {
90 throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
93 $newTitleTextMain = $request->getText( 'wpNewTitleMain' );
94 $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle
->getNamespace() );
95 // Backwards compatibility for forms submitting here from other sources
96 // which is more common than it should be..
97 $newTitleText_bc = $request->getText( 'wpNewTitle' );
98 $this->newTitle
= strlen( $newTitleText_bc ) > 0
99 ? Title
::newFromText( $newTitleText_bc )
100 : Title
::makeTitleSafe( $newTitleTextNs, $newTitleTextMain );
102 $user = $this->getUser();
105 $permErrors = $this->oldTitle
->getUserPermissionsErrors( 'move', $user );
106 if ( count( $permErrors ) ) {
107 // Auto-block user's IP if the account was "hard" blocked
108 DeferredUpdates
::addCallableUpdate( function() use ( $user ) {
109 $user->spreadAnyEditBlock();
111 throw new PermissionsError( 'move', $permErrors );
114 $def = !$request->wasPosted();
116 $this->reason
= $request->getText( 'wpReason' );
117 $this->moveTalk
= $request->getBool( 'wpMovetalk', $def );
118 $this->fixRedirects
= $request->getBool( 'wpFixRedirects', $def );
119 $this->leaveRedirect
= $request->getBool( 'wpLeaveRedirect', $def );
120 $this->moveSubpages
= $request->getBool( 'wpMovesubpages', false );
121 $this->deleteAndMove
= $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' );
122 $this->moveOverShared
= $request->getBool( 'wpMoveOverSharedFile', false );
123 $this->watch
= $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
125 if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
126 && $user->matchEditToken( $request->getVal( 'wpEditToken' ) )
130 $this->showForm( array() );
137 * @param array $err Error messages. Each item is an error message.
138 * It may either be a string message name or array message name and
139 * parameters, like the second argument to OutputPage::wrapWikiMsg().
141 function showForm( $err ) {
144 $this->getSkin()->setRelevantTitle( $this->oldTitle
);
146 $out = $this->getOutput();
147 $out->setPageTitle( $this->msg( 'move-page', $this->oldTitle
->getPrefixedText() ) );
148 $out->addModules( 'mediawiki.special.movePage' );
149 $out->addModuleStyles( 'mediawiki.special.movePage.styles' );
150 $this->addHelpLink( 'Help:Moving a page' );
152 if ( $this->oldTitle
->getNamespace() == NS_USER
&& !$this->oldTitle
->isSubpage() ) {
154 "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
155 'moveuserpage-warning'
157 } elseif ( $this->oldTitle
->getNamespace() == NS_CATEGORY
) {
159 "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
160 'movecategorypage-warning'
164 $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
166 'movepagetext-noredirectfixer'
168 $submitVar = 'wpMove';
171 $newTitle = $this->newTitle
;
174 # Show the current title as a default
175 # when the form is first opened.
176 $newTitle = $this->oldTitle
;
177 } elseif ( !count( $err ) ) {
178 # If a title was supplied, probably from the move log revert
179 # link, check for validity. We can then show some diagnostic
180 # information and save a click.
181 $newerr = $this->oldTitle
->isValidMoveOperation( $newTitle );
182 if ( is_array( $newerr ) ) {
187 $user = $this->getUser();
189 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists'
190 && $newTitle->quickUserCan( 'delete', $user )
192 $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
193 $submitVar = 'wpDeleteAndMove';
198 if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
199 && $user->isAllowed( 'reupload-shared' )
201 $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
202 $submitVar = 'wpMoveOverSharedFile';
206 $oldTalk = $this->oldTitle
->getTalkPage();
207 $oldTitleSubpages = $this->oldTitle
->hasSubpages();
208 $oldTitleTalkSubpages = $this->oldTitle
->getTalkPage()->hasSubpages();
210 $canMoveSubpage = ( $oldTitleSubpages ||
$oldTitleTalkSubpages ) &&
211 !count( $this->oldTitle
->getUserPermissionsErrors( 'move-subpages', $user ) );
213 # We also want to be able to move assoc. subpage talk-pages even if base page
214 # has no associated talk page, so || with $oldTitleTalkSubpages.
215 $considerTalk = !$this->oldTitle
->isTalkPage() &&
217 ||
( $oldTitleTalkSubpages && $canMoveSubpage ) );
219 $dbr = wfGetDB( DB_SLAVE
);
220 if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) {
221 $hasRedirects = $dbr->selectField( 'redirect', '1',
223 'rd_namespace' => $this->oldTitle
->getNamespace(),
224 'rd_title' => $this->oldTitle
->getDBkey(),
227 $hasRedirects = false;
230 if ( count( $err ) ) {
231 $out->addHTML( "<div class='error'>\n" );
232 $action_desc = $this->msg( 'action-move' )->plain();
233 $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc );
235 if ( count( $err ) == 1 ) {
237 $errMsgName = array_shift( $errMsg );
239 if ( $errMsgName == 'hookaborted' ) {
240 $out->addHTML( "<p>{$errMsg[0]}</p>\n" );
242 $out->addWikiMsgArray( $errMsgName, $errMsg );
247 foreach ( $err as $errMsg ) {
248 if ( $errMsg[0] == 'hookaborted' ) {
249 $errStr[] = $errMsg[1];
251 $errMsgName = array_shift( $errMsg );
252 $errStr[] = $this->msg( $errMsgName, $errMsg )->parse();
256 $out->addHTML( '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n" );
258 $out->addHTML( "</div>\n" );
261 if ( $this->oldTitle
->isProtected( 'move' ) ) {
262 # Is the title semi-protected?
263 if ( $this->oldTitle
->isSemiProtected( 'move' ) ) {
264 $noticeMsg = 'semiprotectedpagemovewarning';
265 $classes[] = 'mw-textarea-sprotected';
267 # Then it must be protected based on static groups (regular)
268 $noticeMsg = 'protectedpagemovewarning';
269 $classes[] = 'mw-textarea-protected';
271 $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
272 $out->addWikiMsg( $noticeMsg );
273 LogEventsList
::showLogExtract(
280 $out->addHTML( "</div>\n" );
283 // Byte limit (not string length limit) for wpReason and wpNewTitleMain
284 // is enforced in the mediawiki.special.movePage module
286 $immovableNamespaces = array();
287 foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
288 if ( !MWNamespace
::isMovable( $nsId ) ) {
289 $immovableNamespaces[] = $nsId;
293 $handler = ContentHandler
::getForTitle( $this->oldTitle
);
298 $fields[] = new OOUI\
FieldLayout(
299 new MediaWiki\Widget\
ComplexTitleInputWidget( array(
300 'id' => 'wpNewTitle',
301 'namespace' => array(
302 'id' => 'wpNewTitleNs',
303 'name' => 'wpNewTitleNs',
304 'value' => $newTitle->getNamespace(),
305 'exclude' => $immovableNamespaces,
308 'id' => 'wpNewTitleMain',
309 'name' => 'wpNewTitleMain',
310 'value' => $wgContLang->recodeForEdit( $newTitle->getText() ),
311 // Inappropriate, since we're expecting the user to input a non-existent page's title
312 'suggestions' => false,
317 'label' => $this->msg( 'newtitle' )->text(),
322 $fields[] = new OOUI\
FieldLayout(
323 new OOUI\
TextInputWidget( array(
324 'name' => 'wpReason',
328 'value' => $this->reason
,
331 'label' => $this->msg( 'movereason' )->text(),
336 if ( $considerTalk ) {
337 $fields[] = new OOUI\
FieldLayout(
338 new OOUI\
CheckboxInputWidget( array(
339 'name' => 'wpMovetalk',
340 'id' => 'wpMovetalk',
342 'selected' => $this->moveTalk
,
345 'label' => $this->msg( 'movetalk' )->text(),
346 'help' => new OOUI\
HtmlSnippet( $this->msg( 'movepagetalktext' )->parseAsBlock() ),
353 if ( $user->isAllowed( 'suppressredirect' ) ) {
354 if ( $handler->supportsRedirects() ) {
355 $isChecked = $this->leaveRedirect
;
361 $fields[] = new OOUI\
FieldLayout(
362 new OOUI\
CheckboxInputWidget( array(
363 'name' => 'wpLeaveRedirect',
364 'id' => 'wpLeaveRedirect',
366 'selected' => $isChecked,
367 'disabled' => $isDisabled,
370 'label' => $this->msg( 'move-leave-redirect' )->text(),
376 if ( $hasRedirects ) {
377 $fields[] = new OOUI\
FieldLayout(
378 new OOUI\
CheckboxInputWidget( array(
379 'name' => 'wpFixRedirects',
380 'id' => 'wpFixRedirects',
382 'selected' => $this->fixRedirects
,
385 'label' => $this->msg( 'fix-double-redirects' )->text(),
391 if ( $canMoveSubpage ) {
392 $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' );
393 $fields[] = new OOUI\
FieldLayout(
394 new OOUI\
CheckboxInputWidget( array(
395 'name' => 'wpMovesubpages',
396 'id' => 'wpMovesubpages',
398 # Don't check the box if we only have talk subpages to
399 # move and we aren't moving the talk page.
400 'selected' => $this->moveSubpages
&& ( $this->oldTitle
->hasSubpages() ||
$this->moveTalk
),
403 'label' => new OOUI\
HtmlSnippet(
405 ( $this->oldTitle
->hasSubpages()
407 : 'move-talk-subpages' )
408 )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse()
415 # Don't allow watching if user is not logged in
416 if ( $user->isLoggedIn() ) {
417 $watchChecked = $user->isLoggedIn() && ( $this->watch ||
$user->getBoolOption( 'watchmoves' )
418 ||
$user->isWatched( $this->oldTitle
) );
419 $fields[] = new OOUI\
FieldLayout(
420 new OOUI\
CheckboxInputWidget( array(
422 'id' => 'watch', # ew
424 'selected' => $watchChecked,
427 'label' => $this->msg( 'move-watch' )->text(),
434 $fields[] = new OOUI\
FieldLayout(
435 new OOUI\
CheckboxInputWidget( array(
436 'name' => 'wpConfirm',
441 'label' => $this->msg( 'delete_and_move_confirm' )->text(),
447 $fields[] = new OOUI\
FieldLayout(
448 new OOUI\
ButtonInputWidget( array(
449 'name' => $submitVar,
450 'value' => $this->msg( 'movepagebtn' )->text(),
451 'label' => $this->msg( 'movepagebtn' )->text(),
452 'flags' => array( 'constructive', 'primary' ),
460 $fieldset = new OOUI\
FieldsetLayout( array(
461 'label' => $this->msg( 'move-page-legend' )->text(),
462 'id' => 'mw-movepage-table',
466 $form = new OOUI\
FormLayout( array(
468 'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ),
471 $form->appendContent(
473 new OOUI\
HtmlSnippet(
474 Html
::hidden( 'wpOldTitle', $this->oldTitle
->getPrefixedText() ) .
475 Html
::hidden( 'wpEditToken', $user->getEditToken() )
480 new OOUI\
PanelLayout( array(
481 'classes' => array( 'movepage-wrapper' ),
489 $this->showLogFragment( $this->oldTitle
);
490 $this->showSubpages( $this->oldTitle
);
493 function doSubmit() {
494 $user = $this->getUser();
496 if ( $user->pingLimiter( 'move' ) ) {
497 throw new ThrottledError
;
500 $ot = $this->oldTitle
;
501 $nt = $this->newTitle
;
503 # don't allow moving to pages with # in
504 if ( !$nt ||
$nt->hasFragment() ) {
505 $this->showForm( array( array( 'badtitletext' ) ) );
510 # Show a warning if the target file exists on a shared repo
511 if ( $nt->getNamespace() == NS_FILE
512 && !( $this->moveOverShared
&& $user->isAllowed( 'reupload-shared' ) )
513 && !RepoGroup
::singleton()->getLocalRepo()->findFile( $nt )
516 $this->showForm( array( array( 'file-exists-sharedrepo' ) ) );
521 # Delete to make way if requested
522 if ( $this->deleteAndMove
) {
523 $permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
524 if ( count( $permErrors ) ) {
525 # Only show the first error
526 $this->showForm( $permErrors );
531 $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
533 // Delete an associated image if there is
534 if ( $nt->getNamespace() == NS_FILE
) {
535 $file = wfLocalFile( $nt );
536 $file->load( File
::READ_LATEST
);
537 if ( $file->exists() ) {
538 $file->delete( $reason, false, $user );
542 $error = ''; // passed by ref
543 $page = WikiPage
::factory( $nt );
544 $deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
545 if ( !$deleteStatus->isGood() ) {
546 $this->showForm( $deleteStatus->getErrorsArray() );
552 $handler = ContentHandler
::getForTitle( $ot );
554 if ( !$handler->supportsRedirects() ) {
555 $createRedirect = false;
556 } elseif ( $user->isAllowed( 'suppressredirect' ) ) {
557 $createRedirect = $this->leaveRedirect
;
559 $createRedirect = true;
562 # Do the actual move.
563 $mp = new MovePage( $ot, $nt );
564 $valid = $mp->isValidMove();
565 if ( !$valid->isOK() ) {
566 $this->showForm( $valid->getErrorsArray() );
570 $permStatus = $mp->checkPermissions( $user, $this->reason
);
571 if ( !$permStatus->isOK() ) {
572 $this->showForm( $permStatus->getErrorsArray() );
576 $status = $mp->move( $user, $this->reason
, $createRedirect );
577 if ( !$status->isOK() ) {
578 $this->showForm( $status->getErrorsArray() );
582 if ( $this->getConfig()->get( 'FixDoubleRedirects' ) && $this->fixRedirects
) {
583 DoubleRedirectJob
::fixRedirects( 'move', $ot, $nt );
586 $out = $this->getOutput();
587 $out->setPageTitle( $this->msg( 'pagemovedsub' ) );
589 $oldLink = Linker
::link(
592 array( 'id' => 'movepage-oldlink' ),
593 array( 'redirect' => 'no' )
595 $newLink = Linker
::linkKnown(
598 array( 'id' => 'movepage-newlink' )
600 $oldText = $ot->getPrefixedText();
601 $newText = $nt->getPrefixedText();
603 if ( $ot->exists() ) {
604 // NOTE: we assume that if the old title exists, it's because it was re-created as
605 // a redirect to the new title. This is not safe, but what we did before was
606 // even worse: we just determined whether a redirect should have been created,
607 // and reported that it was created if it should have, without any checks.
608 // Also note that isRedirect() is unreliable because of bug 37209.
609 $msgName = 'movepage-moved-redirect';
611 $msgName = 'movepage-moved-noredirect';
614 $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
615 $newLink )->params( $oldText, $newText )->parseAsBlock() );
616 $out->addWikiMsg( $msgName );
618 Hooks
::run( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
620 # Now we move extra pages we've been asked to move: subpages and talk
621 # pages. First, if the old page or the new page is a talk page, we
622 # can't move any talk pages: cancel that.
623 if ( $ot->isTalkPage() ||
$nt->isTalkPage() ) {
624 $this->moveTalk
= false;
627 if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) {
628 $this->moveSubpages
= false;
632 * Next make a list of id's. This might be marginally less efficient
633 * than a more direct method, but this is not a highly performance-cri-
634 * tical code path and readable code is more important here.
636 * If the target namespace doesn't allow subpages, moving with subpages
637 * would mean that you couldn't move them back in one operation, which
639 * @todo FIXME: A specific error message should be given in this case.
642 // @todo FIXME: Use Title::moveSubpages() here
643 $dbr = wfGetDB( DB_MASTER
);
644 if ( $this->moveSubpages
&& (
645 MWNamespace
::hasSubpages( $nt->getNamespace() ) ||
(
647 && MWNamespace
::hasSubpages( $nt->getTalkPage()->getNamespace() )
651 'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
652 . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
654 $conds['page_namespace'] = array();
655 if ( MWNamespace
::hasSubpages( $nt->getNamespace() ) ) {
656 $conds['page_namespace'][] = $ot->getNamespace();
658 if ( $this->moveTalk
&&
659 MWNamespace
::hasSubpages( $nt->getTalkPage()->getNamespace() )
661 $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
663 } elseif ( $this->moveTalk
) {
665 'page_namespace' => $ot->getTalkPage()->getNamespace(),
666 'page_title' => $ot->getDBkey()
673 $extraPages = array();
674 if ( !is_null( $conds ) ) {
675 $extraPages = TitleArray
::newFromResult(
676 $dbr->select( 'page',
677 array( 'page_id', 'page_namespace', 'page_title' ),
684 $extraOutput = array();
686 foreach ( $extraPages as $oldSubpage ) {
687 if ( $ot->equals( $oldSubpage ) ||
$nt->equals( $oldSubpage ) ) {
688 # Already did this one.
692 $newPageName = preg_replace(
693 '#^' . preg_quote( $ot->getDBkey(), '#' ) . '#',
694 StringUtils
::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
695 $oldSubpage->getDBkey()
698 if ( $oldSubpage->isSubpage() && ( $ot->isTalkPage() xor $nt->isTalkPage() ) ) {
699 // Moving a subpage from a subject namespace to a talk namespace or vice-versa
700 $newNs = $nt->getNamespace();
701 } elseif ( $oldSubpage->isTalkPage() ) {
702 $newNs = $nt->getTalkPage()->getNamespace();
704 $newNs = $nt->getSubjectPage()->getNamespace();
707 # Bug 14385: we need makeTitleSafe because the new page names may
708 # be longer than 255 characters.
709 $newSubpage = Title
::makeTitleSafe( $newNs, $newPageName );
710 if ( !$newSubpage ) {
711 $oldLink = Linker
::linkKnown( $oldSubpage );
712 $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink )
713 ->params( Title
::makeName( $newNs, $newPageName ) )->escaped();
717 # This was copy-pasted from Renameuser, bleh.
718 if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
719 $link = Linker
::linkKnown( $newSubpage );
720 $extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
722 $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason
, $createRedirect );
724 if ( $success === true ) {
725 if ( $this->fixRedirects
) {
726 DoubleRedirectJob
::fixRedirects( 'move', $oldSubpage, $newSubpage );
728 $oldLink = Linker
::link(
732 array( 'redirect' => 'no' )
735 $newLink = Linker
::linkKnown( $newSubpage );
736 $extraOutput[] = $this->msg( 'movepage-page-moved' )
737 ->rawParams( $oldLink, $newLink )->escaped();
740 $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' );
741 if ( $count >= $maximumMovedPages ) {
742 $extraOutput[] = $this->msg( 'movepage-max-pages' )
743 ->numParams( $maximumMovedPages )->escaped();
747 $oldLink = Linker
::linkKnown( $oldSubpage );
748 $newLink = Linker
::link( $newSubpage );
749 $extraOutput[] = $this->msg( 'movepage-page-unmoved' )
750 ->rawParams( $oldLink, $newLink )->escaped();
755 if ( $extraOutput !== array() ) {
756 $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
759 # Deal with watches (we don't watch subpages)
760 WatchAction
::doWatchOrUnwatch( $this->watch
, $ot, $user );
761 WatchAction
::doWatchOrUnwatch( $this->watch
, $nt, $user );
764 function showLogFragment( $title ) {
765 $moveLogPage = new LogPage( 'move' );
766 $out = $this->getOutput();
767 $out->addHTML( Xml
::element( 'h2', null, $moveLogPage->getName()->text() ) );
768 LogEventsList
::showLogExtract( $out, 'move', $title );
771 function showSubpages( $title ) {
772 if ( !MWNamespace
::hasSubpages( $title->getNamespace() ) ) {
776 $subpages = $title->getSubpages();
777 $count = $subpages instanceof TitleArray ?
$subpages->count() : 0;
779 $out = $this->getOutput();
780 $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
784 $out->addWikiMsg( 'movenosubpage' );
789 $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) );
790 $out->addHTML( "<ul>\n" );
792 foreach ( $subpages as $subpage ) {
793 $link = Linker
::link( $subpage );
794 $out->addHTML( "<li>$link</li>\n" );
796 $out->addHTML( "</ul>\n" );
800 * Return an array of subpages beginning with $search that this special page will accept.
802 * @param string $search Prefix to search for
803 * @param int $limit Maximum number of results to return (usually 10)
804 * @param int $offset Number of results to skip (usually 0)
805 * @return string[] Matching subpages
807 public function prefixSearchSubpages( $search, $limit, $offset ) {
808 $title = Title
::newFromText( $search );
809 if ( !$title ||
!$title->canExist() ) {
810 // No prefix suggestion in special and media namespace
813 // Autocomplete subpage the same as a normal search
814 $prefixSearcher = new StringPrefixSearch
;
815 $result = $prefixSearcher->search( $search, $limit, array(), $offset );
819 protected function getGroupName() {