r32958 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32957‎ | r32958 | r32959 >
Date:13:58, 8 April 2008
Author:simetrical
Status:old
Tags:
Comment:
Special-case the WHERE for a single restricted log type; use the database functions for escaping and making lists.
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -372,15 +372,17 @@
373373 global $wgLogRestrictions, $wgUser;
374374 // Reset the array, clears extra "where" clauses when $par is used
375375 $hiddenLogs = array();
376 - // Don't show private logs to unpriviledged users
 376+ // Don't show private logs to unprivileged users
377377 foreach( $wgLogRestrictions as $logtype => $right ) {
378378 if( !$wgUser->isAllowed($right) ) {
379379 $safetype = $db->strencode( $logtype );
380 - $hiddenLogs[] = "'$safetype'";
 380+ $hiddenLogs[] = $safetype;
381381 }
382382 }
383 - if( !empty($hiddenLogs) ) {
384 - return 'log_type NOT IN(' . implode(',',$hiddenLogs) . ')';
 383+ if( count($hiddenLogs) == 1 ) {
 384+ return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
 385+ } elseif( !empty( $hiddenLogs ) ) {
 386+ return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')';
385387 }
386388 return false;
387389 }

Status & tagging log