From a3a4ea87579f1395e3acbc870398b95e5e4b040a Mon Sep 17 00:00:00 2001 From: Sergio Santoro Date: Tue, 22 Jul 2014 15:18:15 +0200 Subject: [PATCH] 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 --- api.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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() ); -- 2.20.1