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