r97930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97929‎ | r97930 | r97931 >
Date:17:21, 23 September 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Use local context instead of global variables
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -821,15 +821,15 @@
822822
823823 // Call ONLY after calling $this->limitType() already!
824824 public function getFilterParams() {
825 - global $wgFilterLogTypes, $wgUser, $wgRequest;
 825+ global $wgFilterLogTypes;
826826 $filters = array();
827827 if( count($this->types) ) {
828828 return $filters;
829829 }
830830 foreach( $wgFilterLogTypes as $type => $default ) {
831831 // Avoid silly filtering
832 - if( $type !== 'patrol' || $wgUser->useNPPatrol() ) {
833 - $hide = $wgRequest->getInt( "hide_{$type}_log", $default );
 832+ if( $type !== 'patrol' || $this->getUser()->useNPPatrol() ) {
 833+ $hide = $this->getRequest()->getInt( "hide_{$type}_log", $default );
834834 $filters[$type] = $hide;
835835 if( $hide )
836836 $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
@@ -846,13 +846,13 @@
847847 * empty string means no restriction
848848 */
849849 private function limitType( $types ) {
850 - global $wgLogRestrictions, $wgUser;
 850+ global $wgLogRestrictions;
851851 // If $types is not an array, make it an array
852852 $types = ($types === '') ? array() : (array)$types;
853853 // Don't even show header for private logs; don't recognize it...
854854 foreach ( $types as $type ) {
855855 if( isset( $wgLogRestrictions[$type] )
856 - && !$wgUser->isAllowed($wgLogRestrictions[$type])
 856+ && !$this->getUser()->isAllowed($wgLogRestrictions[$type])
857857 ) {
858858 $types = array_diff( $types, array( $type ) );
859859 }
@@ -892,12 +892,12 @@
893893 but for now it won't pass anywhere behind the optimizer */
894894 $this->mConds[] = "NULL";
895895 } else {
896 - global $wgUser;
897896 $this->mConds['log_user'] = $userid;
898897 // Paranoia: avoid brute force searches (bug 17342)
899 - if( !$wgUser->isAllowed( 'deletedhistory' ) || $wgUser->isBlocked() ) {
 898+ $user = $this->getUser();
 899+ if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() ) {
900900 $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
901 - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) || $wgUser->isBlocked() ) {
 901+ } elseif( !$user->isAllowed( 'suppressrevision' ) || $user->isBlocked() ) {
902902 $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
903903 ' != ' . LogPage::SUPPRESSED_USER;
904904 }
@@ -913,7 +913,7 @@
914914 * @param $pattern String
915915 */
916916 private function limitTitle( $page, $pattern ) {
917 - global $wgMiserMode, $wgUser;
 917+ global $wgMiserMode;
918918
919919 $title = Title::newFromText( $page );
920920 if( strlen( $page ) == 0 || !$title instanceof Title ) {
@@ -944,9 +944,10 @@
945945 $this->mConds['log_title'] = $title->getDBkey();
946946 }
947947 // Paranoia: avoid brute force searches (bug 17342)
948 - if( !$wgUser->isAllowed( 'deletedhistory' ) || $wgUser->isBlocked() ) {
 948+ $user = $this->getUser();
 949+ if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() ) {
949950 $this->mConds[] = $db->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0';
950 - } elseif( !$wgUser->isAllowed( 'suppressrevision' ) || $wgUser->isBlocked() ) {
 951+ } elseif( !$user->isAllowed( 'suppressrevision' ) || $user->isBlocked() ) {
951952 $this->mConds[] = $db->bitAnd('log_deleted', LogPage::SUPPRESSED_ACTION) .
952953 ' != ' . LogPage::SUPPRESSED_ACTION;
953954 }

Comments

#Comment by Krinkle (talk | contribs)   20:11, 24 September 2011

Pager has context ?

#Comment by Krinkle (talk | contribs)   20:12, 24 September 2011

Oh, really. It does..

Status & tagging log