| @@ 53-71 (lines=19) @@ | ||
| 50 | * @deprecated since 1.24 |
|
| 51 | * @return array Array(tokenname => function) |
|
| 52 | */ |
|
| 53 | protected function getTokenFunctions() { |
|
| 54 | // Don't call the hooks twice |
|
| 55 | if ( isset( $this->tokenFunctions ) ) { |
|
| 56 | return $this->tokenFunctions; |
|
| 57 | } |
|
| 58 | ||
| 59 | // If we're in a mode that breaks the same-origin policy, no tokens can |
|
| 60 | // be obtained |
|
| 61 | if ( $this->lacksSameOriginSecurity() ) { |
|
| 62 | return []; |
|
| 63 | } |
|
| 64 | ||
| 65 | $this->tokenFunctions = [ |
|
| 66 | 'patrol' => [ 'ApiQueryRecentChanges', 'getPatrolToken' ] |
|
| 67 | ]; |
|
| 68 | Hooks::run( 'APIQueryRecentChangesTokens', [ &$this->tokenFunctions ] ); |
|
| 69 | ||
| 70 | return $this->tokenFunctions; |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * @deprecated since 1.24 |
|
| @@ 46-68 (lines=23) @@ | ||
| 43 | private $tokenFunctions; |
|
| 44 | ||
| 45 | /** @deprecated since 1.24 */ |
|
| 46 | protected function getTokenFunctions() { |
|
| 47 | // tokenname => function |
|
| 48 | // function prototype is func($pageid, $title, $rev) |
|
| 49 | // should return token or false |
|
| 50 | ||
| 51 | // Don't call the hooks twice |
|
| 52 | if ( isset( $this->tokenFunctions ) ) { |
|
| 53 | return $this->tokenFunctions; |
|
| 54 | } |
|
| 55 | ||
| 56 | // If we're in a mode that breaks the same-origin policy, no tokens can |
|
| 57 | // be obtained |
|
| 58 | if ( $this->lacksSameOriginSecurity() ) { |
|
| 59 | return []; |
|
| 60 | } |
|
| 61 | ||
| 62 | $this->tokenFunctions = [ |
|
| 63 | 'rollback' => [ 'ApiQueryRevisions', 'getRollbackToken' ] |
|
| 64 | ]; |
|
| 65 | Hooks::run( 'APIQueryRevisionsTokens', [ &$this->tokenFunctions ] ); |
|
| 66 | ||
| 67 | return $this->tokenFunctions; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @deprecated since 1.24 |
|
| @@ 66-84 (lines=19) @@ | ||
| 63 | * @deprecated since 1.24 |
|
| 64 | * @return array Array of tokenname => function |
|
| 65 | */ |
|
| 66 | protected function getTokenFunctions() { |
|
| 67 | // Don't call the hooks twice |
|
| 68 | if ( isset( $this->tokenFunctions ) ) { |
|
| 69 | return $this->tokenFunctions; |
|
| 70 | } |
|
| 71 | ||
| 72 | // If we're in a mode that breaks the same-origin policy, no tokens can |
|
| 73 | // be obtained |
|
| 74 | if ( $this->lacksSameOriginSecurity() ) { |
|
| 75 | return []; |
|
| 76 | } |
|
| 77 | ||
| 78 | $this->tokenFunctions = [ |
|
| 79 | 'userrights' => [ 'ApiQueryUsers', 'getUserrightsToken' ], |
|
| 80 | ]; |
|
| 81 | Hooks::run( 'APIQueryUsersTokens', [ &$this->tokenFunctions ] ); |
|
| 82 | ||
| 83 | return $this->tokenFunctions; |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * @deprecated since 1.24 |
|