BREAKING CHANGE: Require POST for patrolling revisions and salt the patrol token...
[lhc/web/wiklou.git] / includes / api / ApiQueryInfo.php
index 2c7b64a..3156b7e 100644 (file)
@@ -48,12 +48,12 @@ class ApiQueryInfo extends ApiQueryBase {
        }
 
        public function requestExtraData( $pageSet ) {
-               global $wgDisablePageCounters;
+               global $wgDisableCounters;
 
                $pageSet->requestField( 'page_restrictions' );
                $pageSet->requestField( 'page_is_redirect' );
                $pageSet->requestField( 'page_is_new' );
-               if ( !$wgDisablePageCounters ) {
+               if ( !$wgDisableCounters ) {
                        $pageSet->requestField( 'page_counter' );
                }
                $pageSet->requestField( 'page_touched' );
@@ -87,6 +87,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ),
                        'email' => array( 'ApiQueryInfo', 'getEmailToken' ),
                        'import' => array( 'ApiQueryInfo', 'getImportToken' ),
+                       'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' ),
                );
                wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
                return $this->tokenFunctions;
@@ -250,9 +251,9 @@ class ApiQueryInfo extends ApiQueryBase {
                $this->pageIsRedir = $pageSet->getCustomField( 'page_is_redirect' );
                $this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
 
-               global $wgDisablePageCounters;
+               global $wgDisableCounters;
 
-               if ( !$wgDisablePageCounters ) {
+               if ( !$wgDisableCounters ) {
                        $this->pageCounter = $pageSet->getCustomField( 'page_counter' );
                }
                $this->pageTouched = $pageSet->getCustomField( 'page_touched' );
@@ -301,11 +302,11 @@ class ApiQueryInfo extends ApiQueryBase {
        private function extractPageInfo( $pageid, $title ) {
                $pageInfo = array();
                if ( $title->exists() ) {
-                       global $wgDisablePageCounters;
+                       global $wgDisableCounters;
 
                        $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
                        $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
-                       $pageInfo['counter'] = $wgDisablePageCounters
+                       $pageInfo['counter'] = $wgDisableCounters
                                ? ""
                                : intval( $this->pageCounter[$pageid] );
                        $pageInfo['length'] = intval( $this->pageLength[$pageid] );
@@ -593,29 +594,27 @@ class ApiQueryInfo extends ApiQueryBase {
        private function getWatchedInfo() {
                global $wgUser;
 
-               if ( $wgUser->isAnon() || count( $this->titles ) == 0 ) {
+               if ( $wgUser->isAnon() || count( $this->everything ) == 0 ) {
                        return;
                }
 
                $this->watched = array();
                $db = $this->getDB();
 
-               $lb = new LinkBatch( $this->titles );
+               $lb = new LinkBatch( $this->everything );
 
                $this->resetQueryParams();
-               $this->addTables( array( 'page', 'watchlist' ) );
-               $this->addFields( array( 'page_title', 'page_namespace' ) );
+               $this->addTables( array( 'watchlist' ) );
+               $this->addFields( array( 'wl_title', 'wl_namespace' ) );
                $this->addWhere( array(
-                       $lb->constructSet( 'page', $db ),
-                       'wl_namespace=page_namespace',
-                       'wl_title=page_title',
+                       $lb->constructSet( 'wl', $db ),
                        'wl_user' => $wgUser->getID()
                ) );
 
                $res = $this->select( __METHOD__ );
 
                foreach ( $res as $row ) {
-                       $this->watched[$row->page_namespace][$row->page_title] = true;
+                       $this->watched[$row->wl_namespace][$row->wl_title] = true;
                }
        }