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 "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiSetNotificationTimestamp.php
diff --git
a/includes/api/ApiSetNotificationTimestamp.php
b/includes/api/ApiSetNotificationTimestamp.php
index
f335682
..
5769ff6
100644
(file)
--- a/
includes/api/ApiSetNotificationTimestamp.php
+++ b/
includes/api/ApiSetNotificationTimestamp.php
@@
-38,11
+38,9
@@
class ApiSetNotificationTimestamp extends ApiBase {
$user = $this->getUser();
if ( $user->isAnon() ) {
$user = $this->getUser();
if ( $user->isAnon() ) {
- $this->dieUsage( 'Anonymous users cannot use watchlist change notifications', 'notloggedin' );
- }
- if ( !$user->isAllowed( 'editmywatchlist' ) ) {
- $this->dieUsage( 'You don\'t have permission to edit your watchlist', 'permissiondenied' );
+ $this->dieWithError( 'watchlistanontext', 'notloggedin' );
}
}
+ $this->checkUserRightsAny( 'editmywatchlist' );
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'timestamp', 'torevid', 'newerthanrevid' );
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'timestamp', 'torevid', 'newerthanrevid' );
@@
-52,8
+50,12
@@
class ApiSetNotificationTimestamp extends ApiBase {
$pageSet = $this->getPageSet();
if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) {
$pageSet = $this->getPageSet();
if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) {
- $this->dieUsage(
- "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'",
+ $this->dieWithError(
+ [
+ 'apierror-invalidparammix-cannotusewith',
+ $this->encodeParamName( 'entirewatchlist' ),
+ $pageSet->encodeParamName( $pageSet->getDataSource() )
+ ],
'multisource'
);
}
'multisource'
);
}
@@
-71,7
+73,7
@@
class ApiSetNotificationTimestamp extends ApiBase {
if ( isset( $params['torevid'] ) ) {
if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) {
if ( isset( $params['torevid'] ) ) {
if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) {
- $this->die
Usage( 'torevid may only be used with a single page', 'multpages'
);
+ $this->die
WithError( [ 'apierror-multpages', $this->encodeParamName( 'torevid' ) ]
);
}
$title = reset( $pageSet->getGoodTitles() );
if ( $title ) {
}
$title = reset( $pageSet->getGoodTitles() );
if ( $title ) {
@@
-85,7
+87,7
@@
class ApiSetNotificationTimestamp extends ApiBase {
}
} elseif ( isset( $params['newerthanrevid'] ) ) {
if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) {
}
} elseif ( isset( $params['newerthanrevid'] ) ) {
if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) {
- $this->die
Usage( 'newerthanrevid may only be used with a single page', 'multpages'
);
+ $this->die
WithError( [ 'apierror-multpages', $this->encodeParamName( 'newerthanrevid' ) ]
);
}
$title = reset( $pageSet->getGoodTitles() );
if ( $title ) {
}
$title = reset( $pageSet->getGoodTitles() );
if ( $title ) {
@@
-158,6
+160,9
@@
class ApiSetNotificationTimestamp extends ApiBase {
];
if ( !$title->exists() ) {
$r['missing'] = true;
];
if ( !$title->exists() ) {
$r['missing'] = true;
+ if ( $title->isKnown() ) {
+ $r['known'] = true;
+ }
}
if ( isset( $timestamps[$ns] ) && array_key_exists( $dbkey, $timestamps[$ns] ) ) {
$r['notificationtimestamp'] = '';
}
if ( isset( $timestamps[$ns] ) && array_key_exists( $dbkey, $timestamps[$ns] ) ) {
$r['notificationtimestamp'] = '';