MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/93075


Change subject: Allow callers to specify timestamp formats outputted by API
......................................................................

Allow callers to specify timestamp formats outputted by API

* Users can now request any MW-supported format with timestamps=...
* Modules that want to honor this use $this->timestamp() for data returned
* If no timestamp was specified, per-module defaults will be used, so that full
  b/c is achieved.
* query-continue still uses one format, same as before.
* Haven't touched several modules that format entries with static functions that
  don't have access to calling modules - will refactor them in a later commit.

Change-Id: I4c6703b9b0b606bd8142252d5485c61ee973a02b
---
M RELEASE-NOTES-1.23
M includes/api/ApiBase.php
M includes/api/ApiBlock.php
M includes/api/ApiEditPage.php
M includes/api/ApiMain.php
M includes/api/ApiProtect.php
M includes/api/ApiQueryAllUsers.php
M includes/api/ApiQueryBlocks.php
M includes/api/ApiQueryCategories.php
M includes/api/ApiQueryCategoryMembers.php
M includes/api/ApiQueryDeletedrevs.php
M includes/api/ApiQueryDuplicateFiles.php
M includes/api/ApiQueryFilearchive.php
M includes/api/ApiQueryInfo.php
M includes/api/ApiQueryProtectedTitles.php
M includes/api/ApiQueryQueryPage.php
M includes/api/ApiQueryRecentChanges.php
M includes/api/ApiQueryRevisions.php
M includes/api/ApiQuerySearch.php
M includes/api/ApiQuerySiteinfo.php
M includes/api/ApiQueryUserContributions.php
M includes/api/ApiQueryUserInfo.php
M includes/api/ApiQueryUsers.php
M includes/api/ApiQueryWatchlist.php
M includes/api/ApiQueryWatchlistRaw.php
M includes/api/ApiSetNotificationTimestamp.php
26 files changed, 135 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/93075/1

diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index 6c78253..c2af998 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -26,6 +26,8 @@
   acting as if the latest revision was being viewed.
 
 === API changes in 1.23 ===
+* By using the timestamps parameter, it is now possible to select the format of
+  timestamps returned by the API.
 
 === Languages updated in 1.23===
 
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index ce6ecda..9a7cea8 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -136,6 +136,26 @@
        }
 
        /**
+        * Returns this module's default timestamp format, can be overridden 
with
+        * timestamps=... api.php parameter
+        * @since 1.23
+        *
+        * @return int
+        */
+       public function getDefaultTimestampFormat() {
+               return TS_ISO_8601;
+       }
+
+       /**
+        * Returns timestamp format as globally requested or this module's 
defaults if no format specified
+        * @return int
+        */
+       public function getTimestampFormat() {
+               $format = $this->mMainModule->getTimestampFormat();
+               return $format === null ? $this->getDefaultTimestampFormat() : 
$format;
+       }
+
+       /**
         * Get the module manager, or null if this module has no sub-modules
         * @since 1.21
         * @return ApiModuleManager
@@ -1809,4 +1829,30 @@
                }
                print "\n</pre>\n";
        }
+
+       /**
+        * Formats timestamps in a globally requested format using this 
module's defaults if no format specified
+        * Use wfTimestamp() if you need to return a specific format
+        * @since 1.23
+        *
+        * @param int $timestamp
+        *
+        * @return string|bool: Formatted timestamp or false, same as 
wfTimestamp()
+        */
+       public function timestamp( $timestamp = 0 ) {
+               return wfTimestamp( $this->getTimestampFormat(), $timestamp );
+       }
+
+       /**
+        * same as timestamp() but returns null if input was null
+        * Use wfTimestamp() if you need to return a specific format
+        * @since 1.23
+        *
+        * @param int $timestamp
+        *
+        * @return string|bool|null: Formatted timestamp or false or null, same 
as wfTimestampOrNull()
+        */
+       public function timestampOrNull( $timestamp = 0 ) {
+               return wfTimestampOrNull( $this->getTimestampFormat(), 
$timestamp );
+       }
 }
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 975153a..aaaed12 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -101,7 +101,7 @@
                if ( $block instanceof Block ) {
                        $res['expiry'] = $block->mExpiry == 
$this->getDB()->getInfinity()
                                ? 'infinite'
-                               : wfTimestamp( TS_ISO_8601, $block->mExpiry );
+                               : $this->timestamp( $block->mExpiry );
                        $res['id'] = $block->getId();
                } else {
                        # should be unreachable
diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php
index bd61895..b6dfc9c 100644
--- a/includes/api/ApiEditPage.php
+++ b/includes/api/ApiEditPage.php
@@ -448,8 +448,7 @@
                                } else {
                                        $r['oldrevid'] = intval( $oldRevId );
                                        $r['newrevid'] = intval( $newRevId );
-                                       $r['newtimestamp'] = wfTimestamp( 
TS_ISO_8601,
-                                               $pageObj->getTimestamp() );
+                                       $r['newtimestamp'] = $this->timestamp( 
$pageObj->getTimestamp() );
                                }
                                break;
 
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index c11f16c..79de798 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -127,6 +127,18 @@
                )
        );
 
