r57579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57578‎ | r57579 | r57580 >
Date:19:01, 9 October 2009
Author:aaron
Status:ok
Tags:
Comment:
Follow up r57530 elsewhere
Modified paths:
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ArchivedFile.php (modified) (history)
  • /trunk/phase3/includes/filerepo/OldLocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/OldLocalFile.php
@@ -197,9 +197,14 @@
198198 function userCan( $field ) {
199199 if( isset($this->deleted) && ($this->deleted & $field) ) {
200200 global $wgUser;
201 - $permission = ( $this->deleted & File::DELETED_RESTRICTED )
202 - ? 'suppressrevision'
203 - : ( $field & File::DELETED_FILE ) ? 'deletedtext' : 'deletedhistory';
 201+ $permission = '';
 202+ if ( $this->deleted & self::DELETED_RESTRICTED ) {
 203+ $permission = 'suppressrevision';
 204+ } elseif ( $field & self::DELETED_TEXT ) {
 205+ $permission = 'deletedtext';
 206+ } else {
 207+ $permission = 'deletedhistory';
 208+ }
204209 wfDebug( "Checking for $permission due to $field match on $this->mDeleted\n" );
205210 return $wgUser->isAllowed( $permission );
206211 } else {
Index: trunk/phase3/includes/filerepo/ArchivedFile.php
@@ -379,9 +379,14 @@
380380 $this->load();
381381 if( $this->deleted & $field ) {
382382 global $wgUser;
383 - $permission = ( $this->deleted & File::DELETED_RESTRICTED )
384 - ? 'suppressrevision'
385 - : ( $field & File::DELETED_FILE ) ? 'deletedtext' : 'deletedhistory';
 383+ $permission = '';
 384+ if ( $this->deleted & self::DELETED_RESTRICTED ) {
 385+ $permission = 'suppressrevision';
 386+ } elseif ( $field & self::DELETED_TEXT ) {
 387+ $permission = 'deletedtext';
 388+ } else {
 389+ $permission = 'deletedhistory';
 390+ }
386391 wfDebug( "Checking for $permission due to $field match on $this->deleted\n" );
387392 return $wgUser->isAllowed( $permission );
388393 } else {
Index: trunk/phase3/includes/LogEventsList.php
@@ -549,9 +549,14 @@
550550 public static function userCan( $row, $field ) {
551551 if( $row->log_deleted & $field ) {
552552 global $wgUser;
553 - $permission = ( $row->log_deleted & LogPage::DELETED_RESTRICTED )
554 - ? 'suppressrevision'
555 - : 'deletedhistory';
 553+ $permission = '';
 554+ if ( $this->log_deleted & self::DELETED_RESTRICTED ) {
 555+ $permission = 'suppressrevision';
 556+ } elseif ( $field & self::DELETED_TEXT ) {
 557+ $permission = 'deletedtext';
 558+ } else {
 559+ $permission = 'deletedhistory';
 560+ }
556561 wfDebug( "Checking for $permission due to $field match on $row->log_deleted\n" );
557562 return $wgUser->isAllowed( $permission );
558563 } else {
Index: trunk/phase3/includes/Revision.php
@@ -979,7 +979,6 @@
980980 public function userCan( $field ) {
981981 if( $this->mDeleted & $field ) {
982982 global $wgUser;
983 -
984983 $permission = '';
985984 if ( $this->mDeleted & self::DELETED_RESTRICTED ) {
986985 $permission = 'suppressrevision';
@@ -988,7 +987,6 @@
989988 } else {
990989 $permission = 'deletedhistory';
991990 }
992 -
993991 wfDebug( "Checking for $permission due to $field match on $this->mDeleted\n" );
994992 return $wgUser->isAllowed( $permission );
995993 } else {
Index: trunk/phase3/includes/ChangesList.php
@@ -448,9 +448,14 @@
449449 public static function userCan( $rc, $field ) {
450450 if( $rc->mAttribs['rc_deleted'] & $field ) {
451451 global $wgUser;
452 - $permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED )
453 - ? 'suppressrevision'
454 - : ( $field & Revision::DELETED_TEXT ) ? 'deletedtext' : 'deletedhistory';
 452+ $permission = '';
 453+ if ( $rc->mAttribs['rc_deleted'] & self::DELETED_RESTRICTED ) {
 454+ $permission = 'suppressrevision';
 455+ } elseif ( $field & self::DELETED_TEXT ) {
 456+ $permission = 'deletedtext';
 457+ } else {
 458+ $permission = 'deletedhistory';
 459+ }
455460 wfDebug( "Checking for $permission due to $field match on {$rc->mAttribs['rc_deleted']}\n" );
456461 return $wgUser->isAllowed( $permission );
457462 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r57582merged r57579aaron19:14, 9 October 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57530Replace broken nested terneries (causing a nasty bug where all admins could v...werdna19:40, 8 October 2009

Status & tagging log