private $fld_protection = false, $fld_talkid = false,
$fld_subjectid = false, $fld_url = false,
- $fld_readable = false, $fld_watched = false,
+ $fld_readable = false, $fld_watched = false, $fld_notificationtimestamp = false,
$fld_preload = false, $fld_displaytitle = false;
private $params, $titles, $missing, $everything, $pageCounter;
private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
$pageLatest, $pageLength;
- private $protections, $watched, $talkids, $subjectids, $displaytitles;
+ private $protections, $watched, $notificationtimestamps, $talkids, $subjectids, $displaytitles;
private $tokenFunctions;
$prop = array_flip( $this->params['prop'] );
$this->fld_protection = isset( $prop['protection'] );
$this->fld_watched = isset( $prop['watched'] );
+ $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
$this->fld_talkid = isset( $prop['talkid'] );
$this->fld_subjectid = isset( $prop['subjectid'] );
$this->fld_url = isset( $prop['url'] );
$this->getProtectionInfo();
}
- if ( $this->fld_watched ) {
+ if ( $this->fld_watched || $this->fld_notificationtimestamp ) {
$this->getWatchedInfo();
}
$pageInfo['watched'] = '';
}
+ if ( $this->fld_notificationtimestamp ) {
+ $pageInfo['notificationtimestamp'] = '';
+ if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
+ $pageInfo['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
+ }
+ }
+
if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
$pageInfo['talkid'] = $this->talkids[$ns][$dbkey];
}
$pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
$pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
}
- if ( $this->fld_readable && $title->userCan( 'read' ) ) {
+ if ( $this->fld_readable && $title->userCan( 'read', $this->getUser() ) ) {
$pageInfo['readable'] = '';
}
/**
* Get information about watched status and put it in $this->watched
+ * and $this->notificationtimestamps
*/
private function getWatchedInfo() {
$user = $this->getUser();
}
$this->watched = array();
+ $this->notificationtimestamps = array();
$db = $this->getDB();
$lb = new LinkBatch( $this->everything );
$this->resetQueryParams();
$this->addTables( array( 'watchlist' ) );
$this->addFields( array( 'wl_title', 'wl_namespace' ) );
+ $this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
$this->addWhere( array(
$lb->constructSet( 'wl', $db ),
'wl_user' => $user->getID()
$res = $this->select( __METHOD__ );
foreach ( $res as $row ) {
- $this->watched[$row->wl_namespace][$row->wl_title] = true;
+ if ( $this->fld_watched ) {
+ $this->watched[$row->wl_namespace][$row->wl_title] = true;
+ }
+ if ( $this->fld_notificationtimestamp ) {
+ $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp;
+ }
}
}
'protection',
'talkid',
'watched', # private
+ 'notificationtimestamp', # private
'subjectid',
'url',
'readable', # private
return array(
'prop' => array(
'Which additional properties to get:',
- ' protection - List the protection level of each page',
- ' talkid - The page ID of the talk page for each non-talk page',
- ' watched - List the watched status of each page',
- ' subjectid - The page ID of the parent page for each talk page',
- ' url - Gives a full URL to the page, and also an edit URL',
- ' readable - Whether the user can read this page',
- ' preload - Gives the text returned by EditFormPreloadText',
- ' displaytitle - Gives the way the page title is actually displayed',
+ ' protection - List the protection level of each page',
+ ' talkid - The page ID of the talk page for each non-talk page',
+ ' watched - List the watched status of each page',
+ ' notificationtimestamp - The watchlist notification timestamp of each page',
+ ' subjectid - The page ID of the parent page for each talk page',
+ ' url - Gives a full URL to the page, and also an edit URL',
+ ' readable - Whether the user can read this page',
+ ' preload - Gives the text returned by EditFormPreloadText',
+ ' displaytitle - Gives the way the page title is actually displayed',
),
'token' => 'Request a token to perform a data-modifying action on a page',
'continue' => 'When more results are available, use this to continue',
'watched' => array(
'watched' => 'boolean'
),
+ 'notificationtimestamp' => array(
+ 'notificationtimestamp' => array(
+ ApiBase::PROP_TYPE => 'timestamp',
+ ApiBase::PROP_NULLABLE => true
+ )
+ ),
'talkid' => array(
'talkid' => array(
ApiBase::PROP_TYPE => 'integer',