Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -979,11 +979,21 @@ |
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
| 983 | + /** |
| 984 | + * Constructs the most part of the query. Extra conditions are sprinkled in |
| 985 | + * all over this class. |
| 986 | + * @return array |
| 987 | + */ |
983 | 988 | public function getQueryInfo() { |
984 | | - $tables = array( 'logging', 'user' ); |
985 | | - $this->mConds[] = 'user_id = log_user'; |
| 989 | + $basic = DatabaseLogEntry::getSelectQueryData(); |
| 990 | + |
| 991 | + $tables = $basic['tables']; |
| 992 | + $fields = $basic['fields']; |
| 993 | + $conds = $basic['conds']; |
| 994 | + $options = $basic['options']; |
| 995 | + $joins = $basic['join_conds']; |
| 996 | + |
986 | 997 | $index = array(); |
987 | | - $options = array(); |
988 | 998 | # Add log_search table if there are conditions on it. |
989 | 999 | # This filters the results to only include log rows that have |
990 | 1000 | # log_search records with the specified ls_field and ls_value values. |
— | — | @@ -1014,17 +1024,14 @@ |
1015 | 1025 | } |
1016 | 1026 | $options['USE INDEX'] = $index; |
1017 | 1027 | # Don't show duplicate rows when using log_search |
| 1028 | + $joins['log_search'] = array( 'INNER JOIN', 'ls_log_id=log_id' ); |
| 1029 | + |
1018 | 1030 | $info = array( |
1019 | 1031 | 'tables' => $tables, |
1020 | | - 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', |
1021 | | - 'log_title', 'log_params', 'log_comment', 'log_id', 'log_deleted', |
1022 | | - 'log_timestamp', 'user_name', 'user_editcount' ), |
1023 | | - 'conds' => $this->mConds, |
| 1032 | + 'fields' => $fields, |
| 1033 | + 'conds' => $conds + $this->mConds, |
1024 | 1034 | 'options' => $options, |
1025 | | - 'join_conds' => array( |
1026 | | - 'user' => array( 'INNER JOIN', 'user_id=log_user' ), |
1027 | | - 'log_search' => array( 'INNER JOIN', 'ls_log_id=log_id' ) |
1028 | | - ) |
| 1035 | + 'join_conds' => $joins, |
1029 | 1036 | ); |
1030 | 1037 | # Add ChangeTags filter query |
1031 | 1038 | ChangeTags::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'], |