Migrate WatchedItemQueryService from tag_summary to change_tag
[lhc/web/wiklou.git] / includes / watcheditem / WatchedItemQueryService.php
index a477b64..95b4cb4 100644 (file)
@@ -220,7 +220,7 @@ class WatchedItemQueryService {
                        $joinConds
                );
 
-               $limit = isset( $dbOptions['LIMIT'] ) ? $dbOptions['LIMIT'] : INF;
+               $limit = $dbOptions['LIMIT'] ?? INF;
                $items = [];
                $startFrom = null;
                foreach ( $res as $row ) {
@@ -320,8 +320,8 @@ class WatchedItemQueryService {
        }
 
        private function getRecentChangeFieldsFromRow( stdClass $row ) {
-               // This can be simplified to single array_filter call filtering by key value,
-               // once we stop supporting PHP 5.5
+               // FIXME: This can be simplified to single array_filter call filtering by key value,
+               // now we have stopped supporting PHP 5.5
                $allFields = get_object_vars( $row );
                $rcKeys = array_filter(
                        array_keys( $allFields ),
@@ -340,9 +340,6 @@ class WatchedItemQueryService {
                if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
                        $tables += $this->commentStore->getJoin( 'rc_comment' )['tables'];
                }
-               if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] ) ) {
-                       $tables[] = 'tag_summary';
-               }
                if ( in_array( self::INCLUDE_USER, $options['includeFields'] ) ||
                        in_array( self::INCLUDE_USER_ID, $options['includeFields'] ) ||
                        in_array( self::FILTER_ANON, $options['filters'] ) ||
@@ -402,7 +399,7 @@ class WatchedItemQueryService {
                }
                if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] ) ) {
                        // prefixed with rc_ to include the field in getRecentChangeFieldsFromRow
-                       $fields['rc_tags'] = 'ts_tags';
+                       $fields['rc_tags'] = ChangeTags::makeTagSummarySubquery( 'recentchanges' );
                }
 
                return $fields;
@@ -710,9 +707,6 @@ class WatchedItemQueryService {
                if ( in_array( self::INCLUDE_COMMENT, $options['includeFields'] ) ) {
                        $joinConds += $this->commentStore->getJoin( 'rc_comment' )['joins'];
                }
-               if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] ) ) {
-                       $joinConds['tag_summary'] = [ 'LEFT JOIN', [ 'rc_id=ts_rc_id' ] ];
-               }
                if ( in_array( self::INCLUDE_USER, $options['includeFields'] ) ||
                        in_array( self::INCLUDE_USER_ID, $options['includeFields'] ) ||
                        in_array( self::FILTER_ANON, $options['filters'] ) ||