23if ( !defined(
'MEDIAWIKI' ) ) {
24 die(
"This file is part of MediaWiki, it is not a valid entry point" );
32use Wikimedia\AtEase\AtEase;
34use Wikimedia\WrappedString;
49 $path =
"$wgExtensionDirectory/$ext/extension.json";
51 ExtensionRegistry::getInstance()->queue(
$path );
69 $registry = ExtensionRegistry::getInstance();
70 foreach ( $exts as
$ext ) {
71 $registry->queue(
"$wgExtensionDirectory/$ext/extension.json" );
86 $path =
"$wgStyleDirectory/$skin/skin.json";
88 ExtensionRegistry::getInstance()->queue(
$path );
100 $registry = ExtensionRegistry::getInstance();
101 foreach ( $skins as $skin ) {
102 $registry->queue(
"$wgStyleDirectory/$skin/skin.json" );
113 return array_udiff( $a, $b,
'wfArrayDiff2_cmp' );
122 if ( is_string( $a ) && is_string( $b ) ) {
123 return strcmp( $a, $b );
124 } elseif ( count( $a ) !== count( $b ) ) {
125 return count( $a ) <=> count( $b );
129 while ( key( $a ) !==
null && key( $b ) !==
null ) {
130 $valueA = current( $a );
131 $valueB = current( $b );
132 $cmp = strcmp( $valueA, $valueB );
153 if ( $changed ===
null ) {
154 throw new MWException(
'GlobalFunctions::wfAppendToArrayIfNotDefault got null' );
156 if ( $default[$key] !== $value ) {
157 $changed[$key] = $value;
182 foreach (
$args as $errors ) {
183 foreach ( $errors as $params ) {
184 $originalParams = $params;
187 $params = array_merge( [ $msg->getKey() ], $msg->getParams() );
189 # @todo FIXME: Sometimes get nested arrays for $params,
190 # which leads to E_NOTICEs
191 $spec = implode(
"\t", $params );
192 $out[$spec] = $originalParams;
195 return array_values( $out );
208 $keys = array_keys( $array );
209 $offsetByKey = array_flip(
$keys );
211 $offset = $offsetByKey[$after];
214 $before = array_slice( $array, 0, $offset + 1,
true );
215 $after = array_slice( $array, $offset + 1, count( $array ) - $offset,
true );
217 $output = $before + $insert + $after;
231 if ( is_object( $objOrArray ) ) {
232 $objOrArray = get_object_vars( $objOrArray );
234 foreach ( $objOrArray as $key => $value ) {
235 if ( $recursive && ( is_object( $value ) || is_array( $value ) ) ) {
239 $array[$key] = $value;
258 $max = mt_getrandmax() + 1;
259 $rand = number_format( ( mt_rand() * $max + mt_rand() ) / $max / $max, 12,
'.',
'' );
275 for ( $n = 0; $n < $length; $n += 7 ) {
276 $str .= sprintf(
'%07x', mt_rand() & 0xfffffff );
278 return substr( $str, 0, $length );
317 if ( $needle ===
null ) {
318 $needle = [
'%3B',
'%40',
'%24',
'%21',
'%2A',
'%28',
'%29',
'%2C',
'%2F',
'%7E' ];
319 if ( !isset( $_SERVER[
'SERVER_SOFTWARE'] ) ||
320 ( strpos( $_SERVER[
'SERVER_SOFTWARE'],
'Microsoft-IIS/7' ) ===
false )
326 $s = urlencode(
$s );
329 [
';',
'@',
'$',
'!',
'*',
'(',
')',
',',
'/',
'~',
':' ],
347 if ( $array2 !==
null ) {
352 foreach ( $array1 as $key => $value ) {
353 if ( $value !==
null && $value !==
false ) {
357 if ( $prefix !==
'' ) {
358 $key = $prefix .
"[$key]";
360 if ( is_array( $value ) ) {
362 foreach ( $value as $k => $v ) {
363 $cgi .= $firstTime ?
'' :
'&';
364 if ( is_array( $v ) ) {
367 $cgi .= urlencode( $key .
"[$k]" ) .
'=' . urlencode( $v );
372 if ( is_object( $value ) ) {
373 $value = $value->__toString();
375 $cgi .= urlencode( $key ) .
'=' . urlencode( $value );
392 if ( isset( $query[0] ) && $query[0] ==
'?' ) {
393 $query = substr( $query, 1 );
395 $bits = explode(
'&', $query );
397 foreach ( $bits as $bit ) {
401 if ( strpos( $bit,
'=' ) ===
false ) {
406 list( $key, $value ) = explode(
'=', $bit );
408 $key = urldecode( $key );
409 $value = urldecode( $value );
410 if ( strpos( $key,
'[' ) !==
false ) {
411 $keys = array_reverse( explode(
'[', $key ) );
412 $key = array_pop(
$keys );
414 foreach (
$keys as $k ) {
415 $k = substr( $k, 0, -1 );
416 $temp = [ $k => $temp ];
418 if ( isset( $ret[$key] ) ) {
419 $ret[$key] = array_merge( $ret[$key], $temp );
439 if ( is_array( $query ) ) {
442 if ( $query !=
'' ) {
445 $hashPos = strpos( $url,
'#' );
446 if ( $hashPos !==
false ) {
447 $fragment = substr( $url, $hashPos );
448 $url = substr( $url, 0, $hashPos );
452 if ( strpos( $url,
'?' ) ===
false ) {
460 if ( $fragment !==
false ) {
501 $defaultProto =
$wgRequest->getProtocol() .
'://';
507 $serverHasProto = $bits && $bits[
'scheme'] !=
'';
510 if ( $serverHasProto ) {
511 $defaultProto = $bits[
'scheme'] .
'://';
520 $defaultProtoWithoutSlashes = $defaultProto !==
null ? substr( $defaultProto, 0, -2 ) :
'';
522 if ( substr( $url, 0, 2 ) ==
'//' ) {
523 $url = $defaultProtoWithoutSlashes . $url;
524 } elseif ( substr( $url, 0, 1 ) ==
'/' ) {
527 if ( $serverHasProto ) {
528 $url = $serverUrl . $url;
533 if ( isset( $bits[
'port'] ) ) {
534 throw new Exception(
'A protocol-relative $wgServer may not contain a port number' );
536 $url = $defaultProtoWithoutSlashes . $serverUrl .
':' .
$wgHttpsPort . $url;
538 $url = $defaultProtoWithoutSlashes . $serverUrl . $url;
545 if ( $bits && isset( $bits[
'path'] ) ) {
551 } elseif ( substr( $url, 0, 1 ) !=
'/' ) {
552 # URL is a relative path
556 # Expanded URL is not valid.
570 return substr( $url, 0, -1 );
589 if ( isset( $urlParts[
'delimiter'] ) ) {
590 if ( isset( $urlParts[
'scheme'] ) ) {
591 $result .= $urlParts[
'scheme'];
594 $result .= $urlParts[
'delimiter'];
597 if ( isset( $urlParts[
'host'] ) ) {
598 if ( isset( $urlParts[
'user'] ) ) {
599 $result .= $urlParts[
'user'];
600 if ( isset( $urlParts[
'pass'] ) ) {
601 $result .=
':' . $urlParts[
'pass'];
606 $result .= $urlParts[
'host'];
608 if ( isset( $urlParts[
'port'] ) ) {
609 $result .=
':' . $urlParts[
'port'];
613 if ( isset( $urlParts[
'path'] ) ) {
614 $result .= $urlParts[
'path'];
617 if ( isset( $urlParts[
'query'] ) && $urlParts[
'query'] !==
'' ) {
618 $result .=
'?' . $urlParts[
'query'];
621 if ( isset( $urlParts[
'fragment'] ) ) {
622 $result .=
'#' . $urlParts[
'fragment'];
643 $inputLength = strlen( $urlPath );
645 while ( $inputOffset < $inputLength ) {
646 $prefixLengthOne = substr( $urlPath, $inputOffset, 1 );
647 $prefixLengthTwo = substr( $urlPath, $inputOffset, 2 );
648 $prefixLengthThree = substr( $urlPath, $inputOffset, 3 );
649 $prefixLengthFour = substr( $urlPath, $inputOffset, 4 );
652 if ( $prefixLengthTwo ==
'./' ) {
653 # Step A, remove leading "./"
655 } elseif ( $prefixLengthThree ==
'../' ) {
656 # Step A, remove leading "../"
658 } elseif ( ( $prefixLengthTwo ==
'/.' ) && ( $inputOffset + 2 == $inputLength ) ) {
659 # Step B, replace leading "/.$" with "/"
661 $urlPath[$inputOffset] =
'/';
662 } elseif ( $prefixLengthThree ==
'/./' ) {
663 # Step B, replace leading "/./" with "/"
665 } elseif ( $prefixLengthThree ==
'/..' && ( $inputOffset + 3 == $inputLength ) ) {
666 # Step C, replace leading "/..$" with "/" and
667 # remove last path component in output
669 $urlPath[$inputOffset] =
'/';
671 } elseif ( $prefixLengthFour ==
'/../' ) {
672 # Step C, replace leading "/../" with "/" and
673 # remove last path component in output
676 } elseif ( ( $prefixLengthOne ==
'.' ) && ( $inputOffset + 1 == $inputLength ) ) {
677 # Step D, remove "^.$"
679 } elseif ( ( $prefixLengthTwo ==
'..' ) && ( $inputOffset + 2 == $inputLength ) ) {
680 # Step D, remove "^..$"
683 # Step E, move leading path segment to output
684 if ( $prefixLengthOne ==
'/' ) {
685 $slashPos = strpos( $urlPath,
'/', $inputOffset + 1 );
687 $slashPos = strpos( $urlPath,
'/', $inputOffset );
689 if ( $slashPos ===
false ) {
690 $output .= substr( $urlPath, $inputOffset );
691 $inputOffset = $inputLength;
693 $output .= substr( $urlPath, $inputOffset, $slashPos - $inputOffset );
694 $inputOffset += $slashPos - $inputOffset;
699 $slashPos = strrpos( $output,
'/' );
700 if ( $slashPos ===
false ) {
703 $output = substr( $output, 0, $slashPos );
722 static $withProtRel =
null, $withoutProtRel =
null;
723 $cachedValue = $includeProtocolRelative ? $withProtRel : $withoutProtRel;
724 if ( $cachedValue !==
null ) {
734 if ( $includeProtocolRelative || $protocol !==
'//' ) {
735 $protocols[] = preg_quote( $protocol,
'/' );
739 $retval = implode(
'|', $protocols );
749 if ( $includeProtocolRelative ) {
750 $withProtRel = $retval;
752 $withoutProtRel = $retval;
798 $wasRelative = substr( $url, 0, 2 ) ==
'//';
799 if ( $wasRelative ) {
802 $bits = parse_url( $url );
805 if ( !$bits || !isset( $bits[
'scheme'] ) ) {
810 $bits[
'scheme'] = strtolower( $bits[
'scheme'] );
814 $bits[
'delimiter'] =
'://';
816 $bits[
'delimiter'] =
':';
819 if ( isset( $bits[
'path'] ) ) {
820 $bits[
'host'] = $bits[
'path'];
828 if ( !isset( $bits[
'host'] ) ) {
832 if ( isset( $bits[
'path'] ) ) {
834 if ( substr( $bits[
'path'], 0, 1 ) !==
'/' ) {
835 $bits[
'path'] =
'/' . $bits[
'path'];
843 if ( $wasRelative ) {
844 $bits[
'scheme'] =
'';
845 $bits[
'delimiter'] =
'//';
861 return preg_replace_callback(
862 '/((?:%[89A-F][0-9A-F])+)/i',
878 if ( is_array( $bits ) && isset( $bits[
'host'] ) ) {
879 $host =
'.' . $bits[
'host'];
880 foreach ( (array)$domains as $domain ) {
881 $domain =
'.' . $domain;
882 if ( substr( $host, -strlen( $domain ) ) === $domain ) {
910function wfDebug( $text, $dest =
'all', array $context = [] ) {
917 $text = trim( $text );
922 $context[
'private'] = ( $dest ===
false || $dest ===
'private' );
924 $logger = LoggerFactory::getInstance(
'wfDebug' );
925 $logger->debug( $text, $context );
939 if ( ( isset( $_GET[
'action'] ) && $_GET[
'action'] ==
'raw' )
955 $mem = memory_get_usage();
957 $mem = floor( $mem / 1024 ) .
' KiB';
961 wfDebug(
"Memory usage: $mem" );
990 $logGroup, $text, $dest =
'all', array $context = []
992 $text = trim( $text );
994 $logger = LoggerFactory::getInstance( $logGroup );
995 $context[
'private'] = ( $dest ===
false || $dest ===
'private' );
996 $logger->info( $text, $context );
1008 $logger = LoggerFactory::getInstance(
'wfLogDBError' );
1009 $logger->error( trim( $text ), $context );
1027function wfDeprecated( $function, $version =
false, $component =
false, $callerOffset = 2 ) {
1028 if ( is_string( $version ) || $version ===
false ) {
1029 MWDebug::deprecated( $function, $version, $component, $callerOffset + 1 );
1031 throw new Exception(
1032 "MediaWiki version must either be a string or false. " .
1033 "Example valid version: '1.33'"
1059function wfDeprecatedMsg( $msg, $version =
false, $component =
false, $callerOffset = 2 ) {
1060 MWDebug::deprecatedMsg( $msg, $version, $component,
1061 $callerOffset ===
false ?
false : $callerOffset + 1 );
1074function wfWarn( $msg, $callerOffset = 1, $level = E_USER_NOTICE ) {
1075 MWDebug::warning( $msg, $callerOffset + 1, $level,
'auto' );
1088 MWDebug::warning( $msg, $callerOffset + 1, $level,
'production' );
1096 $context = RequestContext::getMain();
1098 $profiler = Profiler::instance();
1099 $profiler->setContext( $context );
1100 $profiler->logData();
1103 MediaWiki::emitBufferedStatsdData(
1104 MediaWikiServices::getInstance()->getStatsdDataFactory(),
1105 $context->getConfig()
1117 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1118 $stats->updateCount( $key, $count );
1127 return MediaWikiServices::getInstance()->getReadOnlyMode()
1140 return MediaWikiServices::getInstance()->getReadOnlyMode()
1151 return MediaWikiServices::getInstance()->getConfiguredReadOnlyMode()
1171 # Identify which language to get or create a language object for.
1172 # Using is_object here due to Stub objects.
1173 if ( is_object( $langcode ) ) {
1174 # Great, we already have the object (hopefully)!
1179 $services = MediaWikiServices::getInstance();
1181 # $langcode is the language code of the wikis content language object.
1182 # or it is a boolean and value is true
1183 return $services->getContentLanguage();
1187 if ( $langcode ===
false || $langcode ===
$wgLang->getCode() ) {
1188 # $langcode is the language code of user language object.
1189 # or it was a boolean and value is false
1193 $validCodes = array_keys( $services->getLanguageNameUtils()->getLanguageNames() );
1194 if ( in_array( $langcode, $validCodes ) ) {
1195 # $langcode corresponds to a valid language.
1196 return $services->getLanguageFactory()->getLanguage( $langcode );
1199 # $langcode is a string, but not a valid language code; use content language.
1200 wfDebug(
"Invalid language code passed to wfGetLangObj, falling back to content language." );
1201 return $services->getContentLanguage();
1221 $message =
new Message( $key );
1225 $message->params( ...$params );
1256 # Fix windows line-endings
1257 # Some messages are split with explode("\n", $msg)
1258 $message = str_replace(
"\r",
'', $message );
1262 if ( is_array(
$args[0] ) ) {
1265 $replacementKeys = [];
1266 foreach (
$args as $n => $param ) {
1267 $replacementKeys[
'$' . ( $n + 1 )] = $param;
1269 $message = strtr( $message, $replacementKeys );
1290 return php_uname(
'n' ) ?:
'unknown';
1306 $elapsed = ( microtime(
true ) - $_SERVER[
'REQUEST_TIME_FLOAT'] );
1308 $responseTime = round( $elapsed * 1000 );
1309 $reportVars = [
'wgBackendResponseTime' => $responseTime ];
1313 return Skin::makeVariablesScript( $reportVars, $nonce );
1327 static $disabled =
null;
1329 if ( $disabled ===
null ) {
1330 $disabled = !function_exists(
'debug_backtrace' );
1332 wfDebug(
"debug_backtrace() is disabled" );
1340 return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit + 1 ), 1 );
1342 return array_slice( debug_backtrace(), 1 );
1357 if ( $raw ===
null ) {
1362 $frameFormat =
"%s line %s calls %s()\n";
1363 $traceFormat =
"%s";
1365 $frameFormat =
"<li>%s line %s calls %s()</li>\n";
1366 $traceFormat =
"<ul>\n%s</ul>\n";
1369 $frames = array_map(
function ( $frame ) use ( $frameFormat ) {
1370 $file = !empty( $frame[
'file'] ) ? basename( $frame[
'file'] ) :
'-';
1371 $line = $frame[
'line'] ??
'-';
1372 $call = $frame[
'function'];
1373 if ( !empty( $frame[
'class'] ) ) {
1374 $call = $frame[
'class'] . $frame[
'type'] . $call;
1376 return sprintf( $frameFormat,
$file,
$line, $call );
1379 return sprintf( $traceFormat, implode(
'', $frames ) );
1393 if ( isset( $backtrace[$level] ) ) {
1409 if ( !$limit || $limit > count( $trace ) - 1 ) {
1410 $limit = count( $trace ) - 1;
1412 $trace = array_slice( $trace, -$limit - 1, $limit );
1413 return implode(
'/', array_map(
'wfFormatStackFrame', $trace ) );
1423 if ( !isset( $frame[
'function'] ) ) {
1424 return 'NO_FUNCTION_GIVEN';
1426 return isset( $frame[
'class'] ) && isset( $frame[
'type'] ) ?
1427 $frame[
'class'] . $frame[
'type'] . $frame[
'function'] :
1441 return wfMessage(
'showingresults' )->numParams( $limit, $offset + 1 )->parse();
1454 static $result =
null;
1455 if ( $result ===
null || $force ) {
1457 if ( isset( $_SERVER[
'HTTP_ACCEPT_ENCODING'] ) ) {
1458 # @todo FIXME: We may want to blacklist some broken browsers
1461 '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
1462 $_SERVER[
'HTTP_ACCEPT_ENCODING'],
1466 if ( isset( $m[2] ) && ( $m[1] ==
'q' ) && ( $m[2] == 0 ) ) {
1470 wfDebug(
"wfClientAcceptsGzip: client accepts gzip." );
1490 static $repl =
null, $repl2 =
null;
1491 if ( $repl ===
null || defined(
'MW_PARSER_TEST' ) || defined(
'MW_PHPUNIT_TEST' ) ) {
1495 '"' =>
'"',
'&' =>
'&',
"'" =>
''',
'<' =>
'<',
1496 '=' =>
'=',
'>' =>
'>',
'[' =>
'[',
']' =>
']',
1497 '{' =>
'{',
'|' =>
'|',
'}' =>
'}',
';' =>
';',
1498 "\n#" =>
"\n#",
"\r#" =>
"\r#",
1499 "\n*" =>
"\n*",
"\r*" =>
"\r*",
1500 "\n:" =>
"\n:",
"\r:" =>
"\r:",
1501 "\n " =>
"\n ",
"\r " =>
"\r ",
1502 "\n\n" =>
"\n ",
"\r\n" =>
" \n",
1503 "\n\r" =>
"\n ",
"\r\r" =>
"\r ",
1504 "\n\t" =>
"\n	",
"\r\t" =>
"\r	",
1505 "\n----" =>
"\n----",
"\r----" =>
"\r----",
1506 '__' =>
'__',
'://' =>
'://',
1511 foreach ( $magicLinks as $magic ) {
1512 $repl[
"$magic "] =
"$magic ";
1513 $repl[
"$magic\t"] =
"$magic	";
1514 $repl[
"$magic\r"] =
"$magic ";
1515 $repl[
"$magic\n"] =
"$magic ";
1516 $repl[
"$magic\f"] =
"$magic";
1523 if ( substr( $prot, -1 ) ===
':' ) {
1524 $repl2[] = preg_quote( substr( $prot, 0, -1 ),
'/' );
1527 $repl2 = $repl2 ?
'/\b(' . implode(
'|', $repl2 ) .
'):/i' :
'/^(?!)/';
1529 $text = substr( strtr(
"\n$text", $repl ), 1 );
1530 $text = preg_replace( $repl2,
'$1:', $text );
1546 if (
$source !==
null || $force ) {
1562 $temp = (bool)( $dest & $bit );
1563 if ( $state !==
null ) {
1581 $s = str_replace(
"\n",
"<br />\n", var_export( $var,
true ) .
"\n" );
1582 if ( headers_sent() || !isset(
$wgOut ) || !is_object(
$wgOut ) ) {
1598 HttpStatus::header( $code );
1601 $wgOut->sendCacheControl();
1604 MediaWiki\HeaderCallback::warnIfHeadersSent();
1605 header(
'Content-type: text/html; charset=utf-8' );
1607 print '<!DOCTYPE html>' .
1608 '<html><head><title>' .
1609 htmlspecialchars( $label ) .
1610 '</title></head><body><h1>' .
1611 htmlspecialchars( $label ) .
1613 nl2br( htmlspecialchars( $desc ) ) .
1614 "</p></body></html>\n";
1615 header(
'Content-Length: ' . ob_get_length() );
1637 while ( $status = ob_get_status() ) {
1638 if ( isset( $status[
'flags'] ) ) {
1639 $flags = PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_REMOVABLE;
1640 $deleteable = ( $status[
'flags'] & $flags ) === $flags;
1641 } elseif ( isset( $status[
'del'] ) ) {
1642 $deleteable = $status[
'del'];
1645 $deleteable = $status[
'type'] !== 0;
1647 if ( !$deleteable ) {
1652 if ( $status[
'name'] ===
'MediaWikiIntegrationTestCase::wfResetOutputBuffersBarrier' ) {
1656 if ( !ob_end_clean() ) {
1661 if ( $resetGzipEncoding && $status[
'name'] ==
'ob_gzhandler' ) {
1664 header_remove(
'Content-Encoding' );
1695 # No arg means accept anything (per HTTP spec)
1697 return [ $def => 1.0 ];
1702 $parts = explode(
',', $accept );
1704 foreach ( $parts as $part ) {
1705 # @todo FIXME: Doesn't deal with params like 'text/html; level=1'
1706 $values = explode(
';', trim( $part ) );
1708 if ( count( $values ) == 1 ) {
1709 $prefs[$values[0]] = 1.0;
1710 } elseif ( preg_match(
'/q\s*=\s*(\d*\.\d+)/', $values[1], $match ) ) {
1711 $prefs[$values[0]] = floatval( $match[1] );
1731 if ( array_key_exists(
$type, $avail ) ) {
1734 $mainType = explode(
'/',
$type )[0];
1735 if ( array_key_exists(
"$mainType/*", $avail ) ) {
1736 return "$mainType/*";
1737 } elseif ( array_key_exists(
'*/*', $avail ) ) {
1762 foreach ( array_keys( $sprefs ) as
$type ) {
1763 $subType = explode(
'/',
$type )[1];
1764 if ( $subType !=
'*' ) {
1767 $combine[
$type] = $sprefs[
$type] * $cprefs[$ckey];
1772 foreach ( array_keys( $cprefs ) as
$type ) {
1773 $subType = explode(
'/',
$type )[1];
1774 if ( $subType !=
'*' && !array_key_exists(
$type, $sprefs ) ) {
1777 $combine[
$type] = $sprefs[$skey] * $cprefs[
$type];
1785 foreach ( array_keys( $combine ) as
$type ) {
1786 if ( $combine[
$type] > $bestq ) {
1788 $bestq = $combine[
$type];
1804 $ret = MWTimestamp::convert( $outputtype, $ts );
1805 if ( $ret ===
false ) {
1806 wfDebug(
"wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts" );
1820 if ( $ts ===
null ) {
1833 return MWTimestamp::now( TS_MW );
1842 return PHP_OS_FAMILY ===
'Windows';
1852 return PHP_SAPI ===
'cli' || PHP_SAPI ===
'phpdbg';
1873 return TempFSFile::getUsableTempDirectory();
1889 throw new MWException( __FUNCTION__ .
" given storage path '$dir'." );
1892 if ( $caller !==
null ) {
1893 wfDebug(
"$caller: called wfMkdirParents($dir)" );
1896 if ( strval( $dir ) ===
'' || is_dir( $dir ) ) {
1900 $dir = str_replace( [
'\\',
'/' ], DIRECTORY_SEPARATOR, $dir );
1902 if ( $mode ===
null ) {
1907 AtEase::suppressWarnings();
1908 $ok = mkdir( $dir, $mode,
true );
1909 AtEase::restoreWarnings();
1913 if ( is_dir( $dir ) ) {
1918 wfLogWarning( sprintf(
"failed to mkdir \"%s\" mode 0%o", $dir, $mode ) );
1929 wfDebug( __FUNCTION__ .
"( $dir )" );
1931 if ( is_dir( $dir ) ) {
1932 $objects = scandir( $dir );
1933 foreach ( $objects as $object ) {
1934 if ( $object !=
"." && $object !=
".." ) {
1935 if ( filetype( $dir .
'/' . $object ) ==
"dir" ) {
1938 unlink( $dir .
'/' . $object );
1953function wfPercent( $nr,
int $acc = 2,
bool $round =
true ) {
1954 $accForFormat = $acc >= 0 ? $acc : 0;
1955 $ret = sprintf(
"%.{$accForFormat}f", $nr );
1956 return $round ? round( (
float)$ret, $acc ) .
'%' :
"$ret%";
1999 $val = strtolower( $val );
2004 || preg_match(
"/^\s*[+-]?0*[1-9]/", $val );
2020 return Shell::escape( ...
$args );
2048 $limits = [], $options = []
2050 if ( Shell::isDisabled() ) {
2053 return 'Unable to run external programs, proc_open() is disabled.';
2056 if ( is_array( $cmd ) ) {
2057 $cmd = Shell::escape( $cmd );
2060 $includeStderr = isset( $options[
'duplicateStderr'] ) && $options[
'duplicateStderr'];
2061 $profileMethod = $options[
'profileMethod'] ??
wfGetCaller();
2064 $result = Shell::command( [] )
2065 ->unsafeParams( (array)$cmd )
2066 ->environment( $environ )
2068 ->includeStderr( $includeStderr )
2069 ->profileMethod( $profileMethod )
2071 ->restrict( Shell::RESTRICT_NONE )
2078 $retval = $result->getExitCode();
2080 return $result->getStdout();
2101 return wfShellExec( $cmd, $retval, $environ, $limits,
2102 [
'duplicateStderr' =>
true,
'profileMethod' =>
wfGetCaller() ] );
2124 Hooks::runner()->onWfShellWikiCmd( $script, $parameters, $options );
2125 $cmd = [ $options[
'php'] ??
$wgPhpCli ];
2126 if ( isset( $options[
'wrapper'] ) ) {
2127 $cmd[] = $options[
'wrapper'];
2131 return Shell::escape( array_merge( $cmd, $parameters ) );
2145function wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult =
null ) {
2148 # This check may also protect against code injection in
2149 # case of broken installations.
2150 AtEase::suppressWarnings();
2152 AtEase::restoreWarnings();
2154 if ( !$haveDiff3 ) {
2159 # Make temporary files
2161 $oldtextFile = fopen( $oldtextName = tempnam( $td,
'merge-old-' ),
'w' );
2162 $mytextFile = fopen( $mytextName = tempnam( $td,
'merge-mine-' ),
'w' );
2163 $yourtextFile = fopen( $yourtextName = tempnam( $td,
'merge-your-' ),
'w' );
2165 # NOTE: diff3 issues a warning to stderr if any of the files does not end with
2166 # a newline character. To avoid this, we normalize the trailing whitespace before
2167 # creating the diff.
2169 fwrite( $oldtextFile, rtrim( $old ) .
"\n" );
2170 fclose( $oldtextFile );
2171 fwrite( $mytextFile, rtrim( $mine ) .
"\n" );
2172 fclose( $mytextFile );
2173 fwrite( $yourtextFile, rtrim( $yours ) .
"\n" );
2174 fclose( $yourtextFile );
2176 # Check for a conflict
2177 $cmd = Shell::escape(
$wgDiff3,
'-a',
'--overlap-only', $mytextName,
2178 $oldtextName, $yourtextName );
2179 $handle = popen( $cmd,
'r' );
2181 $mergeAttemptResult =
'';
2183 $data = fread( $handle, 8192 );
2184 if ( strlen( $data ) == 0 ) {
2187 $mergeAttemptResult .= $data;
2191 $conflict = $mergeAttemptResult !==
'';
2194 $cmd = Shell::escape(
$wgDiff3,
'-a',
'-e',
'--merge', $mytextName,
2195 $oldtextName, $yourtextName );
2196 $handle = popen( $cmd,
'r' );
2199 $data = fread( $handle, 8192 );
2200 if ( strlen( $data ) == 0 ) {
2206 unlink( $mytextName );
2207 unlink( $oldtextName );
2208 unlink( $yourtextName );
2210 if ( $result ===
'' && $old !==
'' && !$conflict ) {
2211 wfDebug(
"Unexpected null result from diff3. Command: $cmd" );
2228function wfDiff( $before, $after, $params =
'-u' ) {
2229 if ( $before == $after ) {
2234 AtEase::suppressWarnings();
2236 AtEase::restoreWarnings();
2238 # This check may also protect against code injection in
2239 # case of broken installations.
2241 wfDebug(
"diff executable not found" );
2242 $diffs =
new Diff( explode(
"\n", $before ), explode(
"\n", $after ) );
2244 return $format->format( $diffs );
2247 # Make temporary files
2249 $oldtextFile = fopen( $oldtextName = tempnam( $td,
'merge-old-' ),
'w' );
2250 $newtextFile = fopen( $newtextName = tempnam( $td,
'merge-your-' ),
'w' );
2252 fwrite( $oldtextFile, $before );
2253 fclose( $oldtextFile );
2254 fwrite( $newtextFile, $after );
2255 fclose( $newtextFile );
2258 $cmd =
"$wgDiff " . $params .
' ' . Shell::escape( $oldtextName, $newtextName );
2260 $h = popen( $cmd,
'r' );
2262 unlink( $oldtextName );
2263 unlink( $newtextName );
2264 throw new Exception( __FUNCTION__ .
'(): popen() failed' );
2270 $data = fread( $h, 8192 );
2271 if ( strlen( $data ) == 0 ) {
2279 unlink( $oldtextName );
2280 unlink( $newtextName );
2283 $diff_lines = explode(
"\n", $diff );
2284 if ( isset( $diff_lines[0] ) && strpos( $diff_lines[0],
'---' ) === 0 ) {
2285 unset( $diff_lines[0] );
2287 if ( isset( $diff_lines[1] ) && strpos( $diff_lines[1],
'+++' ) === 0 ) {
2288 unset( $diff_lines[1] );
2291 $diff = implode(
"\n", $diff_lines );
2309 if ( $suffix ==
'' ) {
2312 $encSuffix =
'(?:' . preg_quote( $suffix,
'#' ) .
')?';
2316 if ( preg_match(
"#([^/\\\\]*?){$encSuffix}[/\\\\]*$#",
$path,
$matches ) ) {
2334 $path = str_replace(
'/', DIRECTORY_SEPARATOR,
$path );
2335 $from = str_replace(
'/', DIRECTORY_SEPARATOR, $from );
2339 $from = rtrim( $from, DIRECTORY_SEPARATOR );
2341 $pieces = explode( DIRECTORY_SEPARATOR, dirname(
$path ) );
2342 $against = explode( DIRECTORY_SEPARATOR, $from );
2344 if ( $pieces[0] !== $against[0] ) {
2351 while ( count( $pieces ) && count( $against )
2352 && $pieces[0] == $against[0] ) {
2353 array_shift( $pieces );
2354 array_shift( $against );
2358 while ( count( $against ) ) {
2359 array_unshift( $pieces,
'..' );
2360 array_shift( $against );
2365 return implode( DIRECTORY_SEPARATOR, $pieces );
2377 $file =
"$IP/serialized/$name";
2378 if ( file_exists(
$file ) ) {
2395 return ObjectCache::getLocalClusterInstance()->makeKey( ...
$args );
2410 $keyspace = $prefix ?
"$db-$prefix" : $db;
2411 return ObjectCache::getLocalClusterInstance()->makeKeyInternal( $keyspace,
$args );
2425 return "$wgDBname-$wgDBprefix";
2462function wfGetDB( $db, $groups = [], $wiki =
false ) {
2463 return wfGetLB( $wiki )->getMaintenanceConnectionRef( $db, $groups, $wiki );
2476 if ( $wiki ===
false ) {
2477 return MediaWikiServices::getInstance()->getDBLoadBalancer();
2479 $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
2480 return $factory->getMainLB( $wiki );
2492 return MediaWikiServices::getInstance()->getRepoGroup()->findFile(
$title, $options );
2504 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile(
$title );
2531 if ( $script ===
'index' ) {
2533 } elseif ( $script ===
'load' ) {
2536 return "{$wgScriptPath}/{$script}.php";
2548 if ( isset( $_SERVER[
'SCRIPT_NAME'] ) ) {
2559 return $_SERVER[
'SCRIPT_NAME'];
2561 return $_SERVER[
'URL'];
2573 return $value ?
'true' :
'false';
2608 $ifWritesSince =
null, $wiki =
false, $cluster =
false, $timeout =
null
2611 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
2613 if ( $cluster ===
'*' ) {
2616 } elseif ( $wiki ===
false ) {
2617 $domain = $lbFactory->getLocalDomainID();
2623 'domain' => $domain,
2624 'cluster' => $cluster,
2626 'ifWritesSince' => ( $ifWritesSince > 1e9 ) ? $ifWritesSince : null
2628 if ( $timeout !==
null ) {
2629 $opts[
'timeout'] = $timeout;
2632 return $lbFactory->waitForReplication( $opts );
2646 $name = preg_replace(
2647 "/[^" . Title::legalChars() .
"]" . $illegalFileChars .
"/",
2665 if ( $oldLimit != -1 ) {
2667 if ( $newLimit == -1 ) {
2668 wfDebug(
"Removing PHP's memory limit" );
2669 Wikimedia\suppressWarnings();
2670 ini_set(
'memory_limit', $newLimit );
2671 Wikimedia\restoreWarnings();
2672 } elseif ( $newLimit > $oldLimit ) {
2673 wfDebug(
"Raising PHP's memory limit to $newLimit bytes" );
2674 Wikimedia\suppressWarnings();
2675 ini_set(
'memory_limit', $newLimit );
2676 Wikimedia\restoreWarnings();
2690 $timeLimit = (int)ini_get(
'max_execution_time' );
2696 ignore_user_abort(
true );
2709 $string = trim( $string ??
'' );
2710 if ( $string ===
'' ) {
2713 $last = $string[strlen( $string ) - 1];
2714 $val = intval( $string );
2740 return ObjectCache::getInstance( $cacheType );
2750 return ObjectCache::getLocalClusterInstance();
2768 if ( $length !==
false ) {
2769 $realLen = strlen( $data );
2770 if ( $realLen < $length ) {
2771 throw new MWException(
"Tried to use wfUnpack on a "
2772 .
"string of length $realLen, but needed one "
2773 .
"of at least length $length."
2778 Wikimedia\suppressWarnings();
2779 $result = unpack( $format, $data );
2780 Wikimedia\restoreWarnings();
2782 if ( $result ===
false ) {
2784 throw new MWException(
"unpack could not unpack binary data" );
2806 $services = MediaWikiServices::getInstance();
2807 return $services->getBadFileLookup()->isBadFile( $name, $contextTitle ?: null );
2819 Hooks::runner()->onCanIPUseHTTPS( $ip, $canDo );
2820 return (
bool)$canDo;
2832 return in_array( $str, ExpiryDef::INFINITY_VALS );
2852 $multipliers = [ 1 ];
2856 $multipliers[] = 1.5;
2860 $handler =
$file->getHandler();
2861 if ( !$handler || !isset( $params[
'width'] ) ) {
2866 if ( isset( $params[
'page'] ) ) {
2867 $basicParams[
'page'] = $params[
'page'];
2873 foreach ( $multipliers as $multiplier ) {
2874 $thumbLimits = array_merge( $thumbLimits, array_map(
2875 function ( $width ) use ( $multiplier ) {
2876 return round( $width * $multiplier );
2879 $imageLimits = array_merge( $imageLimits, array_map(
2880 function ( $pair ) use ( $multiplier ) {
2882 round( $pair[0] * $multiplier ),
2883 round( $pair[1] * $multiplier ),
2890 if ( in_array( $params[
'width'], $thumbLimits ) ) {
2891 $normalParams = $basicParams + [
'width' => $params[
'width'] ];
2893 $handler->normaliseParams(
$file, $normalParams );
2897 foreach ( $imageLimits as $pair ) {
2898 $normalParams = $basicParams + [
'width' => $pair[0],
'height' => $pair[1] ];
2901 $handler->normaliseParams(
$file, $normalParams );
2903 if ( $normalParams[
'width'] == $params[
'width'] ) {
2914 foreach ( $params as $key => $value ) {
2915 if ( !isset( $normalParams[$key] ) || $normalParams[$key] != $value ) {
2937 foreach ( $baseArray as $name => &$groupVal ) {
2938 if ( isset( $newValues[$name] ) ) {
2939 $groupVal += $newValues[$name];
2943 $baseArray += $newValues;
2959 return getrusage( 0 );
unserialize( $serialized)
$wgLanguageCode
Site language code.
$wgDBprefix
Current wiki database table name prefix.
$wgScript
The URL path to index.php.
$wgInternalServer
Internal server name as known to CDN, if different.
$wgThumbLimits
Adjust thumbnails on image pages according to a user setting.
$wgDebugLogPrefix
Prefix for debug log lines.
$wgPhpCli
Executable path of the PHP cli binary.
$wgOverrideHostname
Override server hostname detection with a hardcoded value.
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
$wgShowHostnames
Expose backend server host names through the API and various HTML comments.
$wgTmpDirectory
The local filesystem path to a temporary directory.
$wgStyleDirectory
Filesystem stylesheets directory.
$wgTransactionalTimeLimit
The minimum amount of time that MediaWiki needs for "slow" write request, particularly ones with mult...
$wgDBname
Current wiki database name.
$wgIllegalFileChars
Additional characters that are not allowed in filenames.
$wgDirectoryMode
Default value for chmoding of new directories.
$wgDiff3
Path to the GNU diff3 utility.
$wgUrlProtocols
URL schemes that should be recognized as valid by wfParseUrl().
$wgResponsiveImages
Generate and use thumbnails suitable for screens with 1.5 and 2.0 pixel densities.
$wgDebugRawPage
If true, log debugging data from action=raw and load.php.
$wgEnableMagicLinks
Enable the magic links feature of automatically turning ISBN xxx, PMID xxx, RFC xxx into links.
$wgScriptPath
The path we should point to.
$wgExtensionDirectory
Filesystem extensions directory.
$wgLoadScript
The URL path to load.php.
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
$wgMiserMode
Disable database-intensive features.
$wgServer
URL of the server.
$wgHttpsPort
For installations where the canonical server is HTTP but HTTPS is optionally supported,...
$wgDiff
Path to the GNU diff utility.
global $wgCommandLineMode
wfGetLangObj( $langcode=false)
Return a Language object from $langcode.
wfThumbIsStandard(File $file, array $params)
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pa...
wfConfiguredReadOnlyReason()
Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.
wfVarDump( $var)
A wrapper around the PHP function var_export().
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfNegotiateType( $cprefs, $sprefs)
Returns the 'best' match between a client's requested internet media types and the server's list of a...
wfRandom()
Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for ...
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfTempDir()
Tries to get the system directory for temporary files.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
wfBaseName( $path, $suffix='')
Return the final portion of a pathname.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfClientAcceptsGzip( $force=false)
Whether the client accept gzip encoding.
wfEscapeShellArg(... $args)
Version of escapeshellarg() that works better on Windows.
wfIncrStats( $key, $count=1)
Increment a statistics counter.
wfLogDBError( $text, array $context=[])
Log for database errors.
wfLoadSkins(array $skins)
Load multiple skins at once.
wfGetRusage()
Get system resource usage of current request context.
wfGetLB( $wiki=false)
Get a load balancer object.
wfUrlProtocolsWithoutProtRel()
Like wfUrlProtocols(), but excludes '//' from the protocol list.
wfRecursiveRemoveDir( $dir)
Remove a directory and all its content.
wfLoadExtension( $ext, $path=null)
Load an extension.
wfMemoryLimit( $newLimit)
Raise PHP's memory limit (if needed).
wfReadOnly()
Check whether the wiki is in read-only mode.
wfSetBit(&$dest, $bit, $state=true)
As for wfSetVar except setting a bit.
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfShorthandToInteger(?string $string='', int $default=-1)
Converts shorthand byte notation to integer form.
wfBacktrace( $raw=null)
Get a debug backtrace as a string.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfExpandIRI( $url)
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode cha...
wfMergeErrorArrays(... $args)
Merge arrays in the style of PermissionManager::getPermissionErrors, with duplicate removal e....
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
wfIsDebugRawPage()
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
wfHostname()
Get host name of the current machine, for use in error reporting.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfGetMainCache()
Get the main cache object.
wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult=null)
wfMerge attempts to merge differences between three texts.
wfShellWikiCmd( $script, array $parameters=[], array $options=[])
Generate a shell-escaped command line string to run a MediaWiki cli script.
wfGetPrecompiledData( $name)
Get an object from the precompiled serialized directory.
wfPercent( $nr, int $acc=2, bool $round=true)
wfFindFile( $title, $options=[])
Find a file.
wfReportTime( $nonce=null)
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in millis...
wfSetVar(&$dest, $source, $force=false)
Sets dest to source and returns the original value of dest If source is NULL, it just returns the val...
wfArrayDiff2( $a, $b)
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
wfShellExecWithStderr( $cmd, &$retval=null, $environ=[], $limits=[])
Execute a shell command, returning both stdout and stderr.
wfCanIPUseHTTPS( $ip)
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS.
wfGetNull()
Get a platform-independent path to the null file, e.g.
wfAcceptToPrefs( $accept, $def=' */*')
Converts an Accept-* header into an array mapping string values to quality factors.
wfDiff( $before, $after, $params='-u')
Returns unified plain-text diff of two texts.
wfRelativePath( $path, $from)
Generate a relative path name to the given file.
wfHttpError( $code, $label, $desc)
Provide a simple HTTP error.
wfUrlProtocols( $includeProtocolRelative=true)
Returns a regular expression of url protocols.
wfUnpack( $format, $data, $length=false)
Wrapper around php's unpack.
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
wfShowingResults( $offset, $limit)
wfGetAllCallers( $limit=3)
Return a string consisting of callers in the stack.
wfRemoveDotSegments( $urlPath)
Remove all dot-segments in the provided URL path.
wfArrayPlus2d(array $baseArray, array $newValues)
Merges two (possibly) 2 dimensional arrays into the target array ($baseArray).
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfTransactionalTimeLimit()
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfIsBadImage( $name, $contextTitle=false)
Determine if an image exists on the 'bad image list'.
wfObjectToArray( $objOrArray, $recursive=true)
Recursively converts the parameter (an object) to an array with the same data.
wfGetScriptUrl()
Get the script URL.
wfClearOutputBuffers()
More legible than passing a 'false' parameter to wfResetOutputBuffers():
wfDebugMem( $exact=false)
Send a line giving PHP memory usage.
wfLoadSkin( $skin, $path=null)
Load a skin.
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
wfGetServerUrl( $proto)
Get the wiki's "server", i.e.
wfStringToBool( $val)
Convert string value to boolean, when the following are interpreted as true:
wfGetCache( $cacheType)
Get a specific cache object.
wfMemcKey(... $args)
Make a cache key for the local wiki.
wfDebugBacktrace( $limit=0)
Safety wrapper for debug_backtrace().
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfStripIllegalFilenameChars( $name)
Replace all invalid characters with '-'.
wfFormatStackFrame( $frame)
Return a string representation of frame.
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfArrayDiff2_cmp( $a, $b)
wfIsWindows()
Check if the operating system is Windows.
wfMatchesDomainList( $url, $domains)
Check whether a given URL has a domain that occurs in a given set of domains.
wfForeignMemcKey( $db, $prefix,... $args)
Make a cache key for a foreign DB.
wfIsInfinity( $str)
Determine input string is represents as infinity.
wfQueriesMustScale()
Should low-performance queries be disabled?
mimeTypeMatch( $type, $avail)
Checks if a given MIME type matches any of the keys in the given array.
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed)
Appends to second array if $value differs from that in $default.
wfLoadExtensions(array $exts)
Load multiple extensions at once.
wfBoolToStr( $value)
Convenience function converts boolean values into "true" or "false" (string) values.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
wfArrayInsertAfter(array $array, array $insert, $after)
Insert array into another array after the specified KEY
wfAssembleUrl( $urlParts)
This function will reassemble a URL parsed with wfParseURL.
wfResetOutputBuffers( $resetGzipEncoding=true)
Clear away any user-level output buffers, discarding contents.
wfIsCLI()
Check if we are running from the commandline.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
if(! $wgDBerrorLogTZ) $wgRequest
Class representing a 'diff' between two sequences of strings.
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
Implements some public methods and some protected utility functions which are required by multiple ch...
The Message class deals with fetching and processing of interface message into a variety of formats.
static newFallbackSequence(... $keys)
Factory function accepting multiple message keys and returning a message instance for the first messa...
while(( $__line=Maintenance::readconsole()) !==false) print
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext