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