diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/api/ApiSetNotificationTimestamp.php | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/api/ApiSetNotificationTimestamp.php')
-rw-r--r-- | includes/api/ApiSetNotificationTimestamp.php | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/includes/api/ApiSetNotificationTimestamp.php b/includes/api/ApiSetNotificationTimestamp.php index 5d527fc7..86a3f6aa 100644 --- a/includes/api/ApiSetNotificationTimestamp.php +++ b/includes/api/ApiSetNotificationTimestamp.php @@ -46,7 +46,8 @@ class ApiSetNotificationTimestamp extends ApiBase { $params = $this->extractRequestParams(); $this->requireMaxOneParameter( $params, 'timestamp', 'torevid', 'newerthanrevid' ); - $this->getResult()->beginContinuation( $params['continue'], array(), array() ); + $continuationManager = new ApiContinuationManager( $this, array(), array() ); + $this->setContinuationManager( $continuationManager ); $pageSet = $this->getPageSet(); if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) { @@ -73,7 +74,8 @@ class ApiSetNotificationTimestamp extends ApiBase { } $title = reset( $pageSet->getGoodTitles() ); if ( $title ) { - $timestamp = Revision::getTimestampFromId( $title, $params['torevid'] ); + $timestamp = Revision::getTimestampFromId( + $title, $params['torevid'], Revision::READ_LATEST ); if ( $timestamp ) { $timestamp = $dbw->timestamp( $timestamp ); } else { @@ -86,7 +88,8 @@ class ApiSetNotificationTimestamp extends ApiBase { } $title = reset( $pageSet->getGoodTitles() ); if ( $title ) { - $revid = $title->getNextRevisionID( $params['newerthanrevid'] ); + $revid = $title->getNextRevisionID( + $params['newerthanrevid'], Title::GAID_FOR_UPDATE ); if ( $revid ) { $timestamp = $dbw->timestamp( Revision::getTimestampFromId( $title, $revid ) ); } else { @@ -112,21 +115,21 @@ class ApiSetNotificationTimestamp extends ApiBase { foreach ( $pageSet->getInvalidTitles() as $title ) { $r = array(); $r['title'] = $title; - $r['invalid'] = ''; + $r['invalid'] = true; $result[] = $r; } foreach ( $pageSet->getMissingPageIDs() as $p ) { $page = array(); $page['pageid'] = $p; - $page['missing'] = ''; - $page['notwatched'] = ''; + $page['missing'] = true; + $page['notwatched'] = true; $result[] = $page; } foreach ( $pageSet->getMissingRevisionIDs() as $r ) { $rev = array(); $rev['revid'] = $r; - $rev['missing'] = ''; - $rev['notwatched'] = ''; + $rev['missing'] = true; + $rev['notwatched'] = true; $result[] = $rev; } @@ -160,7 +163,7 @@ class ApiSetNotificationTimestamp extends ApiBase { 'title' => $title->getPrefixedText(), ); if ( !$title->exists() ) { - $r['missing'] = ''; + $r['missing'] = true; } if ( isset( $timestamps[$ns] ) && array_key_exists( $dbkey, $timestamps[$ns] ) ) { $r['notificationtimestamp'] = ''; @@ -168,17 +171,18 @@ class ApiSetNotificationTimestamp extends ApiBase { $r['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $timestamps[$ns][$dbkey] ); } } else { - $r['notwatched'] = ''; + $r['notwatched'] = true; } $result[] = $r; } } - $apiResult->setIndexedTagName( $result, 'page' ); + ApiResult::setIndexedTagName( $result, 'page' ); } $apiResult->addValue( null, $this->getModuleName(), $result ); - $apiResult->endContinuation(); + $this->setContinuationManager( null ); + $continuationManager->setContinuationIntoResult( $apiResult ); } /** @@ -219,7 +223,9 @@ class ApiSetNotificationTimestamp extends ApiBase { 'newerthanrevid' => array( ApiBase::PARAM_TYPE => 'integer' ), - 'continue' => '', + 'continue' => array( + ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', + ), ); if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags ); @@ -228,34 +234,17 @@ class ApiSetNotificationTimestamp extends ApiBase { return $result; } - public function getParamDescription() { - return $this->getPageSet()->getFinalParamDescription() + array( - 'entirewatchlist' => 'Work on all watched pages', - 'timestamp' => 'Timestamp to which to set the notification timestamp', - 'torevid' => 'Revision to set the notification timestamp to (one page only)', - 'newerthanrevid' => 'Revision to set the notification timestamp newer than (one page only)', - 'continue' => 'When more results are available, use this to continue', - ); - } - - public function getDescription() { - return array( 'Update the notification timestamp for watched pages.', - 'This affects the highlighting of changed pages in the watchlist and history,', - 'and the sending of email when the "Email me when a page on my watchlist is', - 'changed" preference is enabled.' - ); - } - - public function getExamples() { + protected function getExamplesMessages() { return array( - 'api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC' - => 'Reset the notification status for the entire watchlist', - 'api.php?action=setnotificationtimestamp&titles=Main_page&token=123ABC' - => 'Reset the notification status for "Main page"', - 'api.php?action=setnotificationtimestamp&titles=Main_page&' . + 'action=setnotificationtimestamp&entirewatchlist=&token=123ABC' + => 'apihelp-setnotificationtimestamp-example-all', + 'action=setnotificationtimestamp&titles=Main_page&token=123ABC' + => 'apihelp-setnotificationtimestamp-example-page', + 'action=setnotificationtimestamp&titles=Main_page&' . 'timestamp=2012-01-01T00:00:00Z&token=123ABC' - => 'Set the notification timestamp for "Main page" so all edits ' . - 'since 1 January 2012 are unviewed', + => 'apihelp-setnotificationtimestamp-example-pagetimestamp', + 'action=setnotificationtimestamp&generator=allpages&gapnamespace=2&token=123ABC' + => 'apihelp-setnotificationtimestamp-example-allpages', ); } |