Merge "Add SPARQL client to core"
[lhc/web/wiklou.git] / includes / api / ApiQueryWatchlist.php
index 1e3b2c7..69f1838 100644 (file)
@@ -1,9 +1,5 @@
 <?php
 /**
- *
- *
- * Created on Sep 25, 2006
- *
  * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
@@ -53,7 +49,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                $fld_flags = false, $fld_timestamp = false, $fld_user = false,
                $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
                $fld_notificationtimestamp = false, $fld_userid = false,
-               $fld_loginfo = false;
+               $fld_loginfo = false, $fld_tags;
 
        /**
         * @param ApiPageSet $resultPageSet
@@ -82,6 +78,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        $this->fld_patrol = isset( $prop['patrol'] );
                        $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
                        $this->fld_loginfo = isset( $prop['loginfo'] );
+                       $this->fld_tags = isset( $prop['tags'] );
 
                        if ( $this->fld_patrol ) {
                                if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
@@ -90,7 +87,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        }
 
                        if ( $this->fld_comment || $this->fld_parsedcomment ) {
-                               $this->commentStore = new CommentStore( 'rc_comment' );
+                               $this->commentStore = CommentStore::getStore();
                        }
                }
 
@@ -243,6 +240,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                if ( $this->fld_loginfo ) {
                        $includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
                }
+               if ( $this->fld_tags ) {
+                       $includeFields[] = WatchedItemQueryService::INCLUDE_TAGS;
+               }
                return $includeFields;
        }
 
@@ -357,7 +357,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                Revision::DELETED_COMMENT,
                                $user
                        ) ) {
-                               $comment = $this->commentStore->getComment( $recentChangeInfo )->text;
+                               $comment = $this->commentStore->getComment( 'rc_comment', $recentChangeInfo )->text;
                                if ( $this->fld_comment ) {
                                        $vals['comment'] = $comment;
                                }
@@ -391,6 +391,16 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        }
                }
 
+               if ( $this->fld_tags ) {
+                       if ( $recentChangeInfo['rc_tags'] ) {
+                               $tags = explode( ',', $recentChangeInfo['rc_tags'] );
+                               ApiResult::setIndexedTagName( $tags, 'tag' );
+                               $vals['tags'] = $tags;
+                       } else {
+                               $vals['tags'] = [];
+                       }
+               }
+
                if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_RESTRICTED ) ) {
                        $vals['suppressed'] = true;
                }
@@ -453,6 +463,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                        'sizes',
                                        'notificationtimestamp',
                                        'loginfo',
+                                       'tags',
                                ]
                        ],
                        'show' => [