Merge "Add tracking for resolved conflicts"
[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 require_once __DIR__ . '/libs/mime/defines.php';
24 require_once __DIR__ . '/libs/rdbms/defines.php';
25 require_once __DIR__ . '/compat/normal/UtfNormalDefines.php';
26
27 use Wikimedia\Rdbms\IDatabase;
28
29 /**
30 * @defgroup Constants MediaWiki constants
31 */
32
33 # Obsolete aliases
34 define( 'DB_SLAVE', -1 );
35
36 /**@{
37 * Obsolete IDatabase::makeList() constants
38 * These are also available as Database class constants
39 */
40 define( 'LIST_COMMA', IDatabase::LIST_COMMA );
41 define( 'LIST_AND', IDatabase::LIST_AND );
42 define( 'LIST_SET', IDatabase::LIST_SET );
43 define( 'LIST_NAMES', IDatabase::LIST_NAMES );
44 define( 'LIST_OR', IDatabase::LIST_OR );
45 /**@}*/
46
47 /**@{
48 * Virtual namespaces; don't appear in the page database
49 */
50 define( 'NS_MEDIA', -2 );
51 define( 'NS_SPECIAL', -1 );
52 /**@}*/
53
54 /**@{
55 * Real namespaces
56 *
57 * Number 100 and beyond are reserved for custom namespaces;
58 * DO NOT assign standard namespaces at 100 or beyond.
59 * DO NOT Change integer values as they are most probably hardcoded everywhere
60 * see bug #696 which talked about that.
61 */
62 define( 'NS_MAIN', 0 );
63 define( 'NS_TALK', 1 );
64 define( 'NS_USER', 2 );
65 define( 'NS_USER_TALK', 3 );
66 define( 'NS_PROJECT', 4 );
67 define( 'NS_PROJECT_TALK', 5 );
68 define( 'NS_FILE', 6 );
69 define( 'NS_FILE_TALK', 7 );
70 define( 'NS_MEDIAWIKI', 8 );
71 define( 'NS_MEDIAWIKI_TALK', 9 );
72 define( 'NS_TEMPLATE', 10 );
73 define( 'NS_TEMPLATE_TALK', 11 );
74 define( 'NS_HELP', 12 );
75 define( 'NS_HELP_TALK', 13 );
76 define( 'NS_CATEGORY', 14 );
77 define( 'NS_CATEGORY_TALK', 15 );
78
79 /**
80 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
81 * NS_FILE_TALK respectively, and are kept for compatibility.
82 *
83 * When writing code that should be compatible with older MediaWiki
84 * versions, either stick to the old names or define the new constants
85 * yourself, if they're not defined already.
86 *
87 * @deprecated since 1.14
88 */
89 define( 'NS_IMAGE', NS_FILE );
90 /**
91 * @deprecated since 1.14
92 */
93 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
94 /**@}*/
95
96 /**@{
97 * Cache type
98 */
99 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
100 define( 'CACHE_NONE', 0 ); // Do not cache
101 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
102 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
103 define( 'CACHE_ACCEL', 3 ); // APC, XCache or WinCache
104 /**@}*/
105
106 /**@{
107 * Antivirus result codes, for use in $wgAntivirusSetup.
108 */
109 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
110 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
111 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
112 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
113 /**@}*/
114
115 /**@{
116 * Anti-lock flags
117 * Was used by $wgAntiLockFlags, which was removed with 1.25
118 * Constants kept to not have warnings when used in LocalSettings
119 */
120 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
121 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
122 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
123 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
124 /**@}*/
125
126 /**@{
127 * Date format selectors; used in user preference storage and by
128 * Language::date() and co.
129 */
130 define( 'MW_DATE_DEFAULT', 'default' );
131 define( 'MW_DATE_MDY', 'mdy' );
132 define( 'MW_DATE_DMY', 'dmy' );
133 define( 'MW_DATE_YMD', 'ymd' );
134 define( 'MW_DATE_ISO', 'ISO 8601' );
135 /**@}*/
136
137 /**@{
138 * RecentChange type identifiers
139 */
140 define( 'RC_EDIT', 0 );
141 define( 'RC_NEW', 1 );
142 define( 'RC_LOG', 3 );
143 define( 'RC_EXTERNAL', 5 );
144 define( 'RC_CATEGORIZE', 6 );
145 /**@}*/
146
147 /**@{
148 * Article edit flags
149 */
150 define( 'EDIT_NEW', 1 );
151 define( 'EDIT_UPDATE', 2 );
152 define( 'EDIT_MINOR', 4 );
153 define( 'EDIT_SUPPRESS_RC', 8 );
154 define( 'EDIT_FORCE_BOT', 16 );
155 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
156 define( 'EDIT_AUTOSUMMARY', 64 );
157 define( 'EDIT_INTERNAL', 128 );
158 /**@}*/
159
160 /**@{
161 * Hook support constants
162 */
163 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
164 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
165 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
166 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
167 /**@}*/
168
169 /** Support for $wgResourceModules */
170 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
171
172 /**@{
173 * Allowed values for Parser::$mOutputType
174 * Parameter to Parser::startExternalParse().
175 * Use of Parser consts is preferred:
176 * - Parser::OT_HTML
177 * - Parser::OT_WIKI
178 * - Parser::OT_PREPROCESS
179 * - Parser::OT_MSG
180 * - Parser::OT_PLAIN
181 */
182 define( 'OT_HTML', 1 );
183 define( 'OT_WIKI', 2 );
184 define( 'OT_PREPROCESS', 3 );
185 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
186 define( 'OT_PLAIN', 4 );
187 /**@}*/
188
189 /**@{
190 * Flags for Parser::setFunctionHook
191 * Use of Parser consts is preferred:
192 * - Parser::SFH_NO_HASH
193 * - Parser::SFH_OBJECT_ARGS
194 */
195 define( 'SFH_NO_HASH', 1 );
196 define( 'SFH_OBJECT_ARGS', 2 );
197 /**@}*/
198
199 /**@{
200 * Autopromote conditions (must be here and not in Autopromote.php, so that
201 * they're loaded for DefaultSettings.php before AutoLoader.php)
202 */
203 define( 'APCOND_EDITCOUNT', 1 );
204 define( 'APCOND_AGE', 2 );
205 define( 'APCOND_EMAILCONFIRMED', 3 );
206 define( 'APCOND_INGROUPS', 4 );
207 define( 'APCOND_ISIP', 5 );
208 define( 'APCOND_IPINRANGE', 6 );
209 define( 'APCOND_AGE_FROM_EDIT', 7 );
210 define( 'APCOND_BLOCKED', 8 );
211 define( 'APCOND_ISBOT', 9 );
212 /**@}*/
213
214 /** @{
215 * Protocol constants for wfExpandUrl()
216 */
217 define( 'PROTO_HTTP', 'http://' );
218 define( 'PROTO_HTTPS', 'https://' );
219 define( 'PROTO_RELATIVE', '//' );
220 define( 'PROTO_CURRENT', null );
221 define( 'PROTO_CANONICAL', 1 );
222 define( 'PROTO_INTERNAL', 2 );
223 /**@}*/
224
225 /**@{
226 * Content model ids, used by Content and ContentHandler.
227 * These IDs will be exposed in the API and XML dumps.
228 *
229 * Extensions that define their own content model IDs should take
230 * care to avoid conflicts. Using the extension name as a prefix is recommended,
231 * for example 'myextension-somecontent'.
232 */
233 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
234 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
235 define( 'CONTENT_MODEL_CSS', 'css' );
236 define( 'CONTENT_MODEL_TEXT', 'text' );
237 define( 'CONTENT_MODEL_JSON', 'json' );
238 /**@}*/
239
240 /**@{
241 * Content formats, used by Content and ContentHandler.
242 * These should be MIME types, and will be exposed in the API and XML dumps.
243 *
244 * Extensions are free to use the below formats, or define their own.
245 * It is recommended to stick with the conventions for MIME types.
246 */
247 // wikitext
248 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
249 // for js pages
250 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
251 // for css pages
252 define( 'CONTENT_FORMAT_CSS', 'text/css' );
253 // for future use, e.g. with some plain-html messages.
254 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
255 // for future use, e.g. with some plain-html messages.
256 define( 'CONTENT_FORMAT_HTML', 'text/html' );
257 // for future use with the api and for extensions
258 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
259 // for future use with the api, and for use by extensions
260 define( 'CONTENT_FORMAT_JSON', 'application/json' );
261 // for future use with the api, and for use by extensions
262 define( 'CONTENT_FORMAT_XML', 'application/xml' );
263 /**@}*/
264
265 /**@{
266 * Max string length for shell invocations; based on binfmts.h
267 */
268 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
269 /**@}*/
270
271 /**@{
272 * Schema change migration flags.
273 *
274 * Used as values of a feature flag for an orderly transition from an old
275 * schema to a new schema.
276 *
277 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
278 * even exist. This is used from when the patch is merged until the schema
279 * change is actually applied to the database.
280 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
281 * schema preferentially, falling back to the old. This is used while the
282 * change is being tested, allowing easy roll-back to the old schema.
283 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
284 * preferentially, falling back to the old. This is used while running the
285 * maintenance script to migrate existing entries in the old schema to the
286 * new schema.
287 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
288 * feature flag) may now be removed.
289 */
290 define( 'MIGRATION_OLD', 0 );
291 define( 'MIGRATION_WRITE_BOTH', 1 );
292 define( 'MIGRATION_WRITE_NEW', 2 );
293 define( 'MIGRATION_NEW', 3 );
294 /**@}*/