本文整理汇总了PHP中MWDebug::appendDebugInfoToApiResult方法的典型用法代码示例。如果您正苦于以下问题:PHP MWDebug::appendDebugInfoToApiResult方法的具体用法?PHP MWDebug::appendDebugInfoToApiResult怎么用?PHP MWDebug::appendDebugInfoToApiResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWDebug
的用法示例。
在下文中一共展示了MWDebug::appendDebugInfoToApiResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAppendDebugInfoToApiResultXmlFormat
/**
* @covers MWDebug::appendDebugInfoToApiResult
*/
public function testAppendDebugInfoToApiResultXmlFormat()
{
$request = $this->newApiRequest(['action' => 'help', 'format' => 'xml'], '/api.php?action=help&format=xml');
$context = new RequestContext();
$context->setRequest($request);
$apiMain = new ApiMain($context);
$result = new ApiResult($apiMain);
MWDebug::appendDebugInfoToApiResult($context, $result);
$this->assertInstanceOf('ApiResult', $result);
$data = $result->getResultData();
$expectedKeys = ['mwVersion', 'phpEngine', 'phpVersion', 'gitRevision', 'gitBranch', 'gitViewUrl', 'time', 'log', 'debugLog', 'queries', 'request', 'memory', 'memoryPeak', 'includes', '_element'];
foreach ($expectedKeys as $expectedKey) {
$this->assertArrayHasKey($expectedKey, $data['debuginfo'], "debuginfo has {$expectedKey}");
}
$xml = ApiFormatXml::recXmlPrint('help', $data);
// exception not thrown
$this->assertInternalType('string', $xml);
}
示例2: executeAction
/**
* Execute the actual module, without any error handling
*/
protected function executeAction()
{
$params = $this->setupExecuteAction();
$module = $this->setupModule();
$this->mModule = $module;
$this->checkExecutePermissions($module);
if (!$this->checkMaxLag($module, $params)) {
return;
}
if (!$this->checkConditionalRequestHeaders($module)) {
return;
}
if (!$this->mInternalMode) {
$this->setupExternalResponse($module, $params);
}
$this->checkAsserts($params);
// Execute
$module->execute();
Hooks::run('APIAfterExecute', array(&$module));
$this->reportUnusedParams();
if (!$this->mInternalMode) {
// append Debug information
MWDebug::appendDebugInfoToApiResult($this->getContext(), $this->getResult());
// Print result data
$this->printResult(false);
}
}
示例3: executeAction
/**
* Execute the actual module, without any error handling
*/
protected function executeAction()
{
$params = $this->setupExecuteAction();
$module = $this->setupModule();
$this->checkExecutePermissions($module);
if (!$this->checkMaxLag($module, $params)) {
return;
}
if (!$this->mInternalMode) {
$this->setupExternalResponse($module, $params);
}
// Execute
$module->profileIn();
$module->execute();
wfRunHooks('APIAfterExecute', array(&$module));
$module->profileOut();
if (!$this->mInternalMode) {
//append Debug information
MWDebug::appendDebugInfoToApiResult($this->getContext(), $this->getResult());
// Print result data
$this->printResult(false);
}
}