MediaWiki  1.23.2
SpecialMovepage.php
Go to the documentation of this file.
1 <?php
34  var $oldTitle, $newTitle;
35  // Text input
36  var $reason;
37  // Checks
39 
40  private $watch = false;
41 
42  public function __construct() {
43  parent::__construct( 'Movepage' );
44  }
45 
46  public function execute( $par ) {
47  $this->checkReadOnly();
48 
49  $this->setHeaders();
50  $this->outputHeader();
51 
52  $request = $this->getRequest();
53  $target = !is_null( $par ) ? $par : $request->getVal( 'target' );
54 
55  // Yes, the use of getVal() and getText() is wanted, see bug 20365
56 
57  $oldTitleText = $request->getVal( 'wpOldTitle', $target );
58  $this->oldTitle = Title::newFromText( $oldTitleText );
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  $newTitleTextMain = $request->getText( 'wpNewTitleMain' );
68  $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle->getNamespace() );
69  // Backwards compatibility for forms submitting here from other sources
70  // which is more common than it should be..
71  $newTitleText_bc = $request->getText( 'wpNewTitle' );
72  $this->newTitle = strlen( $newTitleText_bc ) > 0
73  ? Title::newFromText( $newTitleText_bc )
74  : Title::makeTitleSafe( $newTitleTextNs, $newTitleTextMain );
75 
76  $user = $this->getUser();
77 
78  # Check rights
79  $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user );
80  if ( count( $permErrors ) ) {
81  // Auto-block user's IP if the account was "hard" blocked
82  $user->spreadAnyEditBlock();
83  throw new PermissionsError( 'move', $permErrors );
84  }
85 
86  $def = !$request->wasPosted();
87 
88  $this->reason = $request->getText( 'wpReason' );
89  $this->moveTalk = $request->getBool( 'wpMovetalk', $def );
90  $this->fixRedirects = $request->getBool( 'wpFixRedirects', $def );
91  $this->leaveRedirect = $request->getBool( 'wpLeaveRedirect', $def );
92  $this->moveSubpages = $request->getBool( 'wpMovesubpages', false );
93  $this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' );
94  $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile', false );
95  $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
96 
97  if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
98  && $user->matchEditToken( $request->getVal( 'wpEditToken' ) )
99  ) {
100  $this->doSubmit();
101  } else {
102  $this->showForm( array() );
103  }
104  }
105 
113  function showForm( $err ) {
114  global $wgContLang, $wgFixDoubleRedirects, $wgMaximumMovedPages;
115 
116  $this->getSkin()->setRelevantTitle( $this->oldTitle );
117 
118  $oldTitleLink = Linker::link( $this->oldTitle );
119 
120  $out = $this->getOutput();
121  $out->setPageTitle( $this->msg( 'move-page', $this->oldTitle->getPrefixedText() ) );
122  $out->addModules( 'mediawiki.special.movePage' );
123 
125 
126  if ( !$newTitle ) {
127  # Show the current title as a default
128  # when the form is first opened.
130  } elseif ( !count( $err ) ) {
131  # If a title was supplied, probably from the move log revert
132  # link, check for validity. We can then show some diagnostic
133  # information and save a click.
134  $newerr = $this->oldTitle->isValidMoveOperation( $newTitle );
135  if ( is_array( $newerr ) ) {
136  $err = $newerr;
137  }
138  }
139 
140  $user = $this->getUser();
141 
142  if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists'
143  && $newTitle->quickUserCan( 'delete', $user )
144  ) {
145  $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
146  $movepagebtn = $this->msg( 'delete_and_move' )->text();
147  $submitVar = 'wpDeleteAndMove';
148  $confirm = "
149  <tr>
150  <td></td>
151  <td class='mw-input'>" .
153  $this->msg( 'delete_and_move_confirm' )->text(),
154  'wpConfirm',
155  'wpConfirm'
156  ) .
157  "</td>
158  </tr>";
159  $err = array();
160  } else {
161  if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
162  $out->wrapWikiMsg(
163  "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
164  'moveuserpage-warning'
165  );
166  }
167 
168  $out->addWikiMsg( $wgFixDoubleRedirects ?
169  'movepagetext' :
170  'movepagetext-noredirectfixer'
171  );
172  $movepagebtn = $this->msg( 'movepagebtn' )->text();
173  $submitVar = 'wpMove';
174  $confirm = false;
175  }
176 
177  if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
178  && $user->isAllowed( 'reupload-shared' )
179  ) {
180  $out->addWikiMsg( 'move-over-sharedrepo', $newTitle->getPrefixedText() );
181  $submitVar = 'wpMoveOverSharedFile';
182  $err = array();
183  }
184 
185  $oldTalk = $this->oldTitle->getTalkPage();
186  $oldTitleSubpages = $this->oldTitle->hasSubpages();
187  $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
188 
189  $canMoveSubpage = ( $oldTitleSubpages || $oldTitleTalkSubpages ) &&
190  !count( $this->oldTitle->getUserPermissionsErrors( 'move-subpages', $user ) );
191 
192  # We also want to be able to move assoc. subpage talk-pages even if base page
193  # has no associated talk page, so || with $oldTitleTalkSubpages.
194  $considerTalk = !$this->oldTitle->isTalkPage() &&
195  ( $oldTalk->exists()
196  || ( $oldTitleTalkSubpages && $canMoveSubpage ) );
197 
198  $dbr = wfGetDB( DB_SLAVE );
199  if ( $wgFixDoubleRedirects ) {
200  $hasRedirects = $dbr->selectField( 'redirect', '1',
201  array(
202  'rd_namespace' => $this->oldTitle->getNamespace(),
203  'rd_title' => $this->oldTitle->getDBkey(),
204  ), __METHOD__ );
205  } else {
206  $hasRedirects = false;
207  }
208 
209  if ( $considerTalk ) {
210  $out->addWikiMsg( 'movepagetalktext' );
211  }
212 
213  if ( count( $err ) ) {
214  $out->addHTML( "<div class='error'>\n" );
215  $action_desc = $this->msg( 'action-move' )->plain();
216  $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc );
217 
218  if ( count( $err ) == 1 ) {
219  $errMsg = $err[0];
220  $errMsgName = array_shift( $errMsg );
221 
222  if ( $errMsgName == 'hookaborted' ) {
223  $out->addHTML( "<p>{$errMsg[0]}</p>\n" );
224  } else {
225  $out->addWikiMsgArray( $errMsgName, $errMsg );
226  }
227  } else {
228  $errStr = array();
229 
230  foreach ( $err as $errMsg ) {
231  if ( $errMsg[0] == 'hookaborted' ) {
232  $errStr[] = $errMsg[1];
233  } else {
234  $errMsgName = array_shift( $errMsg );
235  $errStr[] = $this->msg( $errMsgName, $errMsg )->parse();
236  }
237  }
238 
239  $out->addHTML( '<ul><li>' . implode( "</li>\n<li>", $errStr ) . "</li></ul>\n" );
240  }
241  $out->addHTML( "</div>\n" );
242  }
243 
244  if ( $this->oldTitle->isProtected( 'move' ) ) {
245  # Is the title semi-protected?
246  if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
247  $noticeMsg = 'semiprotectedpagemovewarning';
248  $classes[] = 'mw-textarea-sprotected';
249  } else {
250  # Then it must be protected based on static groups (regular)
251  $noticeMsg = 'protectedpagemovewarning';
252  $classes[] = 'mw-textarea-protected';
253  }
254  $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
255  $out->addWikiMsg( $noticeMsg );
257  $out,
258  'protect',
259  $this->oldTitle,
260  '',
261  array( 'lim' => 1 )
262  );
263  $out->addHTML( "</div>\n" );
264  }
265 
266  // Byte limit (not string length limit) for wpReason and wpNewTitleMain
267  // is enforced in the mediawiki.special.movePage module
268 
269  $immovableNamespaces = array();
270 
271  foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
272  if ( !MWNamespace::isMovable( $nsId ) ) {
273  $immovableNamespaces[] = $nsId;
274  }
275  }
276 
277  $handler = ContentHandler::getForTitle( $this->oldTitle );
278 
279  $out->addHTML(
281  'form',
282  array(
283  'method' => 'post',
284  'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ),
285  'id' => 'movepage'
286  )
287  ) .
288  Xml::openElement( 'fieldset' ) .
289  Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) .
290  Xml::openElement( 'table', array( 'id' => 'mw-movepage-table' ) ) .
291  "<tr>
292  <td class='mw-label'>" .
293  $this->msg( 'movearticle' )->escaped() .
294  "</td>
295  <td class='mw-input'>
296  <strong>{$oldTitleLink}</strong>
297  </td>
298  </tr>
299  <tr>
300  <td class='mw-label'>" .
301  Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) .
302  "</td>
303  <td class='mw-input'>" .
305  array(
306  'selected' => $newTitle->getNamespace(),
307  'exclude' => $immovableNamespaces
308  ),
309  array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' )
310  ) .
311  Xml::input(
312  'wpNewTitleMain',
313  60,
314  $wgContLang->recodeForEdit( $newTitle->getText() ),
315  array(
316  'type' => 'text',
317  'id' => 'wpNewTitleMain',
318  'maxlength' => 255
319  )
320  ) .
321  Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) .
322  "</td>
323  </tr>
324  <tr>
325  <td class='mw-label'>" .
326  Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) .
327  "</td>
328  <td class='mw-input'>" .
329  Xml::input( 'wpReason', 60, $this->reason, array(
330  'type' => 'text',
331  'id' => 'wpReason',
332  'maxlength' => 200,
333  ) ) .
334  "</td>
335  </tr>"
336  );
337 
338  if ( $considerTalk ) {
339  $out->addHTML( "
340  <tr>
341  <td></td>
342  <td class='mw-input'>" .
344  $this->msg( 'movetalk' )->text(),
345  'wpMovetalk',
346  'wpMovetalk',
347  $this->moveTalk
348  ) .
349  "</td>
350  </tr>"
351  );
352  }
353 
354  if ( $user->isAllowed( 'suppressredirect' ) ) {
355  if ( $handler->supportsRedirects() ) {
356  $isChecked = $this->leaveRedirect;
357  $options = array();
358  } else {
359  $isChecked = false;
360  $options = array(
361  'disabled' => 'disabled'
362  );
363  }
364  $out->addHTML( "
365  <tr>
366  <td></td>
367  <td class='mw-input' >" .
369  $this->msg( 'move-leave-redirect' )->text(),
370  'wpLeaveRedirect',
371  'wpLeaveRedirect',
372  $isChecked,
373  $options
374  ) .
375  "</td>
376  </tr>"
377  );
378  }
379 
380  if ( $hasRedirects ) {
381  $out->addHTML( "
382  <tr>
383  <td></td>
384  <td class='mw-input' >" .
386  $this->msg( 'fix-double-redirects' )->text(),
387  'wpFixRedirects',
388  'wpFixRedirects',
389  $this->fixRedirects
390  ) .
391  "</td>
392  </tr>"
393  );
394  }
395 
396  if ( $canMoveSubpage ) {
397  $out->addHTML( "
398  <tr>
399  <td></td>
400  <td class=\"mw-input\">" .
401  Xml::check(
402  'wpMovesubpages',
403  # Don't check the box if we only have talk subpages to
404  # move and we aren't moving the talk page.
405  $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ),
406  array( 'id' => 'wpMovesubpages' )
407  ) . '&#160;' .
408  Xml::tags( 'label', array( 'for' => 'wpMovesubpages' ),
409  $this->msg(
410  ( $this->oldTitle->hasSubpages()
411  ? 'move-subpages'
412  : 'move-talk-subpages' )
413  )->numParams( $wgMaximumMovedPages )->params( $wgMaximumMovedPages )->parse()
414  ) .
415  "</td>
416  </tr>"
417  );
418  }
419 
420  $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' )
421  || $user->isWatched( $this->oldTitle ) );
422  # Don't allow watching if user is not logged in
423  if ( $user->isLoggedIn() ) {
424  $out->addHTML( "
425  <tr>
426  <td></td>
427  <td class='mw-input'>" .
429  $this->msg( 'move-watch' )->text(),
430  'wpWatch',
431  'watch',
432  $watchChecked
433  ) .
434  "</td>
435  </tr>" );
436  }
437 
438  $out->addHTML( "
439  {$confirm}
440  <tr>
441  <td>&#160;</td>
442  <td class='mw-submit'>" .
443  Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) .
444  "</td>
445  </tr>" .
446  Xml::closeElement( 'table' ) .
447  Html::hidden( 'wpEditToken', $user->getEditToken() ) .
448  Xml::closeElement( 'fieldset' ) .
449  Xml::closeElement( 'form' ) .
450  "\n"
451  );
452 
453  $this->showLogFragment( $this->oldTitle );
454  $this->showSubpages( $this->oldTitle );
455  }
456 
457  function doSubmit() {
458  global $wgMaximumMovedPages, $wgFixDoubleRedirects;
459 
460  $user = $this->getUser();
461 
462  if ( $user->pingLimiter( 'move' ) ) {
463  throw new ThrottledError;
464  }
465 
466  $ot = $this->oldTitle;
467  $nt = $this->newTitle;
468 
469  # don't allow moving to pages with # in
470  if ( !$nt || $nt->hasFragment() ) {
471  $this->showForm( array( array( 'badtitletext' ) ) );
472 
473  return;
474  }
475 
476  # Show a warning if the target file exists on a shared repo
477  if ( $nt->getNamespace() == NS_FILE
478  && !( $this->moveOverShared && $user->isAllowed( 'reupload-shared' ) )
479  && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
480  && wfFindFile( $nt )
481  ) {
482  $this->showForm( array( array( 'file-exists-sharedrepo' ) ) );
483 
484  return;
485  }
486 
487  # Delete to make way if requested
488  if ( $this->deleteAndMove ) {
489  $permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
490  if ( count( $permErrors ) ) {
491  # Only show the first error
492  $this->showForm( $permErrors );
493 
494  return;
495  }
496 
497  $reason = $this->msg( 'delete_and_move_reason', $ot )->inContentLanguage()->text();
498 
499  // Delete an associated image if there is
500  if ( $nt->getNamespace() == NS_FILE ) {
501  $file = wfLocalFile( $nt );
502  if ( $file->exists() ) {
503  $file->delete( $reason, false );
504  }
505  }
506 
507  $error = ''; // passed by ref
508  $page = WikiPage::factory( $nt );
509  $deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
510  if ( !$deleteStatus->isGood() ) {
511  $this->showForm( $deleteStatus->getErrorsArray() );
512 
513  return;
514  }
515  }
516 
517  $handler = ContentHandler::getForTitle( $ot );
518 
519  if ( !$handler->supportsRedirects() ) {
520  $createRedirect = false;
521  } elseif ( $user->isAllowed( 'suppressredirect' ) ) {
522  $createRedirect = $this->leaveRedirect;
523  } else {
524  $createRedirect = true;
525  }
526 
527  # Do the actual move.
528  $error = $ot->moveTo( $nt, true, $this->reason, $createRedirect );
529  if ( $error !== true ) {
530  $this->showForm( $error );
531 
532  return;
533  }
534 
535  if ( $wgFixDoubleRedirects && $this->fixRedirects ) {
536  DoubleRedirectJob::fixRedirects( 'move', $ot, $nt );
537  }
538 
539  $out = $this->getOutput();
540  $out->setPageTitle( $this->msg( 'pagemovedsub' ) );
541 
542  $oldLink = Linker::link(
543  $ot,
544  null,
545  array(),
546  array( 'redirect' => 'no' )
547  );
548  $newLink = Linker::linkKnown( $nt );
549  $oldText = $ot->getPrefixedText();
550  $newText = $nt->getPrefixedText();
551 
552  if ( $ot->exists() ) {
553  //NOTE: we assume that if the old title exists, it's because it was re-created as
554  // a redirect to the new title. This is not safe, but what we did before was
555  // even worse: we just determined whether a redirect should have been created,
556  // and reported that it was created if it should have, without any checks.
557  // Also note that isRedirect() is unreliable because of bug 37209.
558  $msgName = 'movepage-moved-redirect';
559  } else {
560  $msgName = 'movepage-moved-noredirect';
561  }
562 
563  $out->addHTML( $this->msg( 'movepage-moved' )->rawParams( $oldLink,
564  $newLink )->params( $oldText, $newText )->parseAsBlock() );
565  $out->addWikiMsg( $msgName );
566 
567  wfRunHooks( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
568 
569  # Now we move extra pages we've been asked to move: subpages and talk
570  # pages. First, if the old page or the new page is a talk page, we
571  # can't move any talk pages: cancel that.
572  if ( $ot->isTalkPage() || $nt->isTalkPage() ) {
573  $this->moveTalk = false;
574  }
575 
576  if ( count( $ot->getUserPermissionsErrors( 'move-subpages', $user ) ) ) {
577  $this->moveSubpages = false;
578  }
579 
580  # Next make a list of id's. This might be marginally less efficient
581  # than a more direct method, but this is not a highly performance-cri-
582  # tical code path and readable code is more important here.
583  #
584  # Note: this query works nicely on MySQL 5, but the optimizer in MySQL
585  # 4 might get confused. If so, consider rewriting as a UNION.
586  #
587  # If the target namespace doesn't allow subpages, moving with subpages
588  # would mean that you couldn't move them back in one operation, which
589  # is bad.
590  # @todo FIXME: A specific error message should be given in this case.
591 
592  // @todo FIXME: Use Title::moveSubpages() here
593  $dbr = wfGetDB( DB_MASTER );
594  if ( $this->moveSubpages && (
595  MWNamespace::hasSubpages( $nt->getNamespace() ) || (
596  $this->moveTalk
597  && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
598  )
599  ) ) {
600  $conds = array(
601  'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
602  . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
603  );
604  $conds['page_namespace'] = array();
605  if ( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
606  $conds['page_namespace'][] = $ot->getNamespace();
607  }
608  if ( $this->moveTalk &&
609  MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
610  ) {
611  $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
612  }
613  } elseif ( $this->moveTalk ) {
614  $conds = array(
615  'page_namespace' => $ot->getTalkPage()->getNamespace(),
616  'page_title' => $ot->getDBkey()
617  );
618  } else {
619  # Skip the query
620  $conds = null;
621  }
622 
623  $extraPages = array();
624  if ( !is_null( $conds ) ) {
625  $extraPages = TitleArray::newFromResult(
626  $dbr->select( 'page',
627  array( 'page_id', 'page_namespace', 'page_title' ),
628  $conds,
629  __METHOD__
630  )
631  );
632  }
633 
634  $extraOutput = array();
635  $count = 1;
636  foreach ( $extraPages as $oldSubpage ) {
637  if ( $ot->equals( $oldSubpage ) || $nt->equals( $oldSubpage ) ) {
638  # Already did this one.
639  continue;
640  }
641 
642  $newPageName = preg_replace(
643  '#^' . preg_quote( $ot->getDBkey(), '#' ) . '#',
644  StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
645  $oldSubpage->getDBkey()
646  );
647 
648  if ( $oldSubpage->isTalkPage() ) {
649  $newNs = $nt->getTalkPage()->getNamespace();
650  } else {
651  $newNs = $nt->getSubjectPage()->getNamespace();
652  }
653 
654  # Bug 14385: we need makeTitleSafe because the new page names may
655  # be longer than 255 characters.
656  $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
657  if ( !$newSubpage ) {
658  $oldLink = Linker::linkKnown( $oldSubpage );
659  $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink )
660  ->params( Title::makeName( $newNs, $newPageName ) )->escaped();
661  continue;
662  }
663 
664  # This was copy-pasted from Renameuser, bleh.
665  if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
666  $link = Linker::linkKnown( $newSubpage );
667  $extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
668  } else {
669  $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
670 
671  if ( $success === true ) {
672  if ( $this->fixRedirects ) {
673  DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
674  }
675  $oldLink = Linker::link(
676  $oldSubpage,
677  null,
678  array(),
679  array( 'redirect' => 'no' )
680  );
681 
682  $newLink = Linker::linkKnown( $newSubpage );
683  $extraOutput[] = $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped();
684  ++$count;
685 
686  if ( $count >= $wgMaximumMovedPages ) {
687  $extraOutput[] = $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped();
688  break;
689  }
690  } else {
691  $oldLink = Linker::linkKnown( $oldSubpage );
692  $newLink = Linker::link( $newSubpage );
693  $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped();
694  }
695  }
696  }
697 
698  if ( $extraOutput !== array() ) {
699  $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
700  }
701 
702  # Deal with watches (we don't watch subpages)
703  WatchAction::doWatchOrUnwatch( $this->watch, $ot, $user );
704  WatchAction::doWatchOrUnwatch( $this->watch, $nt, $user );
705  }
706 
707  function showLogFragment( $title ) {
708  $moveLogPage = new LogPage( 'move' );
709  $out = $this->getOutput();
710  $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) );
712  }
713 
714  function showSubpages( $title ) {
715  if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
716  return;
717  }
718 
719  $subpages = $title->getSubpages();
720  $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
721 
722  $out = $this->getOutput();
723  $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
724 
725  # No subpages.
726  if ( $count == 0 ) {
727  $out->addWikiMsg( 'movenosubpage' );
728 
729  return;
730  }
731 
732  $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) );
733  $out->addHTML( "<ul>\n" );
734 
735  foreach ( $subpages as $subpage ) {
736  $link = Linker::link( $subpage );
737  $out->addHTML( "<li>$link</li>\n" );
738  }
739  $out->addHTML( "</ul>\n" );
740  }
741 
742  protected function getGroupName() {
743  return 'pagetools';
744  }
745 }
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:433
MovePageForm\$moveOverShared
$moveOverShared
Definition: SpecialMovepage.php:37
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:488
MovePageForm\$newTitle
Title $newTitle
Definition: SpecialMovepage.php:33
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
RepoGroup\singleton
static singleton()
Get a RepoGroup instance.
Definition: RepoGroup.php:53
MovePageForm\$leaveRedirect
$leaveRedirect
Definition: SpecialMovepage.php:37
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
MovePageForm\showSubpages
showSubpages( $title)
Definition: SpecialMovepage.php:713
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
TitleArray\newFromResult
static newFromResult( $res)
Definition: TitleArray.php:38
UnlistedSpecialPage
Shortcut to construct a special page which is unlisted by default.
Definition: UnlistedSpecialPage.php:29
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
MovePageForm\$oldTitle
Title $oldTitle
Objects.
Definition: SpecialMovepage.php:33
MovePageForm\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialMovepage.php:741
Title\getPrefixedText
getPrefixedText()
Get the prefixed title with spaces.
Definition: Title.php:1369
StringUtils\escapeRegexReplacement
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
Definition: StringUtils.php:296
Title\quickUserCan
quickUserCan( $action, $user=null)
Can $user perform $action on this page? This skips potentially expensive cascading permission checks ...
Definition: Title.php:1882
NS_FILE
const NS_FILE
Definition: Defines.php:85
ContentHandler\getForTitle
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
Definition: ContentHandler.php:259
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:555
Html\hidden
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
Definition: Html.php:662
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:578
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2149
MovePageForm\showForm
showForm( $err)
Show the form.
Definition: SpecialMovepage.php:112
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
MovePageForm\$fixRedirects
$fixRedirects
Definition: SpecialMovepage.php:37
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
$dbr
$dbr
Definition: testCompression.php:48
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
$success
$success
Definition: Utf8Test.php:91
MovePageForm\doSubmit
doSubmit()
Definition: SpecialMovepage.php:456
$out
$out
Definition: UtfNormalGenerate.php:167
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
MovePageForm\$reason
$reason
Definition: SpecialMovepage.php:35
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:32
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
MWNamespace\hasSubpages
static hasSubpages( $index)
Does the namespace allow subpages?
Definition: Namespace.php:325
ThrottledError
Show an error when the user hits a rate limit.
Definition: ThrottledError.php:27
WatchAction\doWatchOrUnwatch
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
Definition: WatchAction.php:106
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:545
MovePageForm
A special page that allows users to change page titles.
Definition: SpecialMovepage.php:29
MWNamespace\isMovable
static isMovable( $index)
Can pages in the given namespace be moved?
Definition: Namespace.php:67
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
MovePageForm\__construct
__construct()
Definition: SpecialMovepage.php:41
DoubleRedirectJob\fixRedirects
static fixRedirects( $reason, $redirTitle, $destTitle=false)
Insert jobs into the job queue to fix redirects to the given title.
Definition: DoubleRedirectJob.php:49
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:1530
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
Xml\check
static check( $name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
Definition: Xml.php:339
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:525
Title\isValidMoveOperation
isValidMoveOperation(&$nt, $auth=true, $reason='')
Check whether a given move operation would be valid.
Definition: Title.php:3560
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
$count
$count
Definition: UtfNormalTest2.php:96
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
Title
Represents a title within MediaWiki.
Definition: Title.php:35
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:118
MovePageForm\$moveTalk
$moveTalk
Definition: SpecialMovepage.php:37
Title\makeName
static makeName( $ns, $title, $fragment='', $interwiki='')
Make a prefixed DB key from a DB key and a namespace index.
Definition: Title.php:702
TitleArray
The TitleArray class only exists to provide the newFromResult method at pre- sent.
Definition: TitleArray.php:31
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Html\namespaceSelector
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
Definition: Html.php:707
wfFindFile
wfFindFile( $title, $options=array())
Find a file.
Definition: GlobalFunctions.php:3693
NS_USER
const NS_USER
Definition: Defines.php:81
Xml\submitButton
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Definition: Xml.php:463
MovePageForm\$watch
$watch
Definition: SpecialMovepage.php:39
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:300
Xml\input
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
Definition: Xml.php:294
$error
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Definition: hooks.txt:2573
Xml\label
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
Definition: Xml.php:374
MovePageForm\$deleteAndMove
$deleteAndMove
Definition: SpecialMovepage.php:37
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27
MovePageForm\showLogFragment
showLogFragment( $title)
Definition: SpecialMovepage.php:706
wfLocalFile
wfLocalFile( $title)
Get an object referring to a locally registered file.
Definition: GlobalFunctions.php:3704
MovePageForm\$moveSubpages
$moveSubpages
Definition: SpecialMovepage.php:37
Title\getText
getText()
Get the text form (spaces not underscores) of the main part.
Definition: Title.php:839
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:443
MovePageForm\execute
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
Definition: SpecialMovepage.php:45
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
Definition: LogEventsList.php:507
page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page
Definition: hooks.txt:1956