Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 122 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
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 | |
26 | use Wikimedia\Rdbms\IDatabase; |
27 | |
28 | /** |
29 | * The running version of MediaWiki. |
30 | * |
31 | * This replaces the $wgVersion global found in earlier versions. When updating, |
32 | * remember to also bump the stand-alone duplicate of this in PHPVersionCheck. |
33 | * |
34 | * @since 1.35 (also backported to 1.33.3 and 1.34.1) |
35 | */ |
36 | define( 'MW_VERSION', '1.43.0-alpha' ); |
37 | |
38 | /** @{ |
39 | * Obsolete IDatabase::makeList() constants |
40 | * These are also available as Database class constants |
41 | */ |
42 | define( 'LIST_COMMA', IDatabase::LIST_COMMA ); |
43 | define( 'LIST_AND', IDatabase::LIST_AND ); |
44 | define( 'LIST_SET', IDatabase::LIST_SET ); |
45 | define( 'LIST_NAMES', IDatabase::LIST_NAMES ); |
46 | define( 'LIST_OR', IDatabase::LIST_OR ); |
47 | /** @} */ |
48 | |
49 | /** @{ |
50 | * Virtual namespaces; don't appear in the page database |
51 | */ |
52 | define( 'NS_MEDIA', -2 ); |
53 | define( 'NS_SPECIAL', -1 ); |
54 | /** @} */ |
55 | |
56 | /** @{ |
57 | * Real namespaces |
58 | * |
59 | * Number 100 and beyond are reserved for custom namespaces; |
60 | * DO NOT assign standard namespaces at 100 or beyond. |
61 | * DO NOT Change integer values as they are most probably hardcoded everywhere |
62 | * see T2696 which talked about that. |
63 | */ |
64 | define( 'NS_MAIN', 0 ); |
65 | define( 'NS_TALK', 1 ); |
66 | define( 'NS_USER', 2 ); |
67 | define( 'NS_USER_TALK', 3 ); |
68 | define( 'NS_PROJECT', 4 ); |
69 | define( 'NS_PROJECT_TALK', 5 ); |
70 | define( 'NS_FILE', 6 ); |
71 | define( 'NS_FILE_TALK', 7 ); |
72 | define( 'NS_MEDIAWIKI', 8 ); |
73 | define( 'NS_MEDIAWIKI_TALK', 9 ); |
74 | define( 'NS_TEMPLATE', 10 ); |
75 | define( 'NS_TEMPLATE_TALK', 11 ); |
76 | define( 'NS_HELP', 12 ); |
77 | define( 'NS_HELP_TALK', 13 ); |
78 | define( 'NS_CATEGORY', 14 ); |
79 | define( 'NS_CATEGORY_TALK', 15 ); |
80 | /** @} */ |
81 | |
82 | /** @{ |
83 | * Cache type |
84 | */ |
85 | define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works |
86 | define( 'CACHE_NONE', 0 ); // Do not cache |
87 | define( 'CACHE_DB', 1 ); // Store cache objects in the DB |
88 | define( 'CACHE_MEMCACHED', 'memcached-php' ); // Backwards-compatability alias for Memcached |
89 | define( 'CACHE_ACCEL', 3 ); // APC or WinCache |
90 | define( 'CACHE_HASH', 'hash' ); // A HashBagOStuff, mostly useful for testing. Not configurable |
91 | /** @} */ |
92 | |
93 | /** @{ |
94 | * Antivirus result codes, for use in $wgAntivirusSetup. |
95 | */ |
96 | define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found |
97 | define( 'AV_VIRUS_FOUND', 1 ); # virus found! |
98 | define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune |
99 | define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner) |
100 | /** @} */ |
101 | |
102 | /** @{ |
103 | * Date format selectors; used in user preference storage and by |
104 | * Language::date() and co. |
105 | */ |
106 | define( 'MW_DATE_DEFAULT', 'default' ); |
107 | define( 'MW_DATE_MDY', 'mdy' ); |
108 | define( 'MW_DATE_DMY', 'dmy' ); |
109 | define( 'MW_DATE_YMD', 'ymd' ); |
110 | define( 'MW_DATE_ISO', 'ISO 8601' ); |
111 | /** @} */ |
112 | |
113 | /** @{ |
114 | * RecentChange type identifiers |
115 | */ |
116 | define( 'RC_EDIT', 0 ); |
117 | define( 'RC_NEW', 1 ); |
118 | define( 'RC_LOG', 3 ); |
119 | define( 'RC_EXTERNAL', 5 ); |
120 | define( 'RC_CATEGORIZE', 6 ); |
121 | /** @} */ |
122 | |
123 | /** @{ |
124 | * Article edit flags |
125 | */ |
126 | define( 'EDIT_NEW', 1 ); |
127 | define( 'EDIT_UPDATE', 2 ); |
128 | define( 'EDIT_MINOR', 4 ); |
129 | define( 'EDIT_SUPPRESS_RC', 8 ); |
130 | define( 'EDIT_FORCE_BOT', 16 ); |
131 | define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27 |
132 | define( 'EDIT_AUTOSUMMARY', 64 ); |
133 | define( 'EDIT_INTERNAL', 128 ); |
134 | /** @} */ |
135 | |
136 | /** @{ |
137 | * Hook support constants |
138 | */ |
139 | define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 ); |
140 | define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 ); |
141 | define( 'MW_SUPPORTS_CONTENTHANDLER', 1 ); |
142 | define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 ); |
143 | /** @} */ |
144 | |
145 | /** Support for $wgResourceModules */ |
146 | define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 ); |
147 | |
148 | /** @{ |
149 | * Allowed values for Parser::$mOutputType |
150 | * Parameter to Parser::startExternalParse(). |
151 | * Use of Parser consts is preferred: |
152 | * - Parser::OT_HTML |
153 | * - Parser::OT_WIKI |
154 | * - Parser::OT_PREPROCESS |
155 | * - Parser::OT_PLAIN |
156 | */ |
157 | define( 'OT_HTML', 1 ); |
158 | define( 'OT_WIKI', 2 ); |
159 | define( 'OT_PREPROCESS', 3 ); |
160 | define( 'OT_PLAIN', 4 ); |
161 | /** @} */ |
162 | |
163 | /** @{ |
164 | * Flags for Parser::setFunctionHook |
165 | * Use of Parser consts is preferred: |
166 | * - Parser::SFH_NO_HASH |
167 | * - Parser::SFH_OBJECT_ARGS |
168 | */ |
169 | define( 'SFH_NO_HASH', 1 ); |
170 | define( 'SFH_OBJECT_ARGS', 2 ); |
171 | /** @} */ |
172 | |
173 | /** @{ |
174 | * Autopromote conditions |
175 | */ |
176 | define( 'APCOND_EDITCOUNT', 1 ); |
177 | define( 'APCOND_AGE', 2 ); |
178 | define( 'APCOND_EMAILCONFIRMED', 3 ); |
179 | define( 'APCOND_INGROUPS', 4 ); |
180 | define( 'APCOND_ISIP', 5 ); |
181 | define( 'APCOND_IPINRANGE', 6 ); |
182 | define( 'APCOND_AGE_FROM_EDIT', 7 ); |
183 | define( 'APCOND_BLOCKED', 8 ); |
184 | define( 'APCOND_ISBOT', 9 ); |
185 | /** @} */ |
186 | |
187 | /** @{ |
188 | * Conditional user defaults conditions |
189 | * |
190 | * Strings are used to make the values easier to use in extension.json |
191 | * @since 1.42 |
192 | */ |
193 | define( 'CUDCOND_AFTER', 'registered-after' ); |
194 | define( 'CUDCOND_ANON', 'anonymous-user' ); |
195 | define( 'CUDCOND_NAMED', 'named-user' ); |
196 | /** @} */ |
197 | |
198 | /** @{ |
199 | * Protocol constants for UrlUtils::expand() |
200 | * PROTO_FALLBACK is @since 1.39 |
201 | */ |
202 | define( 'PROTO_HTTP', 'http://' ); |
203 | define( 'PROTO_HTTPS', 'https://' ); |
204 | define( 'PROTO_RELATIVE', '//' ); |
205 | define( 'PROTO_FALLBACK', null ); |
206 | // Legacy alias for PROTO_FALLBACK from when the current request's protocol was always the fallback |
207 | define( 'PROTO_CURRENT', PROTO_FALLBACK ); |
208 | define( 'PROTO_CANONICAL', 1 ); |
209 | define( 'PROTO_INTERNAL', 2 ); |
210 | /** @} */ |
211 | |
212 | /** @{ |
213 | * Content model ids, used by Content and ContentHandler. |
214 | * These IDs will be exposed in the API and XML dumps. |
215 | * |
216 | * Extensions that define their own content model IDs should take |
217 | * care to avoid conflicts. Using the extension name as a prefix is recommended, |
218 | * for example 'myextension-somecontent'. |
219 | */ |
220 | define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' ); |
221 | define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' ); |
222 | define( 'CONTENT_MODEL_CSS', 'css' ); |
223 | define( 'CONTENT_MODEL_TEXT', 'text' ); |
224 | define( 'CONTENT_MODEL_JSON', 'json' ); |
225 | define( 'CONTENT_MODEL_UNKNOWN', 'unknown' ); |
226 | /** @} */ |
227 | |
228 | /** @{ |
229 | * Content formats, used by Content and ContentHandler. |
230 | * These should be MIME types, and will be exposed in the API and XML dumps. |
231 | * |
232 | * Extensions are free to use the below formats, or define their own. |
233 | * It is recommended to stick with the conventions for MIME types. |
234 | */ |
235 | /** Wikitext */ |
236 | define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' ); |
237 | /** For JS pages */ |
238 | define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' ); |
239 | /** For CSS pages */ |
240 | define( 'CONTENT_FORMAT_CSS', 'text/css' ); |
241 | /** For future use, e.g. with some plain HTML messages. */ |
242 | define( 'CONTENT_FORMAT_TEXT', 'text/plain' ); |
243 | /** For future use, e.g. with some plain HTML messages. */ |
244 | define( 'CONTENT_FORMAT_HTML', 'text/html' ); |
245 | /** For future use with the API and for extensions */ |
246 | define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' ); |
247 | /** For future use with the API, and for use by extensions */ |
248 | define( 'CONTENT_FORMAT_JSON', 'application/json' ); |
249 | /** For future use with the API, and for use by extensions */ |
250 | define( 'CONTENT_FORMAT_XML', 'application/xml' ); |
251 | /** @} */ |
252 | |
253 | /** @{ |
254 | * Max string length for shell invocations; based on binfmts.h |
255 | */ |
256 | define( 'SHELL_MAX_ARG_STRLEN', '100000' ); |
257 | /** @} */ |
258 | |
259 | /** @{ |
260 | * Schema compatibility flags. |
261 | * |
262 | * Used as flags in a bit field that indicates whether the old or new schema (or both) |
263 | * are read or written. |
264 | * |
265 | * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema. |
266 | * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read. |
267 | * - SCHEMA_COMPAT_WRITE_TEMP: Whether information is written to a temporary |
268 | * intermediate schema. |
269 | * - SCHEMA_COMPAT_READ_TEMP: Whether information is read from the temporary |
270 | * intermediate schema. |
271 | * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema |
272 | * - SCHEMA_COMPAT_READ_NEW: Whether information is read from the new schema |
273 | */ |
274 | define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 ); |
275 | define( 'SCHEMA_COMPAT_READ_OLD', 0x02 ); |
276 | define( 'SCHEMA_COMPAT_WRITE_TEMP', 0x10 ); |
277 | define( 'SCHEMA_COMPAT_READ_TEMP', 0x20 ); |
278 | define( 'SCHEMA_COMPAT_WRITE_NEW', 0x100 ); |
279 | define( 'SCHEMA_COMPAT_READ_NEW', 0x200 ); |
280 | define( 'SCHEMA_COMPAT_WRITE_MASK', |
281 | SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_WRITE_NEW ); |
282 | define( 'SCHEMA_COMPAT_READ_MASK', |
283 | SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_TEMP | SCHEMA_COMPAT_READ_NEW ); |
284 | define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW ); |
285 | define( 'SCHEMA_COMPAT_WRITE_OLD_AND_TEMP', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_TEMP ); |
286 | define( 'SCHEMA_COMPAT_WRITE_TEMP_AND_NEW', SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_WRITE_NEW ); |
287 | define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW ); |
288 | define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD ); |
289 | define( 'SCHEMA_COMPAT_TEMP', SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_READ_TEMP ); |
290 | define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW ); |
291 | /** @} */ |
292 | |
293 | /** @{ |
294 | * Schema change migration flags. |
295 | * |
296 | * Used as values of a feature flag for an orderly transition from an old |
297 | * schema to a new schema. The numeric values of these constants are compatible with the |
298 | * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric |
299 | * ordering follows the order in which the migration stages should be used. |
300 | * |
301 | * - MIGRATION_OLD: Only read and write the old schema. The new schema need not |
302 | * even exist. This is used from when the patch is merged until the schema |
303 | * change is actually applied to the database. |
304 | * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new |
305 | * schema preferentially, falling back to the old. This is used while the |
306 | * change is being tested, allowing easy roll-back to the old schema. |
307 | * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema |
308 | * preferentially, falling back to the old. This is used while running the |
309 | * maintenance script to migrate existing entries in the old schema to the |
310 | * new schema. |
311 | * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the |
312 | * feature flag) may now be removed. |
313 | */ |
314 | define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD ); |
315 | define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH ); |
316 | define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW ); |
317 | define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW ); |
318 | /** @} */ |
319 | |
320 | /** @{ |
321 | * XML dump schema versions, for use with XmlDumpWriter. |
322 | * See also the corresponding export-nnnn.xsd files in the docs directory, |
323 | * which are also listed at <https://www.mediawiki.org/xml/>. |
324 | * Note that not all old schema versions are represented here, as several |
325 | * were already unsupported at the time these constants were introduced. |
326 | */ |
327 | define( 'XML_DUMP_SCHEMA_VERSION_10', '0.10' ); |
328 | define( 'XML_DUMP_SCHEMA_VERSION_11', '0.11' ); |
329 | /** @} */ |