From: Sergio Santoro Date: Tue, 22 Jul 2014 13:18:15 +0000 (+0200) Subject: Api request log: improve module retrieval X-Git-Tag: 1.31.0-rc.0~14642^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=a3a4ea87579f1395e3acbc870398b95e5e4b040a;p=lhc%2Fweb%2Fwiklou.git Api request log: improve module retrieval The execution of an API request can throw an exception. In those cases $processor->getModule() could return NULL. Use the module manager directly to try to retrieve the module instance. Change-Id: Ie49762681ef797388216ab40d99b8e7458a837f6 --- diff --git a/api.php b/api.php index e8a911e3a1..6b5a0a048b 100644 --- a/api.php +++ b/api.php @@ -108,8 +108,13 @@ if ( $wgAPIRequestLog ) { ); $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET'; if ( $processor ) { - $module = $processor->getModule(); - if ( $module->mustBePosted() ) { + try { + $manager = $processor->getModuleManager(); + $module = $manager->getModule( $wgRequest->getVal( 'action' ), 'action' ); + } catch ( Exception $ex ) { + $module = null; + } + if ( !$module || $module->mustBePosted() ) { $items[] = "action=" . $wgRequest->getVal( 'action' ); } else { $items[] = wfArrayToCgi( $wgRequest->getValues() );