b4140c3024f9e90e774a3170126df67dc3d0f582
[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 /**
34 * The running version of MediaWiki.
35 *
36 * This replaces the the $wgVersion global found in earlier versions.
37 *
38 * @since 1.35
39 */
40 define( 'MW_VERSION', '1.31.6' );
41
42 # Obsolete aliases
43 /**
44 * @deprecated since 1.28
45 */
46 define( 'DB_SLAVE', -1 );
47
48 /**@{
49 * Obsolete IDatabase::makeList() constants
50 * These are also available as Database class constants
51 */
52 define( 'LIST_COMMA', IDatabase::LIST_COMMA );
53 define( 'LIST_AND', IDatabase::LIST_AND );
54 define( 'LIST_SET', IDatabase::LIST_SET );
55 define( 'LIST_NAMES', IDatabase::LIST_NAMES );
56 define( 'LIST_OR', IDatabase::LIST_OR );
57 /**@}*/
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 * @deprecated since 1.14
100 */
101 define( 'NS_IMAGE', NS_FILE );
102 /**
103 * @deprecated since 1.14
104 */
105 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
106 /**@}*/
107
108 /**@{
109 * Cache type
110 */
111 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
112 define( 'CACHE_NONE', 0 ); // Do not cache
113 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
114 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
115 define( 'CACHE_ACCEL', 3 ); // APC or WinCache
116 /**@}*/
117
118 /**@{
119 * Antivirus result codes, for use in $wgAntivirusSetup.
120 */
121 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
122 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
123 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
124 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
125 /**@}*/
126
127 /**@{
128 * Anti-lock flags
129 * Was used by $wgAntiLockFlags, which was removed with 1.25
130 * Constants kept to not have warnings when used in LocalSettings
131 */
132 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
133 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
134 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
135 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
136 /**@}*/
137
138 /**@{
139 * Date format selectors; used in user preference storage and by
140 * Language::date() and co.
141 */
142 define( 'MW_DATE_DEFAULT', 'default' );
143 define( 'MW_DATE_MDY', 'mdy' );
144 define( 'MW_DATE_DMY', 'dmy' );
145 define( 'MW_DATE_YMD', 'ymd' );
146 define( 'MW_DATE_ISO', 'ISO 8601' );
147 /**@}*/
148
149 /**@{
150 * RecentChange type identifiers
151 */
152 define( 'RC_EDIT', 0 );
153 define( 'RC_NEW', 1 );
154 define( 'RC_LOG', 3 );
155 define( 'RC_EXTERNAL', 5 );
156 define( 'RC_CATEGORIZE', 6 );
157 /**@}*/
158
159 /**@{
160 * Article edit flags
161 */
162 define( 'EDIT_NEW', 1 );
163 define( 'EDIT_UPDATE', 2 );
164 define( 'EDIT_MINOR', 4 );
165 define( 'EDIT_SUPPRESS_RC', 8 );
166 define( 'EDIT_FORCE_BOT', 16 );
167 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
168 define( 'EDIT_AUTOSUMMARY', 64 );
169 define( 'EDIT_INTERNAL', 128 );
170 /**@}*/
171
172 /**@{
173 * Hook support constants
174 */
175 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
176 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
177 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
178 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
179 /**@}*/
180
181 /** Support for $wgResourceModules */
182 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
183
184 /**@{
185 * Allowed values for Parser::$mOutputType
186 * Parameter to Parser::startExternalParse().
187 * Use of Parser consts is preferred:
188 * - Parser::OT_HTML
189 * - Parser::OT_WIKI
190 * - Parser::OT_PREPROCESS
191 * - Parser::OT_MSG
192 * - Parser::OT_PLAIN
193 */
194 define( 'OT_HTML', 1 );
195 define( 'OT_WIKI', 2 );
196 define( 'OT_PREPROCESS', 3 );
197 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
198 define( 'OT_PLAIN', 4 );
199 /**@}*/
200
201 /**@{
202 * Flags for Parser::setFunctionHook
203 * Use of Parser consts is preferred:
204 * - Parser::SFH_NO_HASH
205 * - Parser::SFH_OBJECT_ARGS
206 */
207 define( 'SFH_NO_HASH', 1 );
208 define( 'SFH_OBJECT_ARGS', 2 );
209 /**@}*/
210
211 /**@{
212 * Autopromote conditions (must be here and not in Autopromote.php, so that
213 * they're loaded for DefaultSettings.php before AutoLoader.php)
214 */
215 define( 'APCOND_EDITCOUNT', 1 );
216 define( 'APCOND_AGE', 2 );
217 define( 'APCOND_EMAILCONFIRMED', 3 );
218 define( 'APCOND_INGROUPS', 4 );
219 define( 'APCOND_ISIP', 5 );
220 define( 'APCOND_IPINRANGE', 6 );
221 define( 'APCOND_AGE_FROM_EDIT', 7 );
222 define( 'APCOND_BLOCKED', 8 );
223 define( 'APCOND_ISBOT', 9 );
224 /**@}*/
225
226 /** @{
227 * Protocol constants for wfExpandUrl()
228 */
229 define( 'PROTO_HTTP', 'http://' );
230 define( 'PROTO_HTTPS', 'https://' );
231 define( 'PROTO_RELATIVE', '//' );
232 define( 'PROTO_CURRENT', null );
233 define( 'PROTO_CANONICAL', 1 );
234 define( 'PROTO_INTERNAL', 2 );
235 /**@}*/
236
237 /**@{
238 * Content model ids, used by Content and ContentHandler.
239 * These IDs will be exposed in the API and XML dumps.
240 *
241 * Extensions that define their own content model IDs should take
242 * care to avoid conflicts. Using the extension name as a prefix is recommended,
243 * for example 'myextension-somecontent'.
244 */
245 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
246 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
247 define( 'CONTENT_MODEL_CSS', 'css' );
248 define( 'CONTENT_MODEL_TEXT', 'text' );
249 define( 'CONTENT_MODEL_JSON', 'json' );
250 /**@}*/
251
252 /**@{
253 * Content formats, used by Content and ContentHandler.
254 * These should be MIME types, and will be exposed in the API and XML dumps.
255 *
256 * Extensions are free to use the below formats, or define their own.
257 * It is recommended to stick with the conventions for MIME types.
258 */
259 // wikitext
260 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
261 // for js pages
262 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
263 // for css pages
264 define( 'CONTENT_FORMAT_CSS', 'text/css' );
265 // for future use, e.g. with some plain-html messages.
266 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
267 // for future use, e.g. with some plain-html messages.
268 define( 'CONTENT_FORMAT_HTML', 'text/html' );
269 // for future use with the api and for extensions
270 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
271 // for future use with the api, and for use by extensions
272 define( 'CONTENT_FORMAT_JSON', 'application/json' );
273 // for future use with the api, and for use by extensions
274 define( 'CONTENT_FORMAT_XML', 'application/xml' );
275 /**@}*/
276
277 /**@{
278 * Max string length for shell invocations; based on binfmts.h
279 */
280 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
281 /**@}*/
282
283 /**@{
284 * Schema change migration flags.
285 *
286 * Used as values of a feature flag for an orderly transition from an old
287 * schema to a new schema.
288 *
289 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
290 * even exist. This is used from when the patch is merged until the schema
291 * change is actually applied to the database.
292 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
293 * schema preferentially, falling back to the old. This is used while the
294 * change is being tested, allowing easy roll-back to the old schema.
295 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
296 * preferentially, falling back to the old. This is used while running the
297 * maintenance script to migrate existing entries in the old schema to the
298 * new schema.
299 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
300 * feature flag) may now be removed.
301 */
302 define( 'MIGRATION_OLD', 0 );
303 define( 'MIGRATION_WRITE_BOTH', 1 );
304 define( 'MIGRATION_WRITE_NEW', 2 );
305 define( 'MIGRATION_NEW', 3 );
306 /**@}*/