/** @var Title */
protected $newTitle;
-
/** @var string Text input */
protected $reason;
$out->addModuleStyles( 'mediawiki.special.movePage.styles' );
$this->addHelpLink( 'Help:Moving a page' );
+ if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
+ $out->wrapWikiMsg(
+ "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
+ 'moveuserpage-warning'
+ );
+ } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
+ $out->wrapWikiMsg(
+ "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
+ 'movecategorypage-warning'
+ );
+ }
+
+ $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
+ 'movepagetext' :
+ 'movepagetext-noredirectfixer'
+ );
+ $submitVar = 'wpMove';
+ $confirm = false;
+
$newTitle = $this->newTitle;
if ( !$newTitle ) {
&& $newTitle->quickUserCan( 'delete', $user )
) {
$out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
- $movepagebtn = $this->msg( 'delete_and_move' )->text();
$submitVar = 'wpDeleteAndMove';
$confirm = true;
$err = array();
- } else {
- if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
- $out->wrapWikiMsg(
- "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
- 'moveuserpage-warning'
- );
- } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
- $out->wrapWikiMsg(
- "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
- 'movecategorypage-warning'
- );
- }
-
- $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
- 'movepagetext' :
- 'movepagetext-noredirectfixer'
- );
- $movepagebtn = $this->msg( 'movepagebtn' )->text();
- $submitVar = 'wpMove';
- $confirm = false;
}
if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
$fields[] = new OOUI\FieldLayout(
new OOUI\ButtonInputWidget( array(
'name' => $submitVar,
- 'value' => $movepagebtn,
- 'label' => $movepagebtn,
+ 'value' => $this->msg( 'movepagebtn' )->text(),
+ 'label' => $this->msg( 'movepagebtn' )->text(),
'flags' => array( 'constructive', 'primary' ),
'type' => 'submit',
) ),
* than a more direct method, but this is not a highly performance-cri-
* tical code path and readable code is more important here.
*
- * Note: this query works nicely on MySQL 5, but the optimizer in MySQL
- * 4 might get confused. If so, consider rewriting as a UNION.
- *
* If the target namespace doesn't allow subpages, moving with subpages
* would mean that you couldn't move them back in one operation, which
* is bad.
$out->addHTML( "</ul>\n" );
}
+ /**
+ * Return an array of subpages beginning with $search that this special page will accept.
+ *
+ * @param string $search Prefix to search for
+ * @param int $limit Maximum number of results to return (usually 10)
+ * @param int $offset Number of results to skip (usually 0)
+ * @return string[] Matching subpages
+ */
+ public function prefixSearchSubpages( $search, $limit, $offset ) {
+ $title = Title::newFromText( $search );
+ if ( !$title || !$title->canExist() ) {
+ // No prefix suggestion in special and media namespace
+ return array();
+ }
+ // Autocomplete subpage the same as a normal search
+ $prefixSearcher = new StringPrefixSearch;
+ $result = $prefixSearcher->search( $search, $limit, array(), $offset );
+ return $result;
+ }
+
protected function getGroupName() {
return 'pagetools';
}