X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=api.php;h=2a6a095de1ada9c3b2026e7a33936be327623d3a;hb=ecc5f63a84013155656b37c27da917a02328dbfc;hp=e55ec75a33523e8fde0a1c19b5a07d6f1408b63a;hpb=c45d497eda452d619b61b0da231c1c753d8cac93;p=lhc%2Fweb%2Fwiklou.git diff --git a/api.php b/api.php index e55ec75a33..2a6a095de1 100644 --- a/api.php +++ b/api.php @@ -34,7 +34,7 @@ define( 'MW_API', true ); // Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { +if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ require dirname( __FILE__ ) . '/includes/PHPVersionError.php'; wfPHPVersionError( 'api.php' ); @@ -104,12 +104,17 @@ if ( $wgAPIRequestLog ) { wfTimestamp( TS_MW ), $endtime - $starttime, $wgRequest->getIP(), - $_SERVER['HTTP_USER_AGENT'] + $wgRequest->getHeader( 'User-agent' ) ); $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() );