r59543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59542‎ | r59543 | r59544 >
Date:10:49, 29 November 2009
Author:siebrand
Status:ok
Tags:
Comment:
Revert r59537. Breaks page deletion with "PHP Notice: Array to string conversion in /var/www/w/includes/db/Database.php on line 1433" and ""IndexPager::reallyDoQuery (LogPager)". Database returned error "1176: Key 'Array' doesn't exist in table 'logging' (localhost)"."
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -790,13 +790,10 @@
791791 $types = ($types === '') ? array() : (array)$types;
792792 // Don't even show header for private logs; don't recognize it...
793793 foreach ( $types as $type ) {
794 - if( isset( $wgLogRestrictions[$type] )
795 - && !$wgUser->isAllowed($wgLogRestrictions[$type])
796 - ) {
 794+ if( isset( $wgLogRestrictions[$type] ) && !$wgUser->isAllowed($wgLogRestrictions[$type]) ) {
797795 $types = array_diff( $types, array( $type ) );
798796 }
799797 }
800 - $this->types = $types;
801798 // Don't show private logs to unprivileged users.
802799 // Also, only show them upon specific request to avoid suprises.
803800 $audience = $types ? 'user' : 'public';
@@ -805,6 +802,7 @@
806803 $this->mConds[] = $hideLogs;
807804 }
808805 if( count($types) ) {
 806+ $this->types = $types;
809807 $this->mConds['log_type'] = $types;
810808 // Set typeCGI; used in url param for paging
811809 if( count($types) == 1 ) $this->typeCGI = $types[0];
@@ -892,25 +890,18 @@
893891 $tables = array( 'logging', 'user' );
894892 $this->mConds[] = 'user_id = log_user';
895893 $groupBy = false;
896 - $index = array();
897894 # Add log_search table if there are conditions on it
898895 if( array_key_exists('ls_field',$this->mConds) ) {
899896 $tables[] = 'log_search';
900 - $index['log_search'] = 'ls_field_val';
901 - $index['logging'] = 'PRIMARY';
 897+ $index = array( 'log_search' => 'ls_field_val', 'logging' => 'PRIMARY' );
902898 $groupBy = 'ls_log_id';
903 - # Avoid usage of the wrong index by limiting
904 - # the choices of available indexes. This mainly
905 - # avoids site-breaking filesorts.
 899+ # Don't use the wrong logging index
906900 } else if( $this->title || $this->pattern || $this->user ) {
907 - $index['logging'] = array( 'page_time', 'user_time' );
908 - if( count($this->types) == 1 ) {
909 - $index['logging'][] = array( 'log_user_type_time' );
910 - }
911 - } else if( count($this->types) == 1 ) {
912 - $index['logging'] = 'type_time';
 901+ $index = array( 'logging' => array('page_time','user_time') );
 902+ } else if( $this->types ) {
 903+ $index = array( 'logging' => 'type_time' );
913904 } else {
914 - $index['logging'] = 'times';
 905+ $index = array( 'logging' => 'times' );
915906 }
916907 $options = array( 'USE INDEX' => $index );
917908 # Don't show duplicate rows when using log_search

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59537* Made log_user_type_time index available when needed...aaron00:01, 29 November 2009

Status & tagging log