r32723 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32722‎ | r32723 | r32724 >
Date:19:01, 2 April 2008
Author:aaron
Status:old
Tags:
Comment:
Use isDeleted()
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -19,6 +19,7 @@
2020
2121 class LogEventsList {
2222 const NO_ACTION_LINK = 1;
 23+
2324 private $skin;
2425 public $flags;
2526
@@ -252,7 +253,7 @@
253254 }
254255 }
255256 // Event description
256 - if( $row->log_deleted & LogPage::DELETED_ACTION ) {
 257+ if( self::isDeleted($row,LogPage::DELETED_ACTION) ) {
257258 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
258259 } else {
259260 $action = LogPage::actionText( $row->log_type, $row->log_action, $title, $this->skin, $paramArray, true );
@@ -288,28 +289,6 @@
289290 }
290291
291292 /**
292 - * SQL clause to skip forbidden log types for this user
293 - * @param Database $db
294 - * @returns mixed (string or false)
295 - */
296 - public static function getExcludeClause( $db ) {
297 - global $wgLogRestrictions, $wgUser;
298 - // Reset the array, clears extra "where" clauses when $par is used
299 - $hiddenLogs = array();
300 - // Don't show private logs to unpriviledged users
301 - foreach( $wgLogRestrictions as $logtype => $right ) {
302 - if( !$wgUser->isAllowed($right) ) {
303 - $safetype = $db->strencode( $logtype );
304 - $hiddenLogs[] = "'$safetype'";
305 - }
306 - }
307 - if( !empty($hiddenLogs) ) {
308 - return 'log_type NOT IN(' . implode(',',$hiddenLogs) . ')';
309 - }
310 - return false;
311 - }
312 -
313 - /**
314293 * Determine if the current user is allowed to view a particular
315294 * field of this log row, if it's marked as deleted.
316295 * @param Row $row
@@ -337,6 +316,28 @@
338317 public static function isDeleted( $row, $field ) {
339318 return ($row->log_deleted & $field) == $field;
340319 }
 320+
 321+ /**
 322+ * SQL clause to skip forbidden log types for this user
 323+ * @param Database $db
 324+ * @returns mixed (string or false)
 325+ */
 326+ public static function getExcludeClause( $db ) {
 327+ global $wgLogRestrictions, $wgUser;
 328+ // Reset the array, clears extra "where" clauses when $par is used
 329+ $hiddenLogs = array();
 330+ // Don't show private logs to unpriviledged users
 331+ foreach( $wgLogRestrictions as $logtype => $right ) {
 332+ if( !$wgUser->isAllowed($right) ) {
 333+ $safetype = $db->strencode( $logtype );
 334+ $hiddenLogs[] = "'$safetype'";
 335+ }
 336+ }
 337+ if( !empty($hiddenLogs) ) {
 338+ return 'log_type NOT IN(' . implode(',',$hiddenLogs) . ')';
 339+ }
 340+ return false;
 341+ }
341342 }
342343
343344 /**

Status & tagging log