* API: Restructured to allow internal usage. Error handling cleanup.
[lhc/web/wiklou.git] / api.php
1 <?php
2
3
4 /**
5 * API for MediaWiki 1.8+
6 *
7 * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 */
24
25 // Initialise common code
26 require (dirname(__FILE__) . '/includes/WebStart.php');
27
28 wfProfileIn('api.php');
29
30 // Verify that the API has not been disabled
31 if (!$wgEnableAPI) {
32 echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
33 echo '<pre><b>$wgEnableAPI=true;</b></pre>';
34 die(-1);
35 }
36
37 $processor = new ApiMain($wgRequest, $wgEnableWriteAPI);
38 $processor->execute();
39
40 wfProfileOut('api.php');
41 wfLogProfilingData();
42 ?>