Namespace all remaining classes in includes/parser
[mediawiki.git] / opensearch_desc.php
blob2a78a97d30ff5c67abcfccd5f7eb71d0b08e8221
1 <?php
2 /**
3 * The web entry point for generating an OpenSearch description document.
5 * See <http://www.opensearch.org/> for the specification of the OpenSearch
6 * "description" document. In a nut shell, this tells browsers how and where
7 * to submit submit search queries to get a search results page back,
8 * as well as how to get typeahead suggestions (see ApiOpenSearch).
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/gpl.html
25 * @file
26 * @ingroup entrypoint
29 // This endpoint is supposed to be independent of request cookies and other
30 // details of the session. Enforce this constraint with respect to session use.
31 define( 'MW_NO_SESSION', 1 );
33 define( 'MW_ENTRY_POINT', 'opensearch_desc' );
35 require_once __DIR__ . '/includes/WebStart.php';
37 $url = wfScript( 'rest' ) . '/v1/search';
38 $ctype = $wgRequest->getRawVal( 'ctype' );
40 if ( $ctype !== null ) {
41 $url = wfAppendQuery( $url, [ 'ctype' => $ctype ] );
44 $wgRequest->response()->header( 'Location: ' . $url, true, 308 );
45 $wgRequest->response()->header( 'Cache-control: max-age=600' );