// Log the request
if ( $wgAPIRequestLog ) {
- wfErrorLog( implode( ',', array(
+ $items = array(
wfTimestamp( TS_MW ),
$endtime - $starttime,
wfGetIP(),
- wfArrayToCGI( $wgRequest->getValues() )
- ) ) . "\n", $wgAPIRequestLog );
+ $_SERVER['HTTP_USER_AGENT']
+ );
+ $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';
+ if ( $processor->getModule()->mustBePosted() ) {
+ $items[] = "action=" . $wgRequest->getVal( 'action' );
+ } else {
+ $items[] = wfArrayToCGI( $wgRequest->getValues() );
+ }
+ wfErrorLog( implode( ',', $items ) . "\n", $wgAPIRequestLog );
wfDebug( "Logged API request to $wgAPIRequestLog\n" );
}
private $mPrinter, $mModules, $mModuleNames, $mFormats, $mFormatNames;
- private $mResult, $mAction, $mShowVersions, $mEnableWrite, $mRequest, $mInternalMode, $mSquidMaxage;
+ private $mResult, $mAction, $mShowVersions, $mEnableWrite, $mRequest;
+ private $mInternalMode, $mSquidMaxage, $mModule;
/**
* Constructs an instance of ApiMain that utilizes the module and format specified by $request.
public function getResult() {
return $this->mResult;
}
+
+ /**
+ * Get the API module object. Only works after executeAction()
+ */
+ public function getModule() {
+ return $this->mModule;
+ }
/**
* Only kept for backwards compatibility
// Instantiate the module requested by the user
$module = new $this->mModules[$this->mAction] ($this, $this->mAction);
+ $this->mModule = $module;
if( $module->shouldCheckMaxlag() && isset( $params['maxlag'] ) ) {
// Check for maxlag