Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -79,7 +79,13 @@ |
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
83 | | - return $wgUser->editToken( $rc->getAttribute( 'rc_id' ) ); |
| 83 | + // The patrol token is always the same, let's exploit that |
| 84 | + static $cachedPatrolToken = null; |
| 85 | + if ( is_null( $cachedPatrolToken ) ) { |
| 86 | + $cachedPatrolToken = $wgUser->editToken( 'patrol' ); |
| 87 | + } |
| 88 | + |
| 89 | + return $cachedPatrolToken; |
84 | 90 | } |
85 | 91 | |
86 | 92 | /** |
Index: trunk/phase3/includes/api/ApiPatrol.php |
— | — | @@ -59,6 +59,10 @@ |
60 | 60 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
61 | 61 | } |
62 | 62 | |
| 63 | + public function mustBePosted() { |
| 64 | + return true; |
| 65 | + } |
| 66 | + |
63 | 67 | public function isWriteMode() { |
64 | 68 | return true; |
65 | 69 | } |
— | — | @@ -95,8 +99,7 @@ |
96 | 100 | } |
97 | 101 | |
98 | 102 | public function getTokenSalt() { |
99 | | - $params = $this->extractRequestParams(); |
100 | | - return $params['rcid']; |
| 103 | + return 'patrol'; |
101 | 104 | } |
102 | 105 | |
103 | 106 | protected function getExamples() { |
Index: trunk/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -87,6 +87,7 @@ |
88 | 88 | 'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ), |
89 | 89 | 'email' => array( 'ApiQueryInfo', 'getEmailToken' ), |
90 | 90 | 'import' => array( 'ApiQueryInfo', 'getImportToken' ), |
| 91 | + 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' ), |
91 | 92 | ); |
92 | 93 | wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) ); |
93 | 94 | return $this->tokenFunctions; |