summaryrefslogtreecommitdiff
path: root/includes/api/ApiMove.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/api/ApiMove.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/api/ApiMove.php')
-rw-r--r--includes/api/ApiMove.php49
1 files changed, 33 insertions, 16 deletions
diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php
index a93188bf..f15a086c 100644
--- a/includes/api/ApiMove.php
+++ b/includes/api/ApiMove.php
@@ -1,10 +1,10 @@
<?php
/**
- * API for MediaWiki 1.8+
+ *
*
* Created on Oct 31, 2007
*
- * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ class ApiMove extends ApiBase {
}
if ( !$fromTitle->exists() ) {
- $this->dieUsageMsg( array( 'notanarticle' ) );
+ $this->dieUsageMsg( 'notanarticle' );
}
$fromTalk = $fromTitle->getTalkPage();
@@ -76,9 +76,9 @@ class ApiMove extends ApiBase {
&& wfFindFile( $toTitle ) )
{
if ( !$params['ignorewarnings'] && $wgUser->isAllowed( 'reupload-shared' ) ) {
- $this->dieUsageMsg( array( 'sharedfile-exists' ) );
+ $this->dieUsageMsg( 'sharedfile-exists' );
} elseif ( !$wgUser->isAllowed( 'reupload-shared' ) ) {
- $this->dieUsageMsg( array( 'cantoverwrite-sharedfile' ) );
+ $this->dieUsageMsg( 'cantoverwrite-sharedfile' );
}
}
@@ -107,15 +107,18 @@ class ApiMove extends ApiBase {
}
}
+ $result = $this->getResult();
+
// Move subpages
if ( $params['movesubpages'] ) {
$r['subpages'] = $this->moveSubpages( $fromTitle, $toTitle,
$params['reason'], $params['noredirect'] );
- $this->getResult()->setIndexedTagName( $r['subpages'], 'subpage' );
+ $result->setIndexedTagName( $r['subpages'], 'subpage' );
+
if ( $params['movetalk'] ) {
$r['subpages-talk'] = $this->moveSubpages( $fromTalk, $toTalk,
$params['reason'], $params['noredirect'] );
- $this->getResult()->setIndexedTagName( $r['subpages-talk'], 'subpage' );
+ $result->setIndexedTagName( $r['subpages-talk'], 'subpage' );
}
}
@@ -132,9 +135,16 @@ class ApiMove extends ApiBase {
$this->setWatch( $watch, $fromTitle, 'watchmoves' );
$this->setWatch( $watch, $toTitle, 'watchmoves' );
- $this->getResult()->addValue( null, $this->getModuleName(), $r );
+ $result->addValue( null, $this->getModuleName(), $r );
}
+ /**
+ * @param Title $fromTitle
+ * @param Title $toTitle
+ * @param $reason
+ * @param $noredirect
+ * @return array
+ */
public function moveSubpages( $fromTitle, $toTitle, $reason, $noredirect ) {
$retval = array();
$success = $fromTitle->moveSubpages( $toTitle, true, $reason, !$noredirect );
@@ -224,13 +234,16 @@ class ApiMove extends ApiBase {
}
public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array( 'invalidtitle', 'from' ),
- array( 'nosuchpageid', 'fromid' ),
- array( 'notanarticle' ),
- array( 'invalidtitle', 'to' ),
- array( 'sharedfile-exists' ),
- ) );
+ return array_merge( parent::getPossibleErrors(),
+ $this->getRequireOnlyOneParameterErrorMessages( array( 'from', 'fromid' ) ),
+ array(
+ array( 'invalidtitle', 'from' ),
+ array( 'nosuchpageid', 'fromid' ),
+ array( 'notanarticle' ),
+ array( 'invalidtitle', 'to' ),
+ array( 'sharedfile-exists' ),
+ )
+ );
}
public function needsToken() {
@@ -247,7 +260,11 @@ class ApiMove extends ApiBase {
);
}
+ public function getHelpUrls() {
+ return 'https://www.mediawiki.org/wiki/API:Move';
+ }
+
public function getVersion() {
- return __CLASS__ . ': $Id: ApiMove.php 77192 2010-11-23 22:05:27Z btongminh $';
+ return __CLASS__ . ': $Id: ApiMove.php 104449 2011-11-28 15:52:04Z reedy $';
}
}