ImageMagick 5.5.8 was the beta, 6.0.0 the actual release
[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 $wgApiStartTime = microtime(true);
26
27 /**
28 * When no format parameter is given, this format will be used
29 */
30 define('API_DEFAULT_FORMAT', 'xmlfm');
31
32 /**
33 * Location of all api-related files (must end with a slash '/')
34 */
35 define('API_DIR', 'includes/api/');
36
37 /**
38 * List of classes and containing files.
39 */
40 $wgApiAutoloadClasses = array (
41
42 'ApiMain' => API_DIR . 'ApiMain.php',
43
44 // Utility classes
45 'ApiBase' => API_DIR . 'ApiBase.php',
46 'ApiQueryBase' => API_DIR . 'ApiQueryBase.php',
47 'ApiResult' => API_DIR . 'ApiResult.php',
48 'ApiPageSet' => API_DIR . 'ApiPageSet.php',
49
50 // Formats
51 'ApiFormatBase' => API_DIR . 'ApiFormatBase.php',
52 'ApiFormatYaml' => API_DIR . 'ApiFormatYaml.php',
53 'ApiFormatXml' => API_DIR . 'ApiFormatXml.php',
54 'ApiFormatJson' => API_DIR . 'ApiFormatJson.php',
55
56 // Modules (action=...) - should match the $apiModules list
57 'ApiHelp' => API_DIR . 'ApiHelp.php',
58 'ApiLogin' => API_DIR . 'ApiLogin.php',
59 'ApiQuery' => API_DIR . 'ApiQuery.php',
60
61 // Query items (meta/prop/list=...)
62 'ApiQuerySiteinfo' => API_DIR . 'ApiQuerySiteinfo.php',
63 'ApiQueryInfo' => API_DIR . 'ApiQueryInfo.php',
64 'ApiQueryRevisions' => API_DIR . 'ApiQueryRevisions.php',
65 'ApiQueryAllpages' => API_DIR . 'ApiQueryAllpages.php'
66 );
67
68 /**
69 * List of available modules: action name => module class
70 * The class must also be listed in the $wgApiAutoloadClasses array.
71 */
72 $wgApiModules = array (
73 'help' => 'ApiHelp',
74 'login' => 'ApiLogin',
75 'query' => 'ApiQuery'
76 );
77
78 /**
79 * List of available formats: format name => format class
80 * The class must also be listed in the $wgApiAutoloadClasses array.
81 */
82 $wgApiFormats = array (
83 'json' => 'ApiFormatJson',
84 'jsonfm' => 'ApiFormatJson',
85 'xml' => 'ApiFormatXml',
86 'xmlfm' => 'ApiFormatXml',
87 'yaml' => 'ApiFormatYaml',
88 'yamlfm' => 'ApiFormatYaml'
89 );
90
91 // Initialise common code
92 require (dirname(__FILE__) . '/includes/WebStart.php');
93 wfProfileIn('api.php');
94
95 // Verify that the API has not been disabled
96 // The next line should be
97 // if (isset ($wgEnableAPI) && !$wgEnableAPI) {
98 // but will be in a safe mode until api is stabler
99 if (!isset ($wgEnableAPI) || !$wgEnableAPI) {
100 echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
101 echo '<pre><b>$wgEnableAPI=true;</b></pre>';
102 die(-1);
103 }
104
105 $wgAutoloadClasses = array_merge($wgAutoloadClasses, $wgApiAutoloadClasses);
106
107 if (!isset($wgEnableWriteAPI))
108 $wgEnableWriteAPI = false; // This should be 'true' later, once the api is stable.
109
110 $processor = new ApiMain($wgApiStartTime, $wgApiModules, $wgApiFormats, $wgEnableWriteAPI);
111 $processor->execute();
112
113 wfProfileOut('api.php');
114 wfLogProfilingData();
115 exit; // Done!
116 ?>