* @defgroup API API
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiBase.php' );
-}
-
/**
* This is the main API class, used for both external and internal processing.
* When executed, it will create the requested formatter object,
'paraminfo' => 'ApiParamInfo',
'rsd' => 'ApiRsd',
'compare' => 'ApiComparePages',
+ 'tokens' => 'ApiTokens',
// Write modules
'purge' => 'ApiPurge',
'patrol' => 'ApiPatrol',
'import' => 'ApiImport',
'userrights' => 'ApiUserrights',
+ 'options' => 'ApiOptions',
);
/**
private $mPrinter;
private $mModules, $mModuleNames, $mFormats, $mFormatNames;
- private $mResult, $mAction, $mShowVersions, $mEnableWrite/*, $mRequest*/;
+ private $mResult, $mAction, $mShowVersions, $mEnableWrite;
private $mInternalMode, $mSquidMaxage, $mModule;
private $mCacheMode = 'private';
* $this->setCacheMode('private')
*/
public function setCachePrivate() {
+ wfDeprecated( __METHOD__, '1.17' );
$this->setCacheMode( 'private' );
}
* @deprecated since 1.17 Use setCacheMode( 'anon-public-user-private' )
*/
public function setVaryCookie() {
+ wfDeprecated( __METHOD__, '1.17' );
$this->setCacheMode( 'anon-public-user-private' );
}
$this->executeAction();
} catch ( Exception $e ) {
// Log it
- if ( $e instanceof MWException ) {
+ if ( !( $e instanceof UsageException ) ) {
wfDebugLog( 'exception', $e->getLogMessage() );
}
$moduleParams = $module->extractRequestParams();
// Die if token required, but not provided (unless there is a gettoken parameter)
+ if ( isset( $moduleParams['gettoken'] ) ) {
+ $gettoken = $moduleParams['gettoken'];
+ } else {
+ $gettoken = false;
+ }
+
$salt = $module->getTokenSalt();
- if ( $salt !== false && !isset( $moduleParams['gettoken'] ) ) {
+ if ( $salt !== false && !$gettoken ) {
if ( !isset( $moduleParams['token'] ) ) {
$this->dieUsageMsg( array( 'missingparam', 'token' ) );
} else {
- if ( !$this->getUser()->matchEditToken( $moduleParams['token'], $salt, $this->getRequest() ) ) {
+ if ( !$this->getUser()->matchEditToken( $moduleParams['token'], $salt ) ) {
$this->dieUsageMsg( 'sessionfailure' );
}
}
$module->profileOut();
if ( !$this->mInternalMode ) {
+ //append Debug information
+ MWDebug::appendDebugInfoToApiResult( $this->getContext(), $this->getResult() );
+
// Print result data
$this->printResult( false );
}
'wait until the replication lag is less than the specified value.',
'In case of a replag error, a HTTP 503 error is returned, with the message like',
'"Waiting for $host: $lag seconds lagged\n".',
- 'See http://www.mediawiki.org/wiki/Manual:Maxlag_parameter for more information',
+ 'See https://www.mediawiki.org/wiki/Manual:Maxlag_parameter for more information',
),
'smaxage' => 'Set the s-maxage header to this many seconds. Errors are never cached',
'maxage' => 'Set the max-age header to this many seconds. Errors are never cached',
'** **',
'** This is an auto-generated MediaWiki API documentation page **',
'** **',
- '** Documentation and Examples: **',
- '** http://www.mediawiki.org/wiki/API **',
+ '** Documentation and Examples: **',
+ '** https://www.mediawiki.org/wiki/API **',
'** **',
'**********************************************************************************************************',
'',
' In the case of an invalid action being passed, these will have a value',
' of "unknown_action"',
'',
- ' For more information see http://www.mediawiki.org/wiki/API:Errors_and_warnings',
+ ' For more information see https://www.mediawiki.org/wiki/API:Errors_and_warnings',
'',
- 'Documentation: http://www.mediawiki.org/wiki/API:Main_page',
- 'FAQ http://www.mediawiki.org/wiki/API:FAQ',
- 'Mailing list: http://lists.wikimedia.org/mailman/listinfo/mediawiki-api',
- 'Api Announcements: http://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce',
- 'Bugs & Requests: http://bugzilla.wikimedia.org/buglist.cgi?component=API&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=bugs.delta_ts',
+ 'Documentation: https://www.mediawiki.org/wiki/API:Main_page',
+ 'FAQ https://www.mediawiki.org/wiki/API:FAQ',
+ 'Mailing list: https://lists.wikimedia.org/mailman/listinfo/mediawiki-api',
+ 'Api Announcements: https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce',
+ 'Bugs & Requests: https://bugzilla.wikimedia.org/buglist.cgi?component=API&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=bugs.delta_ts',
'',
'',
'',
' Yuri Astrakhan <Firstname><Lastname>@gmail.com (creator, lead developer Sep 2006-Sep 2007)',
'',
'Please send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org',
- 'or file a bug report at http://bugzilla.wikimedia.org/'
+ 'or file a bug report at https://bugzilla.wikimedia.org/'
);
}
*/
public function getVersion() {
$vers = array();
- $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
+ $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
$vers[] = __CLASS__ . ': $Id$';
$vers[] = ApiBase::getBaseVersion();
$vers[] = ApiFormatBase::getBaseVersion();
*
* @ingroup API
*/
-class UsageException extends Exception {
+class UsageException extends MWException {
private $mCodestr;
private $mExtraData;