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
Replace User::isAllowed with PermissionManager.
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiQueryRevisions.php
diff --git
a/includes/api/ApiQueryRevisions.php
b/includes/api/ApiQueryRevisions.php
index
7e46c1a
..
3a06e36
100644
(file)
--- a/
includes/api/ApiQueryRevisions.php
+++ b/
includes/api/ApiQueryRevisions.php
@@
-76,7
+76,8
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
*/
public static function getRollbackToken( $pageid, $title, $rev ) {
global $wgUser;
*/
public static function getRollbackToken( $pageid, $title, $rev ) {
global $wgUser;
- if ( !$wgUser->isAllowed( 'rollback' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $wgUser, 'rollback' ) ) {
return false;
}
return false;
}
@@
-114,7
+115,7
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
if ( $revCount > 0 && $enumRevMode ) {
$this->dieWithError(
if ( $revCount > 0 && $enumRevMode ) {
$this->dieWithError(
- [ 'apierror-revisions-no
list
', $this->getModulePrefix() ], 'invalidparammix'
+ [ 'apierror-revisions-no
revids
', $this->getModulePrefix() ], 'invalidparammix'
);
}
);
}
@@
-153,9
+154,6
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
if ( $this->token !== null || $pageCount > 0 ) {
$opts[] = 'page';
}
if ( $this->token !== null || $pageCount > 0 ) {
$opts[] = 'page';
}
- if ( $this->fetchContent ) {
- $opts[] = 'text';
- }
if ( $this->fld_user ) {
$opts[] = 'user';
}
if ( $this->fld_user ) {
$opts[] = 'user';
}
@@
-204,11
+202,12
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
if ( $resultPageSet === null && $this->fetchContent ) {
// For each page we will request, the user must have read rights for that page
if ( $resultPageSet === null && $this->fetchContent ) {
// For each page we will request, the user must have read rights for that page
- $user = $this->getUser();
$status = Status::newGood();
$status = Status::newGood();
+ $user = $this->getUser();
+
/** @var Title $title */
foreach ( $pageSet->getGoodTitles() as $title ) {
/** @var Title $title */
foreach ( $pageSet->getGoodTitles() as $title ) {
- if ( !$t
itle->userCan( 'read', $user
) ) {
+ if ( !$t
his->getPermissionManager()->userCan( 'read', $user, $title
) ) {
$status->fatal( ApiMessage::create(
[ 'apierror-cannotviewtitle', wfEscapeWikiText( $title->getPrefixedText() ) ],
'accessdenied'
$status->fatal( ApiMessage::create(
[ 'apierror-cannotviewtitle', wfEscapeWikiText( $title->getPrefixedText() ) ],
'accessdenied'
@@
-334,7
+333,7
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
}
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
// Paranoia: avoid brute force searches (T19342)
}
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
// Paranoia: avoid brute force searches (T19342)
- if ( !$this->get
User()->isAllowed(
'deletedhistory' ) ) {
+ if ( !$this->get
PermissionManager()->userHasRight( $this->getUser(),
'deletedhistory' ) ) {
$bitmask = RevisionRecord::DELETED_USER;
} elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
$bitmask = RevisionRecord::DELETED_USER;
} elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
@@
-392,6
+391,10
@@
class ApiQueryRevisions extends ApiQueryRevisionsBase {
$this->addOption( 'LIMIT', $this->limit + 1 );
$this->addOption( 'LIMIT', $this->limit + 1 );
+ // T224017: `rev_timestamp` is never the correct index to use for this module, but
+ // MariaDB (10.1.37-39) sometimes insists on trying to use it anyway. Tell it not to.
+ $this->addOption( 'IGNORE INDEX', [ 'revision' => 'rev_timestamp' ] );
+
$count = 0;
$generated = [];
$hookData = [];
$count = 0;
$generated = [];
$hookData = [];