+       private static $timestampFormats = array(
+               'unix' => TS_UNIX,
+               'mw' => TS_MW,
+               'mysql' => TS_DB,
+               'rfc2822' => TS_RFC2822,
+               'iso8601' => TS_ISO_8601,
+               'iso8601-basic' => TS_ISO_8601_BASIC,
+               'exif' => TS_EXIF,
+               'oracle' => TS_ORACLE,
+               'postgres' => TS_POSTGRES,
+       );
+
        /**
         * @var ApiFormatBase
         */
@@ -140,6 +152,7 @@
        private $mCacheMode = 'private';
        private $mCacheControl = array();
        private $mParamsUsed = array();
+       private $mTimestampFormat = false;
 
        /**
         * Constructs an instance of ApiMain that utilizes the module and 
format specified by $request.
@@ -210,6 +223,24 @@
         */
        public function getResult() {
                return $this->mResult;
+       }
+
+       /**
+        * @return int|null
+        */
+       public function getTimestampFormat() {
+               if ( $this->mTimestampFormat === false ) {
+                       $params = $this->extractRequestParams();
+                       if ( isset( $params['timestamps'] ) ) {
+                               if ( !isset( 
self::$timestampFormats[$params['timestamps']] ) ) {
+                                       throw new MWException( "Unexpected 
timestamp format: {$params['timestamps']}" );
+                               }
+                               $this->mTimestampFormat = 
self::$timestampFormats[$params['timestamps']];
+                       } else {
+                               $this->mTimestampFormat = null;
+                       }
+               }
+               return $this->mTimestampFormat;
        }
 
        /**
@@ -1011,6 +1042,19 @@
                        'requestid' => null,
                        'servedby' => false,
                        'origin' => null,
+                       'timestamps' => array(
+                               ApiBase::PARAM_TYPE => array(
+                                       'unix',
+                                       'mw',
+                                       'mysql',
+                                       'rfc2822',
+                                       'iso8601',
+                                       'iso8601-basic',
+                                       'exif',
+                                       'oracle',
+                                       'postgres',
+                               ),
+                       ),
                );
        }
 
@@ -1042,6 +1086,19 @@
                                'If this parameter does not match the Origin: 
header, a 403 response will be returned.',
                                'If this parameter matches the Origin: header 
and the origin is whitelisted, an Access-Control-Allow-Origin header will be 
set.',
                        ),
+                       'timestamps' => array(
+                               'Timestamps format:',
+                               ' unix          - Unix, see 
https://en.wikipedia.org/wiki/Unix_time',
+                               ' mw            - MediaWiki format, e.g. 
20131031235959',
+                               ' mysql         - MySQL timestamp format e.g. 
2013-10-31 23:59:59, see https://dev.mysql.com/doc/refman/5.5/en/datetime.html',
+                               ' rfc2822       - RFC 2822, see 
https://tools.ietf.org/html/rfc2822',
+                               ' iso8601       - ISO 8601 e.g. 
2013-10-31T23:59:59Z, see https://en.wikipedia.org/wiki/ISO_8601',
+                               ' iso8601-basic - ISO 8601 basic without a 
timezone, e.g. 20131031T235959',
+                               ' exif          - EXIF, see 
http://exif.org/Exif2-2.PDF',
+                               ' oracle        - Oracle format',
+                               ' postgres      - PostgreSQL format',
+                               'Some API modules might choose to ignore this 
parameter.'
+                       ),
                );
        }
 
diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php
index 7830c8b..aabdaaa 100644
--- a/includes/api/ApiProtect.php
+++ b/includes/api/ApiProtect.php
@@ -92,7 +92,7 @@
                        $resultProtections[] = array( $p[0] => 
$protections[$p[0]],
                                        'expiry' => ( $expiryarray[$p[0]] == 
$db->getInfinity() ?
                                                                'infinite' :
-                                                               wfTimestamp( 
TS_ISO_8601, $expiryarray[$p[0]] ) ) );
+                                                               
$this->timestamp( $expiryarray[$p[0]] ) ) );
                }
 
                $cascade = $params['cascade'];
diff --git a/includes/api/ApiQueryAllUsers.php 
b/includes/api/ApiQueryAllUsers.php
index 1948a51..c0a0c87 100644
--- a/includes/api/ApiQueryAllUsers.php
+++ b/includes/api/ApiQueryAllUsers.php
@@ -241,7 +241,7 @@
                                }
                                if ( $fld_registration ) {
                                        $lastUserData['registration'] = 
$row->user_registration ?
-                                               wfTimestamp( TS_ISO_8601, 
$row->user_registration ) : '';
+                                               $this->timestamp( 
$row->user_registration ) : '';
                                }
                        }
 
diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php
index e3c27f5..8ca1512 100644
--- a/includes/api/ApiQueryBlocks.php
+++ b/includes/api/ApiQueryBlocks.php
@@ -186,7 +186,7 @@
                                $block['byid'] = $row->ipb_by;
                        }
                        if ( $fld_timestamp ) {
-                               $block['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->ipb_timestamp );
+                               $block['timestamp'] = $this->timestamp( 
$row->ipb_timestamp );
                        }
                        if ( $fld_expiry ) {
                                $block['expiry'] = $wgContLang->formatExpiry( 
$row->ipb_expiry, TS_ISO_8601 );
diff --git a/includes/api/ApiQueryCategories.php 
b/includes/api/ApiQueryCategories.php
index 5d714f5..30e0600 100644
--- a/includes/api/ApiQueryCategories.php
+++ b/includes/api/ApiQueryCategories.php
@@ -151,7 +151,7 @@
                                        $vals['sortkeyprefix'] = 
$row->cl_sortkey_prefix;
                                }
                                if ( isset( $prop['timestamp'] ) ) {
-                                       $vals['timestamp'] = wfTimestamp( 
TS_ISO_8601, $row->cl_timestamp );
+                                       $vals['timestamp'] = $this->timestamp( 
$row->cl_timestamp );
                                }
                                if ( isset( $prop['hidden'] ) && !is_null( 
$row->pp_propname ) ) {
                                        $vals['hidden'] = '';
diff --git a/includes/api/ApiQueryCategoryMembers.php 
b/includes/api/ApiQueryCategoryMembers.php
index 704d108..5d3c57f 100644
--- a/includes/api/ApiQueryCategoryMembers.php
+++ b/includes/api/ApiQueryCategoryMembers.php
@@ -221,7 +221,7 @@
                                        $vals['type'] = $row->cl_type;
                                }
                                if ( $fld_timestamp ) {
-                                       $vals['timestamp'] = wfTimestamp( 
TS_ISO_8601, $row->cl_timestamp );
+                                       $vals['timestamp'] = $this->timestamp( 
$row->cl_timestamp );
                                }
                                $fit = $result->addValue( array( 'query', 
$this->getModuleName() ),
                                                null, $vals );
diff --git a/includes/api/ApiQueryDeletedrevs.php 
b/includes/api/ApiQueryDeletedrevs.php
index 8273313..7fd9471 100644
--- a/includes/api/ApiQueryDeletedrevs.php
+++ b/includes/api/ApiQueryDeletedrevs.php
@@ -215,7 +215,7 @@
                        }
 
                        $rev = array();
-                       $rev['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->ar_timestamp );
+                       $rev['timestamp'] = $this->timestamp( 
$row->ar_timestamp );
                        if ( $fld_revid ) {
                                $rev['revid'] = intval( $row->ar_rev_id );
                        }
diff --git a/includes/api/ApiQueryDuplicateFiles.php 
b/includes/api/ApiQueryDuplicateFiles.php
index 0311fa7..a808fcd 100644
--- a/includes/api/ApiQueryDuplicateFiles.php
+++ b/includes/api/ApiQueryDuplicateFiles.php
@@ -136,7 +136,7 @@
                                        $r = array(
                                                'name' => $dupName,
                                                'user' => $dupFile->getUser( 
'text' ),
-                                               'timestamp' => wfTimestamp( 
TS_ISO_8601, $dupFile->getTimestamp() )
+                                               'timestamp' => 
$this->timestamp( $dupFile->getTimestamp() )
                                        );
                                        if ( !$dupFile->isLocal() ) {
                                                $r['shared'] = '';
diff --git a/includes/api/ApiQueryFilearchive.php 
b/includes/api/ApiQueryFilearchive.php
index f53cd38..436e717 100644
--- a/includes/api/ApiQueryFilearchive.php
+++ b/includes/api/ApiQueryFilearchive.php
@@ -151,7 +151,7 @@
                                $file['sha1'] = wfBaseConvert( $row->fa_sha1, 
36, 16, 40 );
                        }
                        if ( $fld_timestamp ) {
-                               $file['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->fa_timestamp );
+                               $file['timestamp'] = $this->timestamp( 
$row->fa_timestamp );
                        }
                        if ( $fld_user ) {
                                $file['userid'] = $row->fa_user;
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index 017684e..1a3ed63 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -358,7 +358,7 @@
                if ( $titleExists ) {
                        global $wgDisableCounters;
 
-                       $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, 
$this->pageTouched[$pageid] );
+                       $pageInfo['touched'] = $this->timestamp( 
$this->pageTouched[$pageid] );
                        $pageInfo['lastrevid'] = intval( 
$this->pageLatest[$pageid] );
                        $pageInfo['counter'] = $wgDisableCounters
                                ? ''
@@ -375,7 +375,7 @@
 
                if ( !is_null( $this->params['token'] ) ) {
                        $tokenFunctions = $this->getTokenFunctions();
-                       $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601, 
time() );
+                       $pageInfo['starttimestamp'] = $this->timestamp( time() 
);
                        foreach ( $this->params['token'] as $t ) {
                                $val = call_user_func( $tokenFunctions[$t], 
$pageid, $title );
                                if ( $val === false ) {
@@ -410,7 +410,7 @@
                if ( $this->fld_notificationtimestamp ) {
                        $pageInfo['notificationtimestamp'] = '';
                        if ( isset( $this->notificationtimestamps[$ns][$dbkey] 
) ) {
-                               $pageInfo['notificationtimestamp'] = 
wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
+                               $pageInfo['notificationtimestamp'] = 
$this->timestamp( $this->notificationtimestamps[$ns][$dbkey] );
                        }
                }
 
diff --git a/includes/api/ApiQueryProtectedTitles.php 
b/includes/api/ApiQueryProtectedTitles.php
index 222ad07..7c5b8dc 100644
--- a/includes/api/ApiQueryProtectedTitles.php
+++ b/includes/api/ApiQueryProtectedTitles.php
@@ -91,7 +91,7 @@
                                $vals = array();
                                ApiQueryBase::addTitleInfo( $vals, $title );
                                if ( isset( $prop['timestamp'] ) ) {
-                                       $vals['timestamp'] = wfTimestamp( 
TS_ISO_8601, $row->pt_timestamp );
+                                       $vals['timestamp'] = $this->timestamp( 
$row->pt_timestamp );
                                }
 
                                if ( isset( $prop['user'] ) && !is_null( 
$row->user_name ) ) {
diff --git a/includes/api/ApiQueryQueryPage.php 
b/includes/api/ApiQueryQueryPage.php
index 79fe049..ba0a0b1 100644
--- a/includes/api/ApiQueryQueryPage.php
+++ b/includes/api/ApiQueryQueryPage.php
@@ -80,7 +80,7 @@
                                $r['cached'] = '';
                                $ts = $qp->getCachedTimestamp();
                                if ( $ts ) {
-                                       $r['cachedtimestamp'] = wfTimestamp( 
TS_ISO_8601, $ts );
+                                       $r['cachedtimestamp'] = 
$this->timestamp( $ts );
                                }
                                $r['maxresults'] = $wgQueryCacheLimit;
                        }
@@ -106,7 +106,7 @@
                        if ( is_null( $resultPageSet ) ) {
                                $data = array( 'value' => $row->value );
                                if ( $qp->usesTimestamps() ) {
-                                       $data['timestamp'] = wfTimestamp( 
TS_ISO_8601, $row->value );
+                                       $data['timestamp'] = $this->timestamp( 
$row->value );
                                }
                                self::addTitleInfo( $data, $title );
 
diff --git a/includes/api/ApiQueryRecentChanges.php 
b/includes/api/ApiQueryRecentChanges.php
index 6b10bdc..59f82b0 100644
--- a/includes/api/ApiQueryRecentChanges.php
+++ b/includes/api/ApiQueryRecentChanges.php
@@ -433,7 +433,7 @@
 
                /* Add the timestamp. */
                if ( $this->fld_timestamp ) {
-                       $vals['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->rc_timestamp );
+                       $vals['timestamp'] = $this->timestamp( 
$row->rc_timestamp );
                }
 
                /* Add edit summary / log summary. */
diff --git a/includes/api/ApiQueryRevisions.php 
b/includes/api/ApiQueryRevisions.php
index 415288e..234e14a 100644
--- a/includes/api/ApiQueryRevisions.php
+++ b/includes/api/ApiQueryRevisions.php
@@ -424,7 +424,7 @@
                }
 
                if ( $this->fld_timestamp ) {
-                       $vals['timestamp'] = wfTimestamp( TS_ISO_8601, 
$revision->getTimestamp() );
+                       $vals['timestamp'] = $this->timestamp( 
$revision->getTimestamp() );
                }
 
                if ( $this->fld_size ) {
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index 36b5597..39bf0a3 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -154,7 +154,7 @@
                                        $vals['wordcount'] = 
$result->getWordCount();
                                }
                                if ( isset( $prop['timestamp'] ) ) {
-                                       $vals['timestamp'] = wfTimestamp( 
TS_ISO_8601, $result->getTimestamp() );
+                                       $vals['timestamp'] = $this->timestamp( 
$result->getTimestamp() );
                                }
                                if ( !is_null( $result->getScore() ) && isset( 
$prop['score'] ) ) {
                                        $vals['score'] = $result->getScore();
diff --git a/includes/api/ApiQuerySiteinfo.php 
b/includes/api/ApiQuerySiteinfo.php
index ac9e85a..d883066 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -233,7 +233,7 @@
                $data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
                $data['server'] = $GLOBALS['wgServer'];
                $data['wikiid'] = wfWikiID();
-               $data['time'] = wfTimestamp( TS_ISO_8601, time() );
+               $data['time'] = $this->timestamp( time() );
 
                if ( $GLOBALS['wgMiserMode'] ) {
                        $data['misermode'] = '';
diff --git a/includes/api/ApiQueryUserContributions.php 
b/includes/api/ApiQueryUserContributions.php
index 9a9be7b..8e0da2b 100644
--- a/includes/api/ApiQueryUserContributions.php
+++ b/includes/api/ApiQueryUserContributions.php
@@ -309,7 +309,7 @@
                }
 
                if ( $this->fld_timestamp ) {
-                       $vals['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->rev_timestamp );
+                       $vals['timestamp'] = $this->timestamp( 
$row->rev_timestamp );
                }
 
                if ( $this->fld_flags ) {
@@ -366,7 +366,7 @@
 
        private function continueStr( $row ) {
                return $row->rev_user_text . '|' .
-                       wfTimestamp( TS_ISO_8601, $row->rev_timestamp );
+               $this->timestamp( $row->rev_timestamp );
        }
 
        public function getCacheMode( $params ) {
diff --git a/includes/api/ApiQueryUserInfo.php 
b/includes/api/ApiQueryUserInfo.php
index 3c85ea6..0956b8e 100644
--- a/includes/api/ApiQueryUserInfo.php
+++ b/includes/api/ApiQueryUserInfo.php
@@ -129,7 +129,7 @@
                                $vals['email'] = $user->getEmail();
                                $auth = 
$user->getEmailAuthenticationTimestamp();
                                if ( !is_null( $auth ) ) {
-                                       $vals['emailauthenticated'] = 
wfTimestamp( TS_ISO_8601, $auth );
+                                       $vals['emailauthenticated'] = 
$this->timestamp( $auth );
                                }
                        }
                }
@@ -137,7 +137,7 @@
                if ( isset( $this->prop['registrationdate'] ) ) {
                        $regDate = $user->getRegistration();
                        if ( $regDate !== false ) {
-                               $vals['registrationdate'] = wfTimestamp( 
TS_ISO_8601, $regDate );
+                               $vals['registrationdate'] = $this->timestamp( 
$regDate );
                        }
                }
 
diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php
index dccfee6..66c9015 100644
--- a/includes/api/ApiQueryUsers.php
+++ b/includes/api/ApiQueryUsers.php
@@ -153,7 +153,7 @@
                                }
 
                                if ( isset( $this->prop['registration'] ) ) {
-                                       $data[$name]['registration'] = 
wfTimestampOrNull( TS_ISO_8601, $user->getRegistration() );
+                                       $data[$name]['registration'] = 
$this->timestampOrNull( $user->getRegistration() );
                                }
 
                                if ( isset( $this->prop['groups'] ) ) {
diff --git a/includes/api/ApiQueryWatchlist.php 
b/includes/api/ApiQueryWatchlist.php
index 22843f5..8b8102b 100644
--- a/includes/api/ApiQueryWatchlist.php
+++ b/includes/api/ApiQueryWatchlist.php
@@ -301,7 +301,7 @@
                }
 
                if ( $this->fld_timestamp ) {
-                       $vals['timestamp'] = wfTimestamp( TS_ISO_8601, 
$row->rc_timestamp );
+                       $vals['timestamp'] = $this->timestamp( 
$row->rc_timestamp );
                }
 
                if ( $this->fld_sizes ) {
@@ -312,7 +312,7 @@
                if ( $this->fld_notificationtimestamp ) {
                        $vals['notificationtimestamp'] = ( 
$row->wl_notificationtimestamp == null )
                                ? ''
-                               : wfTimestamp( TS_ISO_8601, 
$row->wl_notificationtimestamp );
+                               : $this->timestamp( 
$row->wl_notificationtimestamp );
                }
 
                if ( $this->fld_comment && isset( $row->rc_comment ) ) {
diff --git a/includes/api/ApiQueryWatchlistRaw.php 
b/includes/api/ApiQueryWatchlistRaw.php
index ea4e724..8f29305 100644
--- a/includes/api/ApiQueryWatchlistRaw.php
+++ b/includes/api/ApiQueryWatchlistRaw.php
@@ -111,7 +111,7 @@
                                ApiQueryBase::addTitleInfo( $vals, $t );
                                if ( isset( $prop['changed'] ) && !is_null( 
$row->wl_notificationtimestamp ) )
                                {
-                                       $vals['changed'] = wfTimestamp( 
TS_ISO_8601, $row->wl_notificationtimestamp );
+                                       $vals['changed'] = $this->timestamp( 
$row->wl_notificationtimestamp );
                                }
                                $fit = $this->getResult()->addValue( 
$this->getModuleName(), null, $vals );
                                if ( !$fit ) {
diff --git a/includes/api/ApiSetNotificationTimestamp.php 
b/includes/api/ApiSetNotificationTimestamp.php
index 53a68fd..f35fd2c 100644
--- a/includes/api/ApiSetNotificationTimestamp.php
+++ b/includes/api/ApiSetNotificationTimestamp.php
@@ -95,7 +95,7 @@
                                __METHOD__
                        );
 
-                       $result['notificationtimestamp'] = ( is_null( 
$timestamp ) ? '' : wfTimestamp( TS_ISO_8601, $timestamp ) );
+                       $result['notificationtimestamp'] = ( is_null( 
$timestamp ) ? '' : $this->timestamp( $timestamp ) );
                } else {
                        // First, log the invalid titles
                        foreach ( $pageSet->getInvalidTitles() as $title ) {
@@ -151,7 +151,7 @@
                                if ( isset( $timestamps[$ns] ) && 
array_key_exists( $dbkey, $timestamps[$ns] ) ) {
                                        $r['notificationtimestamp'] = '';
                                        if ( $timestamps[$ns][$dbkey] !== null 
) {
-                                               $r['notificationtimestamp'] = 
wfTimestamp( TS_ISO_8601, $timestamps[$ns][$dbkey] );
+                                               $r['notificationtimestamp'] = 
$this->timestamp( $timestamps[$ns][$dbkey] );
                                        }
                                } else {
                                        $r['notwatched'] = '';

-- 
To view, visit https://gerrit.wikimedia.org/r/93075
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c6703b9b0b606bd8142252d5485c61ee973a02b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to