X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=api.php;h=6f4bac39015dd00d88e5678372a931f32fcdc4b4;hb=13d176d840f85a58dd1411621c0af93a3877bfa7;hp=9cf75787ba1a387cfa4dd0699d0aa4e48c12d3f4;hpb=ba6c8274856d34f9e524ce66e707f19555c31f1f;p=lhc%2Fweb%2Fwiklou.git diff --git a/api.php b/api.php index 9cf75787ba..6f4bac3901 100644 --- a/api.php +++ b/api.php @@ -31,6 +31,7 @@ use MediaWiki\Logger\LegacyLogger; // So extensions (and other code) can check whether they're running in API mode define( 'MW_API', true ); +define( 'MW_ENTRY_POINT', 'api' ); require __DIR__ . '/includes/WebStart.php'; @@ -41,10 +42,10 @@ if ( !$wgRequest->checkUrlExtension() ) { return; } -// Pathinfo can be used for stupid things. We don't support it for api.php at +// PATH_INFO can be used for stupid things. We don't support it for api.php at // all, so error out if it's present. if ( isset( $_SERVER['PATH_INFO'] ) && $_SERVER['PATH_INFO'] != '' ) { - $correctUrl = wfAppendQuery( wfScript( 'api' ), $wgRequest->getQueryValues() ); + $correctUrl = wfAppendQuery( wfScript( 'api' ), $wgRequest->getQueryValuesOnly() ); $correctUrl = wfExpandUrl( $correctUrl, PROTO_CANONICAL ); header( "Location: $correctUrl", true, 301 ); echo 'This endpoint does not support "path info", i.e. extra text between "api.php"' @@ -61,10 +62,9 @@ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Badtitle/dummy title for API calls set RequestContext::getMain()->setTitle( $wgTitle ); try { - /* Construct an ApiMain with the arguments passed via the URL. What we get back - * is some form of an ApiMain, possibly even one that produces an error message, - * but we don't care here, as that is handled by the constructor. - */ + // Construct an ApiMain with the arguments passed via the URL. What we get back + // is some form of an ApiMain, possibly even one that produces an error message, + // but we don't care here, as that is handled by the constructor. $processor = new ApiMain( RequestContext::getMain(), true ); // Last chance hook before executing the API