X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Fapi%2FApiSetNotificationTimestamp.php;h=ea52e1433a04067daa1d19cb7bfecb84ab22d6c4;hb=b3b2214a718e737d4921536c33922295d451341f;hp=33f3bd8af9053814bbc50495b77de883650b054e;hpb=abb7c6792fab5e9a6e0c088dd820fd3d74c13059;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiSetNotificationTimestamp.php b/includes/api/ApiSetNotificationTimestamp.php index 33f3bd8af9..ea52e1433a 100644 --- a/includes/api/ApiSetNotificationTimestamp.php +++ b/includes/api/ApiSetNotificationTimestamp.php @@ -46,7 +46,7 @@ class ApiSetNotificationTimestamp extends ApiBase { $params = $this->extractRequestParams(); $this->requireMaxOneParameter( $params, 'timestamp', 'torevid', 'newerthanrevid' ); - $continuationManager = new ApiContinuationManager( $this, array(), array() ); + $continuationManager = new ApiContinuationManager( $this, [], [] ); $this->setContinuationManager( $continuationManager ); $pageSet = $this->getPageSet(); @@ -99,11 +99,11 @@ class ApiSetNotificationTimestamp extends ApiBase { } $apiResult = $this->getResult(); - $result = array(); + $result = []; if ( $params['entirewatchlist'] ) { // Entire watchlist mode: Just update the thing and return a success indicator - $dbw->update( 'watchlist', array( 'wl_notificationtimestamp' => $timestamp ), - array( 'wl_user' => $user->getId() ), + $dbw->update( 'watchlist', [ 'wl_notificationtimestamp' => $timestamp ], + [ 'wl_user' => $user->getId() ], __METHOD__ ); @@ -117,14 +117,14 @@ class ApiSetNotificationTimestamp extends ApiBase { $result[] = $r; } foreach ( $pageSet->getMissingPageIDs() as $p ) { - $page = array(); + $page = []; $page['pageid'] = $p; $page['missing'] = true; $page['notwatched'] = true; $result[] = $page; } foreach ( $pageSet->getMissingRevisionIDs() as $r ) { - $rev = array(); + $rev = []; $rev['revid'] = $r; $rev['missing'] = true; $rev['notwatched'] = true; @@ -134,17 +134,17 @@ class ApiSetNotificationTimestamp extends ApiBase { if ( $pageSet->getTitles() ) { // Now process the valid titles $lb = new LinkBatch( $pageSet->getTitles() ); - $dbw->update( 'watchlist', array( 'wl_notificationtimestamp' => $timestamp ), - array( 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ), + $dbw->update( 'watchlist', [ 'wl_notificationtimestamp' => $timestamp ], + [ 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ], __METHOD__ ); // Query the results of our update - $timestamps = array(); + $timestamps = []; $res = $dbw->select( 'watchlist', - array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ), - array( 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ), + [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ], + [ 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ], __METHOD__ ); foreach ( $res as $row ) { @@ -156,10 +156,10 @@ class ApiSetNotificationTimestamp extends ApiBase { foreach ( $pageSet->getTitles() as $title ) { $ns = $title->getNamespace(); $dbkey = $title->getDBkey(); - $r = array( + $r = [ 'ns' => intval( $ns ), 'title' => $title->getPrefixedText(), - ); + ]; if ( !$title->exists() ) { $r['missing'] = true; } @@ -208,23 +208,23 @@ class ApiSetNotificationTimestamp extends ApiBase { } public function getAllowedParams( $flags = 0 ) { - $result = array( - 'entirewatchlist' => array( + $result = [ + 'entirewatchlist' => [ ApiBase::PARAM_TYPE => 'boolean' - ), - 'timestamp' => array( + ], + 'timestamp' => [ ApiBase::PARAM_TYPE => 'timestamp' - ), - 'torevid' => array( + ], + 'torevid' => [ ApiBase::PARAM_TYPE => 'integer' - ), - 'newerthanrevid' => array( + ], + 'newerthanrevid' => [ ApiBase::PARAM_TYPE => 'integer' - ), - 'continue' => array( + ], + 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', - ), - ); + ], + ]; if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags ); } @@ -233,7 +233,7 @@ class ApiSetNotificationTimestamp extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=setnotificationtimestamp&entirewatchlist=&token=123ABC' => 'apihelp-setnotificationtimestamp-example-all', 'action=setnotificationtimestamp&titles=Main_page&token=123ABC' @@ -243,7 +243,7 @@ class ApiSetNotificationTimestamp extends ApiBase { => 'apihelp-setnotificationtimestamp-example-pagetimestamp', 'action=setnotificationtimestamp&generator=allpages&gapnamespace=2&token=123ABC' => 'apihelp-setnotificationtimestamp-example-allpages', - ); + ]; } public function getHelpUrls() {