summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryInfo.php')
-rw-r--r--includes/api/ApiQueryInfo.php33
1 files changed, 14 insertions, 19 deletions
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index c2f4dc92..f0d0faa3 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -24,11 +24,6 @@
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* A query module to show basic page information.
*
@@ -76,7 +71,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(tokenname => function)
+ * @return array array(tokenname => function)
*/
protected function getTokenFunctions() {
// Don't call the hooks twice
@@ -119,7 +114,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedEditToken;
}
- $cachedEditToken = $wgUser->editToken();
+ $cachedEditToken = $wgUser->getEditToken();
return $cachedEditToken;
}
@@ -134,7 +129,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedDeleteToken;
}
- $cachedDeleteToken = $wgUser->editToken();
+ $cachedDeleteToken = $wgUser->getEditToken();
return $cachedDeleteToken;
}
@@ -149,7 +144,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedProtectToken;
}
- $cachedProtectToken = $wgUser->editToken();
+ $cachedProtectToken = $wgUser->getEditToken();
return $cachedProtectToken;
}
@@ -164,7 +159,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedMoveToken;
}
- $cachedMoveToken = $wgUser->editToken();
+ $cachedMoveToken = $wgUser->getEditToken();
return $cachedMoveToken;
}
@@ -179,7 +174,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedBlockToken;
}
- $cachedBlockToken = $wgUser->editToken();
+ $cachedBlockToken = $wgUser->getEditToken();
return $cachedBlockToken;
}
@@ -199,7 +194,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedEmailToken;
}
- $cachedEmailToken = $wgUser->editToken();
+ $cachedEmailToken = $wgUser->getEditToken();
return $cachedEmailToken;
}
@@ -214,7 +209,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedImportToken;
}
- $cachedImportToken = $wgUser->editToken();
+ $cachedImportToken = $wgUser->getEditToken();
return $cachedImportToken;
}
@@ -229,7 +224,7 @@ class ApiQueryInfo extends ApiQueryBase {
return $cachedWatchToken;
}
- $cachedWatchToken = $wgUser->editToken( 'watch' );
+ $cachedWatchToken = $wgUser->getEditToken( 'watch' );
return $cachedWatchToken;
}
@@ -383,7 +378,7 @@ class ApiQueryInfo extends ApiQueryBase {
$pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
$pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
}
- if ( $this->fld_readable && $title->userCanRead() ) {
+ if ( $this->fld_readable && $title->userCan( 'read' ) ) {
$pageInfo['readable'] = '';
}
@@ -619,9 +614,9 @@ class ApiQueryInfo extends ApiQueryBase {
* Get information about watched status and put it in $this->watched
*/
private function getWatchedInfo() {
- global $wgUser;
+ $user = $this->getUser();
- if ( $wgUser->isAnon() || count( $this->everything ) == 0 ) {
+ if ( $user->isAnon() || count( $this->everything ) == 0 ) {
return;
}
@@ -635,7 +630,7 @@ class ApiQueryInfo extends ApiQueryBase {
$this->addFields( array( 'wl_title', 'wl_namespace' ) );
$this->addWhere( array(
$lb->constructSet( 'wl', $db ),
- 'wl_user' => $wgUser->getID()
+ 'wl_user' => $user->getID()
) );
$res = $this->select( __METHOD__ );
@@ -721,7 +716,7 @@ class ApiQueryInfo extends ApiQueryBase {
) );
}
- protected function getExamples() {
+ public function getExamples() {
return array(
'api.php?action=query&prop=info&titles=Main%20Page',
'api.php?action=query&prop=info&inprop=protection&titles=Main%20Page'