From: Tim Starling Date: Thu, 16 May 2019 04:36:45 +0000 (+1000) Subject: Add rest.php (REST API endpoint) with feature flag X-Git-Tag: 1.34.0-rc.0~1101^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=490e35598dfa406d9acd886b85e3ae7e9260e27e;p=lhc%2Fweb%2Fwiklou.git Add rest.php (REST API endpoint) with feature flag Change-Id: I0f9aaa9cc81f93c00f7a28041615d7290b453803 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a32af365d0..ce53060fba 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -8299,6 +8299,13 @@ $wgCrossSiteAJAXdomains = []; */ $wgCrossSiteAJAXdomainExceptions = []; +/** + * Enable the experimental REST API. + * + * This will be removed once the REST API is stable and used by clients. + */ +$wgEnableRestAPI = false; + /** @} */ # End AJAX and API } /************************************************************************//** diff --git a/includes/Rest/EntryPoint.php b/includes/Rest/EntryPoint.php index 40d0b4a2f8..a14c1a1294 100644 --- a/includes/Rest/EntryPoint.php +++ b/includes/Rest/EntryPoint.php @@ -32,6 +32,12 @@ class EntryPoint { $services = MediaWikiServices::getInstance(); $conf = $services->getMainConfig(); + if ( !$conf->get( 'EnableRestAPI' ) ) { + wfHttpError( 403, 'Access Denied', + 'Set $wgEnableRestAPI to true to enable the experimental REST API' ); + return; + } + $request = new RequestFromGlobals( [ 'cookiePrefix' => $conf->get( 'CookiePrefix' ) ] ); diff --git a/rest.php b/rest.php new file mode 100644 index 0000000000..3ac532e43d --- /dev/null +++ b/rest.php @@ -0,0 +1,28 @@ +