Merge "Expose server name in rc feed"
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
index 017684e..7a70299 100644 (file)
@@ -42,7 +42,8 @@ class ApiQueryInfo extends ApiQueryBase {
        private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
                $pageLatest, $pageLength;
 
-       private $protections, $watched, $watchers, $notificationtimestamps, $talkids, $subjectids, $displaytitles;
+       private $protections, $watched, $watchers, $notificationtimestamps,
+               $talkids, $subjectids, $displaytitles;
        private $showZeroWatchers = false;
 
        private $tokenFunctions;
@@ -52,7 +53,7 @@ class ApiQueryInfo extends ApiQueryBase {
        }
 
        /**
-        * @param $pageSet ApiPageSet
+        * @param ApiPageSet $pageSet
         * @return void
         */
        public function requestExtraData( $pageSet ) {
@@ -79,7 +80,7 @@ class ApiQueryInfo extends ApiQueryBase {
         * Get an array mapping token names to their handler functions.
         * The prototype for a token function is func($pageid, $title)
         * it should return a token or false (permission denied)
-        * @return array array(tokenname => function)
+        * @return array Array(tokenname => function)
         */
        protected function getTokenFunctions() {
                // Don't call the hooks twice
@@ -104,10 +105,11 @@ class ApiQueryInfo extends ApiQueryBase {
                        'watch' => array( 'ApiQueryInfo', 'getWatchToken' ),
                );
                wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
+
                return $this->tokenFunctions;
        }
 
-       static $cachedTokens = array();
+       static protected $cachedTokens = array();
 
        public static function resetTokenCache() {
                ApiQueryInfo::$cachedTokens = array();
@@ -333,8 +335,8 @@ class ApiQueryInfo extends ApiQueryBase {
                        ), $pageid, $pageInfo );
                        if ( !$fit ) {
                                $this->setContinueEnumParameter( 'continue',
-                                               $title->getNamespace() . '|' .
-                                               $title->getText() );
+                                       $title->getNamespace() . '|' .
+                                       $title->getText() );
                                break;
                        }
                }
@@ -343,12 +345,13 @@ class ApiQueryInfo extends ApiQueryBase {
        /**
         * Get a result array with information about a title
         * @param int $pageid Page ID (negative for missing titles)
-        * @param $title Title object
+        * @param Title $title
         * @return array
         */
        private function extractPageInfo( $pageid, $title ) {
                $pageInfo = array();
-               $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
+               // $title->exists() needs pageid, which is not set for all title objects
+               $titleExists = $pageid > 0;
                $ns = $title->getNamespace();
                $dbkey = $title->getDBkey();
 
@@ -410,7 +413,8 @@ class ApiQueryInfo extends ApiQueryBase {
                if ( $this->fld_notificationtimestamp ) {
                        $pageInfo['notificationtimestamp'] = '';
                        if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
-                               $pageInfo['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
+                               $pageInfo['notificationtimestamp'] =
+                                       wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
                        }
                }
 
@@ -465,7 +469,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        $this->resetQueryParams();
                        $this->addTables( 'page_restrictions' );
                        $this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
-                                       'pr_expiry', 'pr_cascade' ) );
+                               'pr_expiry', 'pr_cascade' ) );
                        $this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
 
                        $res = $this->select( __METHOD__ );
@@ -556,8 +560,8 @@ class ApiQueryInfo extends ApiQueryBase {
                        $this->resetQueryParams();
                        $this->addTables( array( 'page_restrictions', 'page', 'templatelinks' ) );
                        $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
-                                       'page_title', 'page_namespace',
-                                       'tl_title', 'tl_namespace' ) );
+                               'page_title', 'page_namespace',
+                               'tl_title', 'tl_namespace' ) );
                        $this->addWhere( $lb->constructSet( 'tl', $db ) );
                        $this->addWhere( 'pr_page = page_id' );
                        $this->addWhere( 'pr_page = tl_from' );
@@ -580,7 +584,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        $this->resetQueryParams();
                        $this->addTables( array( 'page_restrictions', 'page', 'imagelinks' ) );
                        $this->addFields( array( 'pr_type', 'pr_level', 'pr_expiry',
-                                       'page_title', 'page_namespace', 'il_to' ) );
+                               'page_title', 'page_namespace', 'il_to' ) );
                        $this->addWhere( 'pr_page = page_id' );
                        $this->addWhere( 'pr_page = il_from' );
                        $this->addWhereFld( 'pr_cascade', 1 );
@@ -633,10 +637,10 @@ class ApiQueryInfo extends ApiQueryBase {
                foreach ( $res as $row ) {
                        if ( MWNamespace::isTalk( $row->page_namespace ) ) {
                                $this->talkids[MWNamespace::getSubject( $row->page_namespace )][$row->page_title] =
-                                               intval( $row->page_id );
+                                       intval( $row->page_id );
                        } else {
                                $this->subjectids[MWNamespace::getTalk( $row->page_namespace )][$row->page_title] =
-                                               intval( $row->page_id );
+                                       intval( $row->page_id );
                        }
                }
        }
@@ -697,7 +701,8 @@ class ApiQueryInfo extends ApiQueryBase {
                                $this->watched[$row->wl_namespace][$row->wl_title] = true;
                        }
                        if ( $this->fld_notificationtimestamp ) {
-                               $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp;
+                               $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] =
+                                       $row->wl_notificationtimestamp;
                        }
                }
        }
@@ -761,6 +766,7 @@ class ApiQueryInfo extends ApiQueryBase {
                if ( !is_null( $params['token'] ) ) {
                        return 'private';
                }
+
                return 'public';
        }