X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRecentChanges.php;h=143d4662a1da7639a9ad506b11c687ec505fe1f7;hb=320ec708e4b887a41f1532797cf1a114d240df4b;hp=8ae1b668b42240f5a7c69cd81064ed6ecdc77f3f;hpb=70dd429741fc97492d818c28bed6a6e58a70595a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 8ae1b668b4..143d4662a1 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -312,12 +312,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { /* Add fields to our query if they are specified as a needed parameter. */ $this->addFieldsIf( [ 'rc_this_oldid', 'rc_last_oldid' ], $this->fld_ids ); - if ( $this->fld_user || $this->fld_userid ) { - $actorQuery = ActorMigration::newMigration()->getJoin( 'rc_user' ); - $this->addTables( $actorQuery['tables'] ); - $this->addFields( $actorQuery['fields'] ); - $this->addJoinConds( $actorQuery['joins'] ); - } $this->addFieldsIf( [ 'rc_minor', 'rc_type', 'rc_bot' ], $this->fld_flags ); $this->addFieldsIf( [ 'rc_old_len', 'rc_new_len' ], $this->fld_sizes ); $this->addFieldsIf( [ 'rc_patrolled', 'rc_log_type' ], $this->fld_patrolled ); @@ -367,9 +361,11 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { // Paranoia: avoid brute force searches (T19342) if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) { - if ( !$user->isAllowed( 'deletedhistory' ) ) { + if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) ) { $bitmask = RevisionRecord::DELETED_USER; - } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) { + } elseif ( !$this->getPermissionManager() + ->userHasAnyRight( $user, 'suppressrevision', 'viewsuppressed' ) + ) { $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED; } else { $bitmask = 0; @@ -380,9 +376,11 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { } if ( $this->getRequest()->getCheck( 'namespace' ) ) { // LogPage::DELETED_ACTION hides the affected page, too. - if ( !$user->isAllowed( 'deletedhistory' ) ) { + if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) ) { $bitmask = LogPage::DELETED_ACTION; - } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) { + } elseif ( !$this->getPermissionManager() + ->userHasAnyRight( $user, 'suppressrevision', 'viewsuppressed' ) + ) { $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED; } else { $bitmask = 0; @@ -405,6 +403,14 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->addJoinConds( $commentQuery['joins'] ); } + if ( $this->fld_user || $this->fld_userid || !is_null( $this->token ) ) { + // Token needs rc_user for RecentChange::newFromRow/User::newFromAnyId (T228425) + $actorQuery = ActorMigration::newMigration()->getJoin( 'rc_user' ); + $this->addTables( $actorQuery['tables'] ); + $this->addFields( $actorQuery['fields'] ); + $this->addJoinConds( $actorQuery['joins'] ); + } + $this->addOption( 'LIMIT', $params['limit'] + 1 ); $hookData = [];