X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fchanges%2FRecentChange.php;h=1d590d9c36a076fea4e2da09345a3c1f543da6e7;hb=824469f51cc1c159130bd4eddcf98cbf528798b6;hp=95c9fa6c63bbabb96c1565d21c6894fcedb259a4;hpb=bd62b3562ab80c5da331fe4d4eeb9bbf336e79c3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 95c9fa6c63..1d590d9c36 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -20,6 +20,7 @@ * @file */ use MediaWiki\ChangeTags\Taggable; +use MediaWiki\MediaWikiServices; /** * Utility class for creating new RC entries @@ -89,16 +90,17 @@ class RecentChange implements Taggable { */ const SEND_FEED = false; + /** @var array */ public $mAttribs = []; public $mExtra = []; /** - * @var Title + * @var Title|false */ public $mTitle = false; /** - * @var User + * @var User|false */ private $mPerformer = false; @@ -390,7 +392,7 @@ class RecentChange implements Taggable { } # If our database is strict about IP addresses, use NULL instead of an empty string - $strictIPs = in_array( $dbw->getType(), [ 'oracle', 'postgres' ] ); // legacy + $strictIPs = $dbw->getType() === 'postgres'; // legacy if ( $strictIPs && $this->mAttribs['rc_ip'] == '' ) { unset( $this->mAttribs['rc_ip'] ); } @@ -608,8 +610,9 @@ class RecentChange implements Taggable { } // Users without the 'autopatrol' right can't patrol their // own revisions - if ( $user->getName() === $this->getAttribute( 'rc_user_text' ) - && !$user->isAllowed( 'autopatrol' ) + if ( $user->getName() === $this->getAttribute( 'rc_user_text' ) && + !MediaWikiServices::getInstance()->getPermissionManager() + ->userHasRight( $user, 'autopatrol' ) ) { $errors[] = [ 'markedaspatrollederror-noautopatrol' ]; } @@ -857,6 +860,7 @@ class RecentChange implements Taggable { $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '', $revId = 0, $isPatrollable = false ) { global $wgRequest; + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); # # Get pageStatus for email notification switch ( $type . '-' . $action ) { @@ -881,7 +885,8 @@ class RecentChange implements Taggable { } // Allow unpatrolled status for patrollable log entries - $markPatrolled = $isPatrollable ? $user->isAllowed( 'autopatrol' ) : true; + $canAutopatrol = $permissionManager->userHasRight( $user, 'autopatrol' ); + $markPatrolled = $isPatrollable ? $canAutopatrol : true; $rc = new RecentChange; $rc->mTitle = $target; @@ -902,7 +907,8 @@ class RecentChange implements Taggable { 'rc_comment_data' => null, 'rc_this_oldid' => $revId, 'rc_last_oldid' => 0, - 'rc_bot' => $user->isAllowed( 'bot' ) ? (int)$wgRequest->getBool( 'bot', true ) : 0, + 'rc_bot' => $permissionManager->userHasRight( $user, 'bot' ) ? + (int)$wgRequest->getBool( 'bot', true ) : 0, 'rc_ip' => self::checkIPAddress( $ip ), 'rc_patrolled' => $markPatrolled ? self::PRC_AUTOPATROLLED : self::PRC_UNPATROLLED, 'rc_new' => 0, # obsolete