Merge "Proper namespace handling for WikiImporter"
[lhc/web/wiklou.git] / includes / Defines.php
1 <?php
2 /**
3 * A few constants that might be needed during LocalSettings.php.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 /**
24 * @defgroup Constants MediaWiki constants
25 */
26
27 /**
28 * Version constants for the benefit of extensions
29 */
30 define( 'MW_SPECIALPAGE_VERSION', 2 );
31
32 /**@{
33 * Database related constants
34 */
35 define( 'DBO_DEBUG', 1 );
36 define( 'DBO_NOBUFFER', 2 );
37 define( 'DBO_IGNORE', 4 );
38 define( 'DBO_TRX', 8 ); // automatically start transaction on first query
39 define( 'DBO_DEFAULT', 16 );
40 define( 'DBO_PERSISTENT', 32 );
41 define( 'DBO_SYSDBA', 64 ); //for oracle maintenance
42 define( 'DBO_DDLMODE', 128 ); // when using schema files: mostly for Oracle
43 define( 'DBO_SSL', 256 );
44 define( 'DBO_COMPRESS', 512 );
45 /**@}*/
46
47 /**@{
48 * Valid database indexes
49 * Operation-based indexes
50 */
51 define( 'DB_SLAVE', -1 ); # Read from the slave (or only server)
52 define( 'DB_MASTER', -2 ); # Write to master (or only server)
53 /**@}*/
54
55 # Obsolete aliases
56 define( 'DB_READ', -1 );
57 define( 'DB_WRITE', -2 );
58
59 /**@{
60 * Virtual namespaces; don't appear in the page database
61 */
62 define( 'NS_MEDIA', -2 );
63 define( 'NS_SPECIAL', -1 );
64 /**@}*/
65
66 /**@{
67 * Real namespaces
68 *
69 * Number 100 and beyond are reserved for custom namespaces;
70 * DO NOT assign standard namespaces at 100 or beyond.
71 * DO NOT Change integer values as they are most probably hardcoded everywhere
72 * see bug #696 which talked about that.
73 */
74 define( 'NS_MAIN', 0 );
75 define( 'NS_TALK', 1 );
76 define( 'NS_USER', 2 );
77 define( 'NS_USER_TALK', 3 );
78 define( 'NS_PROJECT', 4 );
79 define( 'NS_PROJECT_TALK', 5 );
80 define( 'NS_FILE', 6 );
81 define( 'NS_FILE_TALK', 7 );
82 define( 'NS_MEDIAWIKI', 8 );
83 define( 'NS_MEDIAWIKI_TALK', 9 );
84 define( 'NS_TEMPLATE', 10 );
85 define( 'NS_TEMPLATE_TALK', 11 );
86 define( 'NS_HELP', 12 );
87 define( 'NS_HELP_TALK', 13 );
88 define( 'NS_CATEGORY', 14 );
89 define( 'NS_CATEGORY_TALK', 15 );
90
91 /**
92 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
93 * NS_FILE_TALK respectively, and are kept for compatibility.
94 *
95 * When writing code that should be compatible with older MediaWiki
96 * versions, either stick to the old names or define the new constants
97 * yourself, if they're not defined already.
98 */
99 define( 'NS_IMAGE', NS_FILE );
100 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
101 /**@}*/
102
103 /**@{
104 * Cache type
105 */
106 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
107 define( 'CACHE_NONE', 0 ); // Do not cache
108 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
109 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
110 define( 'CACHE_ACCEL', 3 ); // APC, XCache or WinCache
111 /**@}*/
112
113 /**@{
114 * Media types.
115 * This defines constants for the value returned by File::getMediaType()
116 */
117 // unknown format
118 define( 'MEDIATYPE_UNKNOWN', 'UNKNOWN' );
119 // some bitmap image or image source (like psd, etc). Can't scale up.
120 define( 'MEDIATYPE_BITMAP', 'BITMAP' );
121 // some vector drawing (SVG, WMF, PS, ...) or image source (oo-draw, etc). Can scale up.
122 define( 'MEDIATYPE_DRAWING', 'DRAWING' );
123 // simple audio file (ogg, mp3, wav, midi, whatever)
124 define( 'MEDIATYPE_AUDIO', 'AUDIO' );
125 // simple video file (ogg, mpg, etc;
126 // no not include formats here that may contain executable sections or scripts!)
127 define( 'MEDIATYPE_VIDEO', 'VIDEO' );
128 // Scriptable Multimedia (flash, advanced video container formats, etc)
129 define( 'MEDIATYPE_MULTIMEDIA', 'MULTIMEDIA' );
130 // Office Documents, Spreadsheets (office formats possibly containing apples, scripts, etc)
131 define( 'MEDIATYPE_OFFICE', 'OFFICE' );
132 // Plain text (possibly containing program code or scripts)
133 define( 'MEDIATYPE_TEXT', 'TEXT' );
134 // binary executable
135 define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' );
136 // archive file (zip, tar, etc)
137 define( 'MEDIATYPE_ARCHIVE', 'ARCHIVE' );
138 /**@}*/
139
140 /**@{
141 * Antivirus result codes, for use in $wgAntivirusSetup.
142 */
143 define( 'AV_NO_VIRUS', 0 ); #scan ok, no virus found
144 define( 'AV_VIRUS_FOUND', 1 ); #virus found!
145 define( 'AV_SCAN_ABORTED', -1 ); #scan aborted, the file is probably immune
146 define( 'AV_SCAN_FAILED', false ); #scan failed (scanner not found or error in scanner)
147 /**@}*/
148
149 /**@{
150 * Anti-lock flags
151 * Was used by $wgAntiLockFlags, which was removed with 1.25
152 * Constants kept to not have warnings when used in LocalSettings
153 */
154 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
155 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
156 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
157 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
158 /**@}*/
159
160 /**@{
161 * Date format selectors; used in user preference storage and by
162 * Language::date() and co.
163 */
164 define( 'MW_DATE_DEFAULT', 'default' );
165 define( 'MW_DATE_MDY', 'mdy' );
166 define( 'MW_DATE_DMY', 'dmy' );
167 define( 'MW_DATE_YMD', 'ymd' );
168 define( 'MW_DATE_ISO', 'ISO 8601' );
169 /**@}*/
170
171 /**@{
172 * RecentChange type identifiers
173 */
174 define( 'RC_EDIT', 0 );
175 define( 'RC_NEW', 1 );
176 define( 'RC_LOG', 3 );
177 define( 'RC_EXTERNAL', 5 );
178 /**@}*/
179
180 /**@{
181 * Article edit flags
182 */
183 define( 'EDIT_NEW', 1 );
184 define( 'EDIT_UPDATE', 2 );
185 define( 'EDIT_MINOR', 4 );
186 define( 'EDIT_SUPPRESS_RC', 8 );
187 define( 'EDIT_FORCE_BOT', 16 );
188 define( 'EDIT_DEFER_UPDATES', 32 );
189 define( 'EDIT_AUTOSUMMARY', 64 );
190 /**@}*/
191
192 /**@{
193 * Flags for Database::makeList()
194 * These are also available as Database class constants
195 */
196 define( 'LIST_COMMA', 0 );
197 define( 'LIST_AND', 1 );
198 define( 'LIST_SET', 2 );
199 define( 'LIST_NAMES', 3 );
200 define( 'LIST_OR', 4 );
201 /**@}*/
202
203 /**
204 * Unicode and normalisation related
205 */
206 require_once __DIR__ . '/normal/UtfNormalDefines.php';
207
208 /**@{
209 * Hook support constants
210 */
211 define( 'MW_SUPPORTS_EDITFILTERMERGED', 1 );
212 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
213 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
214 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
215 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
216 /**@}*/
217
218 /** Support for $wgResourceModules */
219 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
220
221 /**@{
222 * Allowed values for Parser::$mOutputType
223 * Parameter to Parser::startExternalParse().
224 * Use of Parser consts is preferred:
225 * - Parser::OT_HTML
226 * - Parser::OT_WIKI
227 * - Parser::OT_PREPROCESS
228 * - Parser::OT_MSG
229 * - Parser::OT_PLAIN
230 */
231 define( 'OT_HTML', 1 );
232 define( 'OT_WIKI', 2 );
233 define( 'OT_PREPROCESS', 3 );
234 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
235 define( 'OT_PLAIN', 4 );
236 /**@}*/
237
238 /**@{
239 * Flags for Parser::setFunctionHook
240 * Use of Parser consts is preferred:
241 * - Parser::SFH_NO_HASH
242 * - Parser::SFH_OBJECT_ARGS
243 */
244 define( 'SFH_NO_HASH', 1 );
245 define( 'SFH_OBJECT_ARGS', 2 );
246 /**@}*/
247
248 /**
249 * Flags for Parser::replaceLinkHolders
250 */
251 define( 'RLH_FOR_UPDATE', 1 );
252
253 /**@{
254 * Autopromote conditions (must be here and not in Autopromote.php, so that
255 * they're loaded for DefaultSettings.php before AutoLoader.php)
256 */
257 define( 'APCOND_EDITCOUNT', 1 );
258 define( 'APCOND_AGE', 2 );
259 define( 'APCOND_EMAILCONFIRMED', 3 );
260 define( 'APCOND_INGROUPS', 4 );
261 define( 'APCOND_ISIP', 5 );
262 define( 'APCOND_IPINRANGE', 6 );
263 define( 'APCOND_AGE_FROM_EDIT', 7 );
264 define( 'APCOND_BLOCKED', 8 );
265 define( 'APCOND_ISBOT', 9 );
266 /**@}*/
267
268 /** @{
269 * Protocol constants for wfExpandUrl()
270 */
271 define( 'PROTO_HTTP', 'http://' );
272 define( 'PROTO_HTTPS', 'https://' );
273 define( 'PROTO_RELATIVE', '//' );
274 define( 'PROTO_CURRENT', null );
275 define( 'PROTO_CANONICAL', 1 );
276 define( 'PROTO_INTERNAL', 2 );
277 /**@}*/
278
279 /**@{
280 * Content model ids, used by Content and ContentHandler.
281 * These IDs will be exposed in the API and XML dumps.
282 *
283 * Extensions that define their own content model IDs should take
284 * care to avoid conflicts. Using the extension name as a prefix is recommended,
285 * for example 'myextension-somecontent'.
286 */
287 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
288 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
289 define( 'CONTENT_MODEL_CSS', 'css' );
290 define( 'CONTENT_MODEL_TEXT', 'text' );
291 define( 'CONTENT_MODEL_JSON', 'json' );
292 /**@}*/
293
294 /**@{
295 * Content formats, used by Content and ContentHandler.
296 * These should be MIME types, and will be exposed in the API and XML dumps.
297 *
298 * Extensions are free to use the below formats, or define their own.
299 * It is recommended to stick with the conventions for MIME types.
300 */
301 // wikitext
302 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
303 // for js pages
304 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
305 // for css pages
306 define( 'CONTENT_FORMAT_CSS', 'text/css' );
307 // for future use, e.g. with some plain-html messages.
308 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
309 // for future use, e.g. with some plain-html messages.
310 define( 'CONTENT_FORMAT_HTML', 'text/html' );
311 // for future use with the api and for extensions
312 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
313 // for future use with the api, and for use by extensions
314 define( 'CONTENT_FORMAT_JSON', 'application/json' );
315 // for future use with the api, and for use by extensions
316 define( 'CONTENT_FORMAT_XML', 'application/xml' );
317 /**@}*/