diff options
author | DannyS712 <DannyS712.enwiki@gmail.com> | 2020-11-20 02:58:45 +0000 |
---|---|---|
committer | DannyS712 <DannyS712.enwiki@gmail.com> | 2020-11-20 06:24:51 +0000 |
commit | 9fefe2eac0419c154e35fa3b5bbc0e8308526798 (patch) | |
tree | 9745ad4413a3278f0c5b9c4f3e141505685fc3d1 /includes/api/ApiQueryWatchlist.php | |
parent | b1796f314e48e7f6a02a75d838cb8637aa866891 (diff) | |
download | mediawikicore-9fefe2eac0419c154e35fa3b5bbc0e8308526798.tar.gz mediawikicore-9fefe2eac0419c154e35fa3b5bbc0e8308526798.zip |
ApiQueryWatchlist: Allow requesting expiry
Add the `expiry` wlprop to get the timestamp with the
TS_ISO_8601 format. If the item doesn't expire, the
value is set to false.
Bug: T263796
Change-Id: I73f378f11662934255da4a41af9d1bc3d7b45030
Diffstat (limited to 'includes/api/ApiQueryWatchlist.php')
-rw-r--r-- | includes/api/ApiQueryWatchlist.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 08ab7d706122..075e3af1682a 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -57,6 +57,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $fld_notificationtimestamp = false, $fld_userid = false, $fld_loginfo = false, $fld_tags; + /** @var bool */ + private $fld_expiry = false; + /** * @param ApiPageSet|null $resultPageSet * @return void @@ -85,6 +88,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] ); $this->fld_loginfo = isset( $prop['loginfo'] ); $this->fld_tags = isset( $prop['tags'] ); + $this->fld_expiry = isset( $prop['expiry'] ); if ( $this->fld_patrol && !$user->useRCPatrol() && !$user->useNPPatrol() ) { $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' ); @@ -424,6 +428,12 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { } } + if ( $this->fld_expiry ) { + // Add expiration, T263796 + $expiry = $watchedItem->getExpiry( TS_ISO_8601 ); + $vals['expiry'] = ( $expiry === null ? false : $expiry ); + } + if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_RESTRICTED ) ) { $vals['suppressed'] = true; } @@ -488,6 +498,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { 'notificationtimestamp', 'loginfo', 'tags', + 'expiry', ] ], 'show' => [ @@ -533,6 +544,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { => 'apihelp-query+watchlist-example-simple', 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment' => 'apihelp-query+watchlist-example-props', + 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment|expiry' + => 'apihelp-query+watchlist-example-expiry', 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment' => 'apihelp-query+watchlist-example-allrev', 'action=query&generator=watchlist&prop=info' |