- $prop = $params['prop'];
- $this->fld_ids = in_array('ids', $prop);
- $this->fld_title = in_array('title', $prop);
- $this->fld_type = in_array('type', $prop);
- $this->fld_user = in_array('user', $prop);
- $this->fld_timestamp = in_array('timestamp', $prop);
- $this->fld_comment = in_array('comment', $prop);
- $this->fld_details = in_array('details', $prop);
-
- list($tbl_logging, $tbl_page, $tbl_user) = $db->tableNamesN('logging', 'page', 'user');
-
- $hideLogs = LogEventsList::getExcludeClause($db);
- if($hideLogs !== false)
- $this->addWhere($hideLogs);
-
- $this->addTables('user');
- $this->addWhere('user_id=log_user');
- $this->addJoin(
- array('logging', 'page'),
- array(ApiQueryBase::LEFT_JOIN),
- array(
- array( 'log_title=page_title',
- 'log_namespace=page_namespace'
- )));
-
- $this->addFields(array (
+ $prop = array_flip( $params['prop'] );
+
+ $this->fld_ids = isset( $prop['ids'] );
+ $this->fld_title = isset( $prop['title'] );
+ $this->fld_type = isset( $prop['type'] );
+ $this->fld_action = isset ( $prop['action'] );
+ $this->fld_user = isset( $prop['user'] );
+ $this->fld_userid = isset( $prop['userid'] );
+ $this->fld_timestamp = isset( $prop['timestamp'] );
+ $this->fld_comment = isset( $prop['comment'] );
+ $this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
+ $this->fld_details = isset( $prop['details'] );
+ $this->fld_tags = isset( $prop['tags'] );
+
+ $hideLogs = LogEventsList::getExcludeClause( $db );
+ if ( $hideLogs !== false ) {
+ $this->addWhere( $hideLogs );
+ }
+
+ // Order is significant here
+ $this->addTables( array( 'logging', 'user', 'page' ) );
+ $this->addOption( 'STRAIGHT_JOIN' );
+ $this->addJoinConds( array(
+ 'user' => array( 'JOIN',
+ 'user_id=log_user' ),
+ 'page' => array( 'LEFT JOIN',
+ array( 'log_namespace=page_namespace',
+ 'log_title=page_title' ) ) ) );
+ $index = array( 'logging' => 'times' ); // default, may change
+
+ $this->addFields( array(