Followup e48ecbc5: fix fatal error due to undefined variable
[lhc/web/wiklou.git] / includes / api / ApiSetNotificationTimestamp.php
index 53a68fd..dc593e5 100644 (file)
@@ -48,7 +48,10 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
                $pageSet = $this->getPageSet();
                if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) {
-                       $this->dieUsage( "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'", 'multisource' );
+                       $this->dieUsage(
+                               "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'",
+                               'multisource'
+                       );
                }
 
                $dbw = wfGetDB( DB_MASTER, 'api' );
@@ -95,7 +98,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
                                __METHOD__
                        );
 
-                       $result['notificationtimestamp'] = ( is_null( $timestamp ) ? '' : wfTimestamp( TS_ISO_8601, $timestamp ) );
+                       $result['notificationtimestamp'] = is_null( $timestamp )
+                               ? ''
+                               : wfTimestamp( TS_ISO_8601, $timestamp );
                } else {
                        // First, log the invalid titles
                        foreach ( $pageSet->getInvalidTitles() as $title ) {
@@ -128,7 +133,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
                        // Query the results of our update
                        $timestamps = array();
-                       $res = $dbw->select( 'watchlist', array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
+                       $res = $dbw->select(
+                               'watchlist',
+                               array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
                                array( 'wl_user' => $user->getID(), $lb->constructSet( 'wl', $dbw ) ),
                                __METHOD__
                        );
@@ -172,6 +179,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                if ( !isset( $this->mPageSet ) ) {
                        $this->mPageSet = new ApiPageSet( $this );
                }
+
                return $this->mPageSet;
        }
 
@@ -210,8 +218,8 @@ class ApiSetNotificationTimestamp extends ApiBase {
                if ( $flags ) {
                        $result += $this->getPageSet()->getFinalParams( $flags );
                }
-               return $result;
 
+               return $result;
        }
 
        public function getParamDescription() {
@@ -271,6 +279,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
        public function getPossibleErrors() {
                $ps = $this->getPageSet();
+
                return array_merge(
                        parent::getPossibleErrors(),
                        $ps->getFinalPossibleErrors(),
@@ -279,7 +288,8 @@ class ApiSetNotificationTimestamp extends ApiBase {
                        $this->getRequireOnlyOneParameterErrorMessages(
                                array_merge( array( 'entirewatchlist' ), array_keys( $ps->getFinalParams() ) ) ),
                        array(
-                               array( 'code' => 'notloggedin', 'info' => 'Anonymous users cannot use watchlist change notifications' ),
+                               array( 'code' => 'notloggedin', 'info'
+                               => 'Anonymous users cannot use watchlist change notifications' ),
                                array( 'code' => 'multpages', 'info' => 'torevid may only be used with a single page' ),
                                array( 'code' => 'multpages', 'info' => 'newerthanrevid may only be used with a single page' ),
                        )
@@ -288,9 +298,14 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
        public function getExamples() {
                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&timestamp=2012-01-01T00:00:00Z&token=123ABC' => 'Set the notification timestamp for "Main page" so all edits since 1 January 2012 are unviewed',
+                       '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&' .
+                               'timestamp=2012-01-01T00:00:00Z&token=123ABC'
+                               => 'Set the notification timestamp for "Main page" so all edits ' .
+                                       'since 1 January 2012 are unviewed',
                );
        }