dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Make NumericUppercaseCollation use localized digit transforms"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiMove.php
diff --git
a/includes/api/ApiMove.php
b/includes/api/ApiMove.php
index
60fd426
..
29e67b0
100644
(file)
--- a/
includes/api/ApiMove.php
+++ b/
includes/api/ApiMove.php
@@
-41,12
+41,12
@@
class ApiMove extends ApiBase {
if ( isset( $params['from'] ) ) {
$fromTitle = Title::newFromText( $params['from'] );
if ( !$fromTitle || $fromTitle->isExternal() ) {
if ( isset( $params['from'] ) ) {
$fromTitle = Title::newFromText( $params['from'] );
if ( !$fromTitle || $fromTitle->isExternal() ) {
- $this->dieUsageMsg(
array( 'invalidtitle', $params['from'] )
);
+ $this->dieUsageMsg(
[ 'invalidtitle', $params['from'] ]
);
}
} elseif ( isset( $params['fromid'] ) ) {
$fromTitle = Title::newFromID( $params['fromid'] );
if ( !$fromTitle ) {
}
} elseif ( isset( $params['fromid'] ) ) {
$fromTitle = Title::newFromID( $params['fromid'] );
if ( !$fromTitle ) {
- $this->dieUsageMsg(
array( 'nosuchpageid', $params['fromid'] )
);
+ $this->dieUsageMsg(
[ 'nosuchpageid', $params['fromid'] ]
);
}
}
}
}
@@
-57,7
+57,7
@@
class ApiMove extends ApiBase {
$toTitle = Title::newFromText( $params['to'] );
if ( !$toTitle || $toTitle->isExternal() ) {
$toTitle = Title::newFromText( $params['to'] );
if ( !$toTitle || $toTitle->isExternal() ) {
- $this->dieUsageMsg(
array( 'invalidtitle', $params['to'] )
);
+ $this->dieUsageMsg(
[ 'invalidtitle', $params['to'] ]
);
}
$toTalk = $toTitle->getTalkPage();
}
$toTalk = $toTitle->getTalkPage();
@@
-72,6
+72,11
@@
class ApiMove extends ApiBase {
}
}
}
}
+ // Rate limit
+ if ( $user->pingLimiter( 'move' ) ) {
+ $this->dieUsageMsg( 'actionthrottledtext' );
+ }
+
// Move the page
$toTitleExists = $toTitle->exists();
$status = $this->movePage( $fromTitle, $toTitle, $params['reason'], !$params['noredirect'] );
// Move the page
$toTitleExists = $toTitle->exists();
$status = $this->movePage( $fromTitle, $toTitle, $params['reason'], !$params['noredirect'] );
@@
-79,11
+84,11
@@
class ApiMove extends ApiBase {
$this->dieStatus( $status );
}
$this->dieStatus( $status );
}
- $r =
array(
+ $r =
[
'from' => $fromTitle->getPrefixedText(),
'to' => $toTitle->getPrefixedText(),
'reason' => $params['reason']
'from' => $fromTitle->getPrefixedText(),
'to' => $toTitle->getPrefixedText(),
'reason' => $params['reason']
-
)
;
+
]
;
// NOTE: we assume that if the old title exists, it's because it was re-created as
// a redirect to the new title. This is not safe, but what we did before was
// NOTE: we assume that if the old title exists, it's because it was re-created as
// a redirect to the new title. This is not safe, but what we did before was
@@
-130,10
+135,8
@@
class ApiMove extends ApiBase {
$watch = $params['watchlist'];
} elseif ( $params['watch'] ) {
$watch = 'watch';
$watch = $params['watchlist'];
} elseif ( $params['watch'] ) {
$watch = 'watch';
- $this->logFeatureUsage( 'action=move&watch' );
} elseif ( $params['unwatch'] ) {
$watch = 'unwatch';
} elseif ( $params['unwatch'] ) {
$watch = 'unwatch';
- $this->logFeatureUsage( 'action=move&unwatch' );
}
// Watch pages
}
// Watch pages
@@
-178,16
+181,16
@@
class ApiMove extends ApiBase {
* @return array
*/
public function moveSubpages( $fromTitle, $toTitle, $reason, $noredirect ) {
* @return array
*/
public function moveSubpages( $fromTitle, $toTitle, $reason, $noredirect ) {
- $retval =
array()
;
+ $retval =
[]
;
$success = $fromTitle->moveSubpages( $toTitle, true, $reason, !$noredirect );
if ( isset( $success[0] ) ) {
$success = $fromTitle->moveSubpages( $toTitle, true, $reason, !$noredirect );
if ( isset( $success[0] ) ) {
- return
array( 'error' => $this->parseMsg( $success ) )
;
+ return
[ 'error' => $this->parseMsg( $success ) ]
;
}
// At least some pages could be moved
// Report each of them separately
foreach ( $success as $oldTitle => $newTitle ) {
}
// At least some pages could be moved
// Report each of them separately
foreach ( $success as $oldTitle => $newTitle ) {
- $r =
array( 'from' => $oldTitle )
;
+ $r =
[ 'from' => $oldTitle ]
;
if ( is_array( $newTitle ) ) {
$r['error'] = $this->parseMsg( reset( $newTitle ) );
} else {
if ( is_array( $newTitle ) ) {
$r['error'] = $this->parseMsg( reset( $newTitle ) );
} else {
@@
-209,38
+212,38
@@
class ApiMove extends ApiBase {
}
public function getAllowedParams() {
}
public function getAllowedParams() {
- return
array(
+ return
[
'from' => null,
'from' => null,
- 'fromid' =>
array(
+ 'fromid' =>
[
ApiBase::PARAM_TYPE => 'integer'
ApiBase::PARAM_TYPE => 'integer'
-
)
,
- 'to' =>
array(
+
]
,
+ 'to' =>
[
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
-
)
,
+
]
,
'reason' => '',
'movetalk' => false,
'movesubpages' => false,
'noredirect' => false,
'reason' => '',
'movetalk' => false,
'movesubpages' => false,
'noredirect' => false,
- 'watch' =>
array(
+ 'watch' =>
[
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
-
)
,
- 'unwatch' =>
array(
+
]
,
+ 'unwatch' =>
[
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
-
)
,
- 'watchlist' =>
array(
+
]
,
+ 'watchlist' =>
[
ApiBase::PARAM_DFLT => 'preferences',
ApiBase::PARAM_DFLT => 'preferences',
- ApiBase::PARAM_TYPE =>
array(
+ ApiBase::PARAM_TYPE =>
[
'watch',
'unwatch',
'preferences',
'nochange'
'watch',
'unwatch',
'preferences',
'nochange'
-
)
,
-
)
,
+
]
,
+
]
,
'ignorewarnings' => false
'ignorewarnings' => false
-
)
;
+
]
;
}
public function needsToken() {
}
public function needsToken() {
@@
-248,11
+251,11
@@
class ApiMove extends ApiBase {
}
protected function getExamplesMessages() {
}
protected function getExamplesMessages() {
- return
array(
+ return
[
'action=move&from=Badtitle&to=Goodtitle&token=123ABC&' .
'reason=Misspelled%20title&movetalk=&noredirect='
=> 'apihelp-move-example-move',
'action=move&from=Badtitle&to=Goodtitle&token=123ABC&' .
'reason=Misspelled%20title&movetalk=&noredirect='
=> 'apihelp-move-example-move',
-
)
;
+
]
;
}
public function getHelpUrls() {
}
public function getHelpUrls() {