Bug 7474, CACHE_DB/CACHE_MEMCACHED confusion
[mediawiki.git] / api.php
blob63802c50e4056716c04edef3d8f14aa2981e1834
1 <?php
4 /**
5 * API for MediaWiki 1.8+
7 * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
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.
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.
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
25 // Initialise common code
26 require (dirname(__FILE__) . '/includes/WebStart.php');
28 /**
29 * When no format parameter is given, this format will be used
31 define('API_DEFAULT_FORMAT', 'xmlfm');
33 /**
34 * Location of all api-related files (must end with a slash '/')
36 define('API_DIR', 'includes/api/');
38 /**
39 * List of classes and containing files.
41 $wgApiAutoloadClasses = array (
43 'ApiMain' => API_DIR . 'ApiMain.php',
45 // Utility classes
46 'ApiBase' => API_DIR . 'ApiBase.php',
47 'ApiQueryBase' => API_DIR . 'ApiQueryBase.php',
48 'ApiResult' => API_DIR . 'ApiResult.php',
49 'ApiPageSet' => API_DIR . 'ApiPageSet.php',
51 // Formats
52 'ApiFormatBase' => API_DIR . 'ApiFormatBase.php',
53 'ApiFormatYaml' => API_DIR . 'ApiFormatYaml.php',
54 'ApiFormatXml' => API_DIR . 'ApiFormatXml.php',
55 'ApiFormatJson' => API_DIR . 'ApiFormatJson.php',
57 // Modules (action=...) - should match the $apiModules list
58 'ApiHelp' => API_DIR . 'ApiHelp.php',
59 'ApiLogin' => API_DIR . 'ApiLogin.php',
60 'ApiQuery' => API_DIR . 'ApiQuery.php',
62 // Query items (meta/prop/list=...)
63 'ApiQuerySiteinfo' => API_DIR . 'ApiQuerySiteinfo.php',
64 'ApiQueryInfo' => API_DIR . 'ApiQueryInfo.php',
65 'ApiQueryRevisions' => API_DIR . 'ApiQueryRevisions.php',
66 'ApiQueryAllpages' => API_DIR . 'ApiQueryAllpages.php'
69 /**
70 * List of available modules: action name => module class
71 * The class must also be listed in the $wgApiAutoloadClasses array.
73 $wgApiModules = array (
74 'help' => 'ApiHelp',
75 'login' => 'ApiLogin',
76 'query' => 'ApiQuery'
79 /**
80 * List of available formats: format name => format class
81 * The class must also be listed in the $wgApiAutoloadClasses array.
83 $wgApiFormats = array (
84 'json' => 'ApiFormatJson',
85 'jsonfm' => 'ApiFormatJson',
86 'xml' => 'ApiFormatXml',
87 'xmlfm' => 'ApiFormatXml',
88 'yaml' => 'ApiFormatYaml',
89 'yamlfm' => 'ApiFormatYaml'
92 wfProfileIn('api.php');
94 // Verify that the API has not been disabled
95 if (!$wgEnableAPI) {
96 echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
97 echo '<pre><b>$wgEnableAPI=true;</b></pre>';
98 die(-1);
101 $wgAutoloadClasses = array_merge($wgAutoloadClasses, $wgApiAutoloadClasses);
103 $processor = new ApiMain($wgRequestTime, $wgApiModules, $wgApiFormats, $wgEnableWriteAPI);
104 $processor->execute();
106 wfProfileOut('api.php');
107 wfLogProfilingData();