Tweak comments, remove some unused stuff.
Explicit definitions, move a few minor bits around
This commit is contained in:
parent
d9a2c4bee1
commit
27ca6b2fa8
12 changed files with 41 additions and 22 deletions
|
|
@ -403,6 +403,8 @@ abstract class ApiBase {
|
||||||
*/
|
*/
|
||||||
public function makeHelpMsg_callback( $matches ) {
|
public function makeHelpMsg_callback( $matches ) {
|
||||||
global $wgAutoloadClasses, $wgAutoloadLocalClasses;
|
global $wgAutoloadClasses, $wgAutoloadLocalClasses;
|
||||||
|
|
||||||
|
$file = '';
|
||||||
if ( isset( $wgAutoloadLocalClasses[get_class( $this )] ) ) {
|
if ( isset( $wgAutoloadLocalClasses[get_class( $this )] ) ) {
|
||||||
$file = $wgAutoloadLocalClasses[get_class( $this )];
|
$file = $wgAutoloadLocalClasses[get_class( $this )];
|
||||||
} elseif ( isset( $wgAutoloadClasses[get_class( $this )] ) ) {
|
} elseif ( isset( $wgAutoloadClasses[get_class( $this )] ) ) {
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
|
||||||
*/
|
*/
|
||||||
class ApiBlock extends ApiBase {
|
class ApiBlock extends ApiBase {
|
||||||
|
|
||||||
/**
|
|
||||||
* Std ctor.
|
|
||||||
*/
|
|
||||||
public function __construct( $main, $action ) {
|
public function __construct( $main, $action ) {
|
||||||
parent::__construct( $main, $action );
|
parent::__construct( $main, $action );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -478,9 +478,7 @@ class ApiMain extends ApiBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $e instanceof UsageException ) {
|
if ( $e instanceof UsageException ) {
|
||||||
//
|
|
||||||
// User entered incorrect parameters - print usage screen
|
// User entered incorrect parameters - print usage screen
|
||||||
//
|
|
||||||
$errMessage = $e->getMessageArray();
|
$errMessage = $e->getMessageArray();
|
||||||
|
|
||||||
// Only print the help message when this is for the developer, not runtime
|
// Only print the help message when this is for the developer, not runtime
|
||||||
|
|
@ -490,9 +488,7 @@ class ApiMain extends ApiBase {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
global $wgShowSQLErrors, $wgShowExceptionDetails;
|
global $wgShowSQLErrors, $wgShowExceptionDetails;
|
||||||
//
|
|
||||||
// Something is seriously wrong
|
// Something is seriously wrong
|
||||||
//
|
|
||||||
if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) {
|
if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) {
|
||||||
$info = 'Database query error';
|
$info = 'Database query error';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -684,7 +684,6 @@ class ApiPageSet extends ApiQueryBase {
|
||||||
$titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
|
$titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( $titleObj->getNamespace() < 0 ) {
|
if ( $titleObj->getNamespace() < 0 ) {
|
||||||
// Handle Special and Media pages
|
// Handle Special and Media pages
|
||||||
$titleObj = $titleObj->fixSpecialName();
|
$titleObj = $titleObj->fixSpecialName();
|
||||||
|
|
|
||||||
|
|
@ -253,11 +253,11 @@ class ApiParse extends ApiBase {
|
||||||
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
|
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
|
||||||
$out = new OutputPage;
|
$out = new OutputPage;
|
||||||
$out->addParserOutputNoText( $p_result );
|
$out->addParserOutputNoText( $p_result );
|
||||||
|
$userSkin = $wgUser->getSkin();
|
||||||
|
|
||||||
if ( isset( $prop['headitems'] ) ) {
|
if ( isset( $prop['headitems'] ) ) {
|
||||||
$headItems = $this->formatHeadItems( $p_result->getHeadItems() );
|
$headItems = $this->formatHeadItems( $p_result->getHeadItems() );
|
||||||
|
|
||||||
$userSkin = $wgUser->getSkin();
|
|
||||||
$userSkin->setupUserCss( $out );
|
$userSkin->setupUserCss( $out );
|
||||||
$css = $this->formatCss( $out->buildCssLinksArray() );
|
$css = $this->formatCss( $out->buildCssLinksArray() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,17 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
||||||
|
|
||||||
private $params, $contID, $redirID, $redirect;
|
private $params, $contID, $redirID, $redirect;
|
||||||
private $bl_ns, $bl_from, $bl_table, $bl_code, $bl_title, $bl_sort, $bl_fields, $hasNS;
|
private $bl_ns, $bl_from, $bl_table, $bl_code, $bl_title, $bl_sort, $bl_fields, $hasNS;
|
||||||
private $pageMap, $resultArr;
|
|
||||||
|
/**
|
||||||
|
* Maps ns and title to pageid
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $pageMap = array();
|
||||||
|
private $resultArr;
|
||||||
|
|
||||||
|
private $redirTitles = array();
|
||||||
|
private $continueStr = null;
|
||||||
|
|
||||||
// output element name, database column field prefix, database table
|
// output element name, database column field prefix, database table
|
||||||
private $backlinksSettings = array(
|
private $backlinksSettings = array(
|
||||||
|
|
@ -232,9 +242,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
||||||
$res = $this->select( __METHOD__ . '::firstQuery' );
|
$res = $this->select( __METHOD__ . '::firstQuery' );
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$this->pageMap = array(); // Maps ns and title to pageid
|
|
||||||
$this->continueStr = null;
|
|
||||||
$this->redirTitles = array();
|
|
||||||
foreach ( $res as $row ) {
|
foreach ( $res as $row ) {
|
||||||
if ( ++ $count > $this->params['limit'] ) {
|
if ( ++ $count > $this->params['limit'] ) {
|
||||||
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
|
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,13 @@ class ApiQueryInfo extends ApiQueryBase {
|
||||||
$fld_readable = false, $fld_watched = false,
|
$fld_readable = false, $fld_watched = false,
|
||||||
$fld_preload = false, $fld_displaytitle = false;
|
$fld_preload = false, $fld_displaytitle = false;
|
||||||
|
|
||||||
|
private $params, $titles, $missing, $everything, $pageCounter;
|
||||||
|
|
||||||
|
private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
|
||||||
|
$pageLatest, $pageLength;
|
||||||
|
|
||||||
|
private $protections, $watched, $talkids, $subjectids, $displaytitles;
|
||||||
|
|
||||||
private $tokenFunctions;
|
private $tokenFunctions;
|
||||||
|
|
||||||
public function __construct( $query, $moduleName ) {
|
public function __construct( $query, $moduleName ) {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,11 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function runQuery( &$resultPageSet ) {
|
/**
|
||||||
|
* @param $resultPageSet ApiPageSet
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function runQuery( $resultPageSet = null ) {
|
||||||
$res = $this->select( __METHOD__ );
|
$res = $this->select( __METHOD__ );
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ( $res as $row ) {
|
foreach ( $res as $row ) {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
||||||
|
|
||||||
private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
|
private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
|
||||||
$fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
|
$fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
|
||||||
$fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false, $fld_tags = false;
|
$fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
|
||||||
|
$fld_tags = false, $token = array();
|
||||||
|
|
||||||
private $tokenFunctions;
|
private $tokenFunctions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
|
||||||
class ApiQueryRevisions extends ApiQueryBase {
|
class ApiQueryRevisions extends ApiQueryBase {
|
||||||
|
|
||||||
private $diffto, $difftotext, $expandTemplates, $generateXML, $section,
|
private $diffto, $difftotext, $expandTemplates, $generateXML, $section,
|
||||||
$token;
|
$token, $parseContent;
|
||||||
|
|
||||||
public function __construct( $query, $moduleName ) {
|
public function __construct( $query, $moduleName ) {
|
||||||
parent::__construct( $query, $moduleName, 'rv' );
|
parent::__construct( $query, $moduleName, 'rv' );
|
||||||
|
|
@ -126,8 +126,7 @@ class ApiQueryRevisions extends ApiQueryBase {
|
||||||
$params['diffto'] = 0;
|
$params['diffto'] = 0;
|
||||||
}
|
}
|
||||||
if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
|
if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
|
||||||
&& $params['diffto'] != 'prev' && $params['diffto'] != 'next' )
|
&& $params['diffto'] != 'prev' && $params['diffto'] != 'next' ) {
|
||||||
{
|
|
||||||
$this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
|
$this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
|
||||||
}
|
}
|
||||||
// Check whether the revision exists and is readable,
|
// Check whether the revision exists and is readable,
|
||||||
|
|
@ -176,7 +175,6 @@ class ApiQueryRevisions extends ApiQueryBase {
|
||||||
$this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
|
$this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !is_null( $this->token ) || $pageCount > 0 ) {
|
if ( !is_null( $this->token ) || $pageCount > 0 ) {
|
||||||
$this->addFields( Revision::selectPageFields() );
|
$this->addFields( Revision::selectPageFields() );
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +232,6 @@ class ApiQueryRevisions extends ApiQueryBase {
|
||||||
// Bug 24166 - API error when using rvprop=tags
|
// Bug 24166 - API error when using rvprop=tags
|
||||||
$this->addTables( 'revision' );
|
$this->addTables( 'revision' );
|
||||||
|
|
||||||
|
|
||||||
if ( $enumRevMode ) {
|
if ( $enumRevMode ) {
|
||||||
// This is mostly to prevent parameter errors (and optimize SQL?)
|
// This is mostly to prevent parameter errors (and optimize SQL?)
|
||||||
if ( !is_null( $params['startid'] ) && !is_null( $params['start'] ) ) {
|
if ( !is_null( $params['startid'] ) && !is_null( $params['start'] ) ) {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,15 @@ class ApiRollback extends ApiBase {
|
||||||
parent::__construct( $main, $action );
|
parent::__construct( $main, $action );
|
||||||
}
|
}
|
||||||
|
|
||||||
private $mTitleObj = null, $mUser = null;
|
/**
|
||||||
|
* @var Title
|
||||||
|
*/
|
||||||
|
private $mTitleObj = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
private $mUser = null;
|
||||||
|
|
||||||
public function execute() {
|
public function execute() {
|
||||||
$params = $this->extractRequestParams();
|
$params = $this->extractRequestParams();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue