MediaWiki REL1_41
GlobalFunctions.php File Reference

Global functions used everywhere. More...

Go to the source code of this file.

Functions

 wfAppendQuery ( $url, $query)
 Append a query string to an existing URL, which may or may not already have query string parameters already.
 
 wfArrayDiff2 ( $arr1, $arr2)
 Like array_diff( $arr1, $arr2 ) except that it works with two-dimensional arrays.
 
 wfArrayInsertAfter (array $array, array $insert, $after)
 Insert an array into another array after the specified key.
 
 wfArrayPlus2d (array $baseArray, array $newValues)
 Merges two (possibly) 2 dimensional arrays into the target array ($baseArray).
 
 wfArrayToCgi ( $array1, $array2=null, $prefix='')
 This function takes one or two arrays as input, and returns a CGI-style string, e.g.
 
 wfAssembleUrl ( $urlParts)
 This function will reassemble a URL parsed with wfParseURL.
 
 wfBacktrace ( $raw=null)
 Get a debug backtrace as a string.
 
 wfBaseName ( $path, $suffix='')
 Return the final portion of a pathname.
 
 wfBoolToStr ( $value)
 Convenience function converts boolean values into "true" or "false" (string) values.
 
 wfCgiToArray ( $query)
 This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns the same string in array form.
 
 wfClientAcceptsGzip ( $force=false)
 Whether the client accept gzip encoding.
 
 wfDebug ( $text, $dest='all', array $context=[])
 Sends a line to the debug log if enabled or, optionally, to a comment in output.
 
 wfDebugBacktrace ( $limit=0)
 Safety wrapper for debug_backtrace().
 
 wfDebugLog ( $logGroup, $text, $dest='all', array $context=[])
 Send a line to a supplementary debug log file, if configured, or main debug log if not.
 
 wfDeprecated ( $function, $version=false, $component=false, $callerOffset=2)
 Logs a warning that a deprecated feature was used.
 
 wfDeprecatedMsg ( $msg, $version=false, $component=false, $callerOffset=2)
 Log a deprecation warning with arbitrary message text.
 
 wfEscapeShellArg (... $args)
 Locale-independent version of escapeshellarg()
 
 wfEscapeWikiText ( $text)
 Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
 
 wfExpandIRI ( $url)
 Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences.
 
 wfExpandUrl ( $url, $defaultProto=PROTO_CURRENT)
 Expand a potentially local URL to a fully-qualified URL using $wgServer (or one of its alternatives).
 
 wfFormatStackFrame ( $frame)
 Return a string representation of frame.
 
 wfGetAllCallers ( $limit=3)
 Return a string consisting of callers in the stack.
 
 wfGetCaller ( $level=2)
 Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie.
 
 wfGetDB ( $db, $groups=[], $wiki=false)
 Get a Database object.
 
 wfGetLangObj ( $langcode=false)
 Return a Language object from $langcode.
 
 wfGetNull ()
 Get a platform-independent path to the null file, e.g.
 
 wfGetServerUrl ( $proto)
 Get the wiki's "server", i.e.
 
 wfGetUrlUtils ()
 
 wfHostname ()
 Get host name of the current machine, for use in error reporting.
 
 wfHttpError ( $code, $label, $desc)
 Provide a simple HTTP error.
 
 wfIniGetBool ( $setting)
 Safety wrapper around ini_get() for boolean settings.
 
 wfIsDebugRawPage ()
 Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
 
 wfIsInfinity ( $str)
 Determine input string is represents as infinity.
 
 wfLoadExtension ( $ext, $path=null)
 Load an extension.
 
 wfLoadExtensions (array $exts)
 Load multiple extensions at once.
 
 wfLoadSkin ( $skin, $path=null)
 Load a skin.
 
 wfLoadSkins (array $skins)
 Load multiple skins at once.
 
 wfLogDBError ( $text, array $context=[])
 Log for database errors.
 
 wfLogWarning ( $msg, $callerOffset=1, $level=E_USER_WARNING)
 Send a warning as a PHP error and the debug log.
 
 wfMatchesDomainList ( $url, $domains)
 Check whether a given URL has a domain that occurs in a given set of domains.
 
 wfMemoryLimit ( $newLimit)
 Raise PHP's memory limit (if needed).
 
 wfMerge (string $old, string $mine, string $yours, ?string &$simplisticMergeAttempt, string &$mergeLeftovers=null)
 wfMerge attempts to merge differences between three texts.
 
 wfMergeErrorArrays (... $args)
 Merge arrays in the style of PermissionManager::getPermissionErrors, with duplicate removal e.g.
 
 wfMessage ( $key,... $params)
 This is the function for getting translated interface messages.
 
 wfMessageFallback (... $keys)
 This function accepts multiple message keys and returns a message instance for the first message which is non-empty.
 
 wfMkdirParents ( $dir, $mode=null, $caller=null)
 Make directory, and make all parent directories if they don't exist.
 
 wfMsgReplaceArgs ( $message, $args)
 Replace message parameter keys on the given formatted output.
 
 wfObjectToArray ( $objOrArray, $recursive=true)
 Recursively converts the parameter (an object) to an array with the same data.
 
 wfParseUrl ( $url)
 parse_url() work-alike, but non-broken.
 
 wfPercent ( $nr, int $acc=2, bool $round=true)
 
 wfRandom ()
 Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for any realistic number of articles.
 
 wfRandomString ( $length=32)
 Get a random string containing a number of pseudo-random hex characters.
 
 wfRecursiveRemoveDir ( $dir)
 Remove a directory and all its content.
 
 wfRelativePath ( $path, $from)
 Generate a relative path name to the given file.
 
 wfRemoveDotSegments ( $urlPath)
 Remove all dot-segments in the provided URL path.
 
 wfReportTime ( $nonce=null, $triggerWarnings=true)
 Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'.
 
 wfResetOutputBuffers ( $resetGzipEncoding=true)
 Clear away any user-level output buffers, discarding contents.
 
 wfScript ( $script='index')
 Get the URL path to a MediaWiki entry point.
 
 wfSetBit (&$dest, $bit, $state=true)
 As for wfSetVar except setting a bit.
 
 wfSetVar (&$dest, $source, $force=false)
 Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL.
 
 wfShellExec ( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
 Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.
 
 wfShellExecWithStderr ( $cmd, &$retval=null, $environ=[], $limits=[])
 Execute a shell command, returning both stdout and stderr.
 
 wfShellWikiCmd ( $script, array $parameters=[], array $options=[])
 Generate a shell-escaped command line string to run a MediaWiki cli script.
 
 wfShorthandToInteger (?string $string='', int $default=-1)
 Converts shorthand byte notation to integer form.
 
 wfStringToBool ( $val)
 Convert string value to boolean, when the following are interpreted as true:
 
 wfStripIllegalFilenameChars ( $name)
 Replace all invalid characters with '-'.
 
 wfTempDir ()
 Tries to get the system directory for temporary files.
 
 wfThumbIsStandard (File $file, array $params)
 Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output.
 
 wfTimestamp ( $outputtype=TS_UNIX, $ts=0)
 Get a timestamp string in one of various formats.
 
 wfTimestampNow ()
 Convenience function; returns MediaWiki timestamp for the present time.
 
 wfTimestampOrNull ( $outputtype=TS_UNIX, $ts=null)
 Return a formatted timestamp, or null if input is null.
 
 wfTransactionalTimeLimit ()
 Raise the request time limit to $wgTransactionalTimeLimit.
 
 wfUnpack ( $format, $data, $length=false)
 Wrapper around php's unpack.
 
 wfUrlencode ( $s)
 We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default.
 
 wfUrlProtocols ( $includeProtocolRelative=true)
 Returns a regular expression of url protocols.
 
 wfUrlProtocolsWithoutProtRel ()
 Like wfUrlProtocols(), but excludes '//' from the protocol list.
 
 wfVarDump ( $var)
 A wrapper around the PHP function var_export().
 
 wfWarn ( $msg, $callerOffset=1, $level=E_USER_NOTICE)
 Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
 

Detailed Description

Global functions used everywhere.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file GlobalFunctions.php.

Function Documentation

◆ wfAppendQuery()

◆ wfArrayDiff2()

wfArrayDiff2 ( $arr1,
$arr2 )

Like array_diff( $arr1, $arr2 ) except that it works with two-dimensional arrays.

Parameters
string[] | array[]$arr1
string[] | array[]$arr2
Returns
array

Definition at line 115 of file GlobalFunctions.php.

◆ wfArrayInsertAfter()

wfArrayInsertAfter ( array $array,
array $insert,
$after )

Insert an array into another array after the specified key.

If the key is not present in the input array, it is returned without modification.

Parameters
array$array
array$insertThe array to insert.
mixed$afterThe key to insert after.
Returns
array

Definition at line 196 of file GlobalFunctions.php.

Referenced by ApiComparePages\getAllowedParams(), SkinTemplate\injectLegacyMenusIntoPersonalTools(), and UpdateExtensionJsonSchema\updateTo2().

◆ wfArrayPlus2d()

wfArrayPlus2d ( array $baseArray,
array $newValues )

Merges two (possibly) 2 dimensional arrays into the target array ($baseArray).

Values that exist in both values will be combined with += (all values of the array of $newValues will be added to the values of the array of $baseArray, while values, that exists in both, the value of $baseArray will be used).

Parameters
array$baseArrayThe array where you want to add the values of $newValues to
array$newValuesAn array with new values
Returns
array The combined array
Since
1.26

Definition at line 2182 of file GlobalFunctions.php.

Referenced by HTMLUserTextField\__construct(), and ExtensionRegistry\exportExtractedData().

◆ wfArrayToCgi()

◆ wfAssembleUrl()

wfAssembleUrl ( $urlParts)

This function will reassemble a URL parsed with wfParseURL.

This is useful if you need to edit part of a URL and put it back together.

This is the basic structure used (brackets contain keys for $urlParts): [scheme][delimiter][user]:[pass]@[host]:[port][path]?[query]#[fragment]

Deprecated
since 1.39, use UrlUtils::assemble()
Since
1.19
Parameters
array$urlPartsURL parts, as output from wfParseUrl
Returns
string URL assembled from its component parts

Definition at line 547 of file GlobalFunctions.php.

Referenced by MWHttpRequest\setReverseProxy().

◆ wfBacktrace()

wfBacktrace ( $raw = null)

Get a debug backtrace as a string.

Parameters
bool | null$rawIf true, the return value is plain text. If false, HTML. Defaults to $wgCommandLineMode if unset.
Returns
string
Since
1.25 Supports $raw parameter.

Definition at line 1052 of file GlobalFunctions.php.

References $file, $wgCommandLineMode, and wfDebugBacktrace().

Referenced by MWDebug\sendRawDeprecated().

◆ wfBaseName()

wfBaseName ( $path,
$suffix = '' )

Return the final portion of a pathname.

Reimplemented because PHP5's "basename()" is buggy with multibyte text. https://bugs.php.net/bug.php?id=33898

PHP's basename() only considers '\' a pathchar on Windows and Netware. We'll consider it so always, as we don't want '\s' in our Unix paths either.

Parameters
string$path
string$suffixString to remove if present
Returns
string

Definition at line 1782 of file GlobalFunctions.php.

References $matches, and $path.

Referenced by Exif\__construct(), ImageBuilder\checkMissingImage(), FileOpPerfTest\doPerfTest(), ImportImages\execute(), wfImageAuthMain(), wfRelativePath(), and wfStripIllegalFilenameChars().

◆ wfBoolToStr()

wfBoolToStr ( $value)

Convenience function converts boolean values into "true" or "false" (string) values.

Parameters
bool$value
Returns
string

Definition at line 1913 of file GlobalFunctions.php.

Referenced by ApiRsd\formatRsdApiList(), and FileCacheBase\isCacheGood().

◆ wfCgiToArray()

wfCgiToArray ( $query)

This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns the same string in array form.

This allows compatibility with legacy functions that accept raw query strings instead of nice arrays. Of course, keys and values are urldecode()d.

Parameters
string$queryQuery string
Returns
string[] Array version of input

Definition at line 385 of file GlobalFunctions.php.

Referenced by MediaWiki\Skin\SkinComponentUtils\getReturnToParam(), MediaWiki\Linker\Linker\makeBrokenImageLinkObj(), MediaWiki\Specials\SpecialChangeEmail\onSuccess(), MediaWiki\Output\OutputPage\returnToMain(), LoginHelper\showReturnToPage(), MediaWiki\Linker\Linker\specialLink(), MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), and MediaWiki\Specials\SpecialCreateAccount\successfulAction().

◆ wfClientAcceptsGzip()

wfClientAcceptsGzip ( $force = false)

Whether the client accept gzip encoding.

Uses the Accept-Encoding header to check if the client supports gzip encoding. Use this when considering to send a gzip-encoded response to the client.

Parameters
bool$forceForces another check even if we already have a cached result.
Returns
bool

Definition at line 1134 of file GlobalFunctions.php.

References wfDebug().

Referenced by HTMLFileCache\loadFromFileCache(), and HTMLFileCache\saveToFileCache().

◆ wfDebug()

wfDebug ( $text,
$dest = 'all',
array $context = [] )

Sends a line to the debug log if enabled or, optionally, to a comment in output.

In normal operation this is a NOP.

Controlling globals: $wgDebugLogFile - points to the log file $wgDebugRawPage - if false, 'action=raw' hits will not result in debug output. $wgDebugComments - if on, some debug items may appear in comments in the HTML output.

Since
1.25 support for additional context data
Parameters
string$text
string | bool$destDestination of the message:
  • 'all': both to the log and HTML (debug toolbar or HTML comments)
  • 'private': excluded from HTML output For backward compatibility, it can also take a boolean:
  • true: same as 'all'
  • false: same as 'private'
array$contextAdditional logging context data

Definition at line 664 of file GlobalFunctions.php.

References $wgDebugLogPrefix, $wgDebugRawPage, and wfIsDebugRawPage().

Referenced by ApiMain\__construct(), DifferenceEngine\__construct(), UploadStashFile\__construct(), QuickTemplate\__construct(), ParserFactory\__construct(), UploadFromChunks\__construct(), UploadFromStash\__construct(), MediaWiki\StubObject\StubGlobalUser\_unstub(), MediaWiki\StubObject\StubObject\_unstub(), LogPage\actionText(), ImageGalleryBase\add(), MediaHandler\addMeta(), Skin\afterContentHook(), MediaWiki\Linker\Linker\blockLink(), MediaWiki\Output\OutputPage\checkLastModified(), UploadBase\checkSvgScriptCallback(), UploadBase\checkXMLEncodingMissmatch(), JobQueueDB\claimOldest(), LocalRepo\cleanupDeletedBatch(), UploadBase\cleanupTempFile(), UploadStash\clear(), CloneDatabase\cloneTableStructure(), MediaWiki\Storage\SqlBlobStore\compressData(), UploadFromChunks\concatenateChunks(), UploadBase\createFromRequest(), WikiImporter\debug(), RecompressTracked\debug(), BaseDump\debug(), UploadBase\detectScript(), UploadBase\detectVirus(), MediaWiki\Block\DatabaseBlock\doAutoblock(), JobQueueDB\doBatchPushInternal(), WikiFilePage\doPurge(), MediaWiki\Specials\SpecialUserRights\doSaveUserGroups(), DjVuHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\EditPage\EditPage\edit(), MediaWiki\Specials\SpecialUpload\execute(), LocalFileRestoreBatch\execute(), Article\fetchRevisionRecord(), WikiImporter\finishImportPage(), FormatMetadata\flattenArrayReal(), MediaWiki\Pager\ContribsPager\formatRow(), MediaWiki\Pager\DeletedContribsPager\formatRow(), FileRepo\freeTemp(), LCStoreCDB\get(), MediaWiki\PoolCounter\PoolCounterConnectionManager\get(), Action\getContext(), ContextSource\getContext(), MediaWiki\SpecialPage\SpecialPage\getContext(), MediaWiki\Specials\SpecialVersion\getCreditsForExtension(), File\getDescriptionText(), ForeignDBFile\getDescriptionText(), UploadStash\getFile(), DoubleRedirectJob\getFinalDestination(), WikiFilePage\getForeignCategories(), GenderCache\getGenderOf(), MediaWiki\Specials\SpecialUpload\getInitialPageText(), TransformationalImageHandler\getMagickVersion(), RequestContext\getMainAndWarn(), GIFMetadataExtractor\getMetadata(), PNGMetadataExtractor\getMetadata(), MediaWiki\Request\WebRequestUpload\getName(), MediaWiki\Title\Title\getNsText(), GIFHandler\getSizeAndMetadata(), JpegHandler\getSizeAndMetadata(), PNGHandler\getSizeAndMetadata(), SvgHandler\getSizeAndMetadata(), TiffHandler\getSizeAndMetadata(), DjVuHandler\getSizeAndMetadata(), ForeignAPIRepo\getThumbError(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), MediaWiki\Title\Title\getTitleValue(), File\getViewURL(), MediaWiki\Output\OutputPage\haveCacheVaryCookies(), ThumbnailRenderJob\hitThumbUrl(), ForeignAPIRepo\httpGet(), MediaWiki\EditPage\EditPage\importFormData(), WikiRevision\importLogItem(), MediaWiki\EditPage\EditPage\internalAttemptSave(), FileCacheBase\isCacheGood(), MediaWiki\Specials\SpecialRecentChanges\isDenseTagFilter(), MediaWiki\Shell\Shell\isDisabled(), DjVuHandler\isEnabled(), SvgHandler\isEnabled(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), MediaWiki\Block\DatabaseBlock\isExpired(), FileDependency\isExpired(), ExifBitmapHandler\isFileMetadataValid(), GIFHandler\isFileMetadataValid(), PNGHandler\isFileMetadataValid(), WebPHandler\isFileMetadataValid(), MediaWiki\Page\MovePage\isValidMoveTarget(), MediaWiki\SiteStats\SiteStats\loadAndLazyInit(), MediaWiki\User\User\loadFromCache(), HTMLFileCache\loadFromFileCache(), MediaWiki\Linker\Linker\makeExternalImage(), MediaWiki\Linker\Linker\makeExternalLink(), MediaWiki\Linker\Linker\makeImageLink(), MediaWiki\Linker\Linker\makeMediaLinkFile(), ImportStreamSource\newFromURL(), WikiImporter\notice(), RawAction\onView(), BacklinkCache\partition(), MediaWiki\preOutputCommit(), MediaWiki\Specials\SpecialUpload\processUpload(), LocalFile\purgeThumbList(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), TextPassDumper\readDump(), UploadStash\removeFileNoAuth(), WikiPage\replaceSectionAtRev(), MediaWiki\restInPeace(), DjVuImage\retrieveMetaData(), BitmapHandler\rotate(), DoubleRedirectJob\run(), FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), MediaWiki\Output\OutputPage\sendCacheControl(), MediaWiki\PoolCounter\PoolCounterClient\sendCommand(), UserMailer\sendInternal(), UserMailer\sendWithPear(), ApiMain\setCacheMode(), ViewAction\show(), LocalRepo\skipWriteOperationIfSha1(), MediaWiki\User\User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), WikiImporter\throwXmlError(), MediaWiki\Tidy\RemexDriver\tidy(), File\transform(), BitmapHandler\transformCustom(), BitmapHandler\transformGd(), BitmapHandler\transformImageMagick(), BitmapHandler\transformImageMagickExt(), LocalisationCacheBulkLoad\trimCache(), Article\tryFileCache(), LocalFile\upgradeRow(), OldLocalFile\upgradeRow(), MediaWiki\Revision\RevisionRecord\userCanBitfield(), MediaWiki\Linker\Linker\userLink(), MediaWiki\Linker\Linker\userTalkLink(), MediaWiki\Linker\Linker\userToolLinks(), UploadBase\verifyExtension(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), ApiUpload\verifyUpload(), Article\view(), WikiImporter\warn(), wfApiMain(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfGetLangObj(), wfMemoryLimit(), wfMkdirParents(), and wfTimestamp().

◆ wfDebugBacktrace()

wfDebugBacktrace ( $limit = 0)

Safety wrapper for debug_backtrace().

Will return an empty array if debug_backtrace is disabled, otherwise the output from debug_backtrace() (trimmed).

Parameters
int$limitThis parameter can be used to limit the number of stack frames returned
Returns
array Array of backtrace information

Definition at line 1024 of file GlobalFunctions.php.

References wfDebug().

Referenced by wfBacktrace(), wfGetAllCallers(), and wfGetCaller().

◆ wfDebugLog()

wfDebugLog ( $logGroup,
$text,
$dest = 'all',
array $context = [] )

Send a line to a supplementary debug log file, if configured, or main debug log if not.

To configure a supplementary log file, set $wgDebugLogGroups[$logGroup] to a string filename or an associative array mapping 'destination' to the desired filename. The associative array may also contain a 'sample' key with an integer value, specifying a sampling factor. Sampled log events will be emitted with a 1 in N random chance.

Since
1.23 support for sampling log messages via $wgDebugLogGroups.
1.25 support for additional context data
1.25 sample behavior dependent on configured $wgMWLoggerDefaultSpi
Parameters
string$logGroup
string$text
string | bool$destDestination of the message:
  • 'all': both to the log and HTML (debug toolbar or HTML comments)
  • 'private': only to the specific log if set in $wgDebugLogGroups and discarded otherwise For backward compatibility, it can also take a boolean:
  • true: same as 'all'
  • false: same as 'private'
array$contextAdditional logging context data

Definition at line 728 of file GlobalFunctions.php.

Referenced by UploadFromChunks\concatenateChunks(), WebPHandler\decodeLosslessChunkHeader(), WebPHandler\decodeLossyChunkHeader(), JobQueueRedis\doAck(), JobQueueRedis\doBatchPush(), JobQueueRedis\doPop(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), CheckUsernames\execute(), WebPHandler\extractMetadata(), WebPHandler\extractMetadataFromChunks(), Message\formatListParam(), IPTC\getCharset(), ContentHandler\getContentText(), MediaWiki\Request\WebResponse\header(), PoolCounterWork\logError(), MediaHandler\logErrorForExternalProcess(), JobQueueFederated\logException(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), LocalFile\move(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), IPTC\parse(), MediaWiki\preOutputCommit(), CdnCacheUpdate\purge(), UploadFromUrl\reallyFetchFile(), MediaHandler\removeBadFile(), UploadFromUrl\saveTempFileChunk(), MediaWiki\Request\WebResponse\setCookie(), MediaWiki\Request\WebResponse\statusHeader(), wfForbidden(), and wfImageAuthMain().

◆ wfDeprecated()

wfDeprecated ( $function,
$version = false,
$component = false,
$callerOffset = 2 )

Logs a warning that a deprecated feature was used.

To write a custom deprecation message, use wfDeprecatedMsg() instead.

Parameters
string$functionFeature that is deprecated.
string | false$versionVersion of MediaWiki that the feature was deprecated in (Added in 1.19).
string | bool$componentComponent to which the feature belongs. If false, it is assumed the function is in MediaWiki core (Added in 1.19).
int$callerOffsetHow far up the call stack is the original caller. 2 = function that called the function that called wfDeprecated (Added in 1.20).
Exceptions
InvalidArgumentExceptionIf the MediaWiki version number specified by $version is neither a string nor false.

Definition at line 767 of file GlobalFunctions.php.

Referenced by SearchResultSet\__construct(), MediaWiki\Specials\SpecialRandomPage\__construct(), MessageContent\__construct(), MediaWiki\SpecialPage\SpecialRedirectWithAction\__construct(), MWHttpRequest\__construct(), SearchResult\__construct(), SwiftVirtualRESTService\__construct(), VirtualRESTService\__construct(), MediaWiki\Search\Entity\SearchResultThumbnail\__construct(), __get(), MediaWiki\User\User\__get(), __isset(), __set(), MediaWiki\User\User\__set(), MediaWiki\StubObject\DeprecatedGlobal\_newObject(), MediaWiki\StubObject\StubGlobalUser\_newObject(), MediaWiki\User\User\addGroup(), ApiModuleManager\addModule(), Parser\attributeStripCallback(), MediaWiki\User\User\blockedFor(), Skin\bottomScripts(), SkinTemplate\buildContentNavigationUrls(), MediaWiki\User\ActorMigrationBase\checkDeprecation(), ContentModelChange\checkPermissions(), Hooks\clear(), MediaWiki\Linker\Linker\commentBlock(), Message\content(), MediaWiki\Parser\Parsoid\Config\PageConfigFactory\create(), JobQueueGroup\deduplicateRootJob(), SearchEngine\defaultNearMatcher(), SqlBagOStuff\deleteAll(), Parser\doBlockLevels(), WikiPage\doDeleteArticleBatched(), Parser\enableOOUI(), Maintenance\error(), SqlBagOStuff\expireAll(), MediaWiki\Config\SiteConfiguration\extractGlobal(), MediaWiki\Config\SiteConfiguration\extractVar(), MediaWiki\User\CentralId\CentralIdLookup\factory(), RCFeed\factory(), AbstractContent\fillParserOutput(), Skin\footerLink(), MediaWiki\Linker\Linker\formatComment(), MediaWiki\Linker\Linker\formatLinksInComment(), MediaWiki\User\User\getAllGroups(), Profiler\getAllowOutput(), PageArchive\getArchivedRevisionRecord(), WikiPage\getAutoDeleteReason(), ContentHandler\getAutoDeleteReason(), MediaWiki\Pager\TablePager\getBody(), ParserOutput\getCategories(), MediaWiki\Config\SiteConfiguration\getConfig(), Skin\getCopyright(), MediaWiki\Output\OutputPage\getCSPNonce(), Parser\getCustomDefaultSort(), MediaWiki\User\UserRightsProxy\getDB(), MediaWiki\Config\ConfigFactory\getDefaultInstance(), Parser\getDefaultSort(), MediaWiki\ResourceLoader\Module\getDeprecationInformation(), EnhancedChangesList\getDiffHistLinks(), ExtensionProcessor\getExtraAutoloaderPaths(), PageArchive\getFileStatus(), BaseTemplate\getFooterIcons(), Parser\getFreshParser(), Parser\getFunctionLang(), MediaWiki\User\UserGroupMembership\getGroupMemberName(), MediaWiki\User\User\getGroupMemberships(), MediaWiki\User\UserGroupMembership\getGroupName(), MediaWiki\User\User\getGroups(), Hooks\getHandlers(), MediaWiki\User\User\getImplicitGroups(), MediaWiki\User\ActorMigrationBase\getInsertValuesWithTempTable(), PageArchive\getLastRevisionId(), Wikimedia\Rdbms\ConnectionManager\getLazyReadConnectionRef(), AbstractContent\getNativeData(), MediaWiki\User\User\getOption(), Parser\getOutput(), Parser\getPage(), WikiPage\getPageIsRedirectField(), AbstractContent\getParserOutput(), MediaWiki\Block\AbstractBlock\getPermissionsError(), PageArchive\getPreviousRevisionRecord(), Wikimedia\Rdbms\ConnectionManager\getReadConnectionRef(), MediaWiki\Block\AbstractBlock\getReason(), MediaWiki\Block\DatabaseBlock\getReason(), Article\getRedirectHeaderHtml(), WikitextContent\getRedirectTargetAndText(), PageArchive\getRevisionRecordByTimestamp(), PageArchive\getRevisionStatus(), MediaWiki\Linker\Linker\getRollbackEditCount(), ContentHandler\getSlotDiffRendererWithOptions(), MediaWiki\SpecialPage\QueryPage\getSQL(), MediaWiki\Specials\SpecialBlock\getTargetAndType(), ParserOutput\getTOCHTML(), Wikimedia\Rdbms\ConnectionManager\getWriteConnectionRef(), MediaWiki\Output\OutputPage\headElement(), WikiPage\insertRedirect(), MediaWiki\User\BotPassword\invalidateAllPasswordsForCentralId(), PageArchive\isDeleted(), Hooks\isRegistered(), MediaWiki\Request\WebRequest\isSafeRequest(), UploadBase\isThrottled(), MediaWiki\Languages\LanguageConverterFactory\isTitleConversionDisabled(), Skin\lastModified(), MediaWiki\SpecialPage\SpecialPage\listed(), PageArchive\listRevisions(), Skin\makeSearchButton(), Skin\makeSearchInput(), MediaWiki\Request\WebRequest\markAsSafeRequest(), CoreParserFunctions\mwnamespace(), MediaWiki\User\UserRightsProxy\newFromId(), MediaWiki\User\UserRightsProxy\newFromName(), MediaWiki\Title\TitleArray\newFromResult(), SerializedValueContainer\newUnified(), BaseSearchResultSet\next(), Parser\Options(), Parser\OutputType(), AbstractContent\preloadTransform(), MediaWiki\Output\OutputPage\prepareErrorPage(), AbstractContent\prepareSave(), AbstractContent\preSaveTransform(), MediaWiki\Block\DatabaseBlock\purgeExpired(), Hooks\register(), Wikimedia\Rdbms\ConnectionManager\releaseConnection(), MediaWiki\User\BotPassword\removeAllPasswordsForCentralId(), MediaWiki\User\User\removeGroup(), MediaWiki\Parser\Sanitizer\removeHTMLtags(), MediaWiki\Linker\Linker\revComment(), BaseSearchResultSet\rewind(), MWExceptionHandler\rollbackMasterChangesAndLog(), Hooks\run(), Hooks\runner(), Hooks\runWithoutAbort(), UserNamePrefixSearch\search(), ParserOptions\setAllowExternalImages(), ParserOptions\setAllowExternalImagesFrom(), MediaWiki\Session\SessionProvider\setConfig(), Parser\setDefaultSort(), ParserOptions\setEnableImageWhitelist(), setExtensionData(), Action\setHeaders(), MediaWiki\SpecialPage\SpecialPage\setHeaders(), MediaWiki\Session\SessionProvider\setHookContainer(), TextSlotDiffRenderer\setLanguage(), MediaWiki\SpecialPage\SpecialPage\setListed(), MediaWiki\Session\SessionProvider\setLogger(), MediaWiki\Session\SessionProvider\setManager(), Profiler\setProfileID(), ParserOutput\setTOCHTML(), MediaWikiShell\setupLogging(), ParserOptions\setWrapOutputClass(), MediaWiki\SpecialPage\LoginSignupSpecialPage\showSuccessPage(), JobSpecification\toSerializableArray(), MediaWiki\Parser\Sanitizer\validateAttributes(), MediaWiki\User\UserRightsProxy\validDatabase(), JobQueueGroup\waitForBackups(), wfGetLangObj(), wfReportTime(), MediaWiki\User\UserRightsProxy\whoIs(), and MediaWiki\Session\PHPSessionHandler\write().

◆ wfDeprecatedMsg()

wfDeprecatedMsg ( $msg,
$version = false,
$component = false,
$callerOffset = 2 )

Log a deprecation warning with arbitrary message text.

A caller description will be appended. If the message has already been sent for this caller, it won't be sent again.

Although there are component and version parameters, they are not automatically appended to the message. The message text should include information about when the thing was deprecated. The component and version are just used to implement $wgDeprecationReleaseLimit.

Since
1.35
Parameters
string$msgThe message
string | false$versionVersion of MediaWiki that the function was deprecated in.
string | bool$componentComponent to which the function belongs. If false, it is assumed the function is in MediaWiki core.
int | false$callerOffsetHow far up the call stack is the original caller. 2 = function that called the function that called us. If false, the caller description will not be appended.

Definition at line 798 of file GlobalFunctions.php.

Referenced by HTMLFormField\__construct(), ParsoidVirtualRESTService\__construct(), MediaWiki\User\UserIdentityValue\__construct(), MediaWiki\StubObject\StubGlobalUser\__destruct(), Article\__get(), CacheTime\__get(), ParserOutput\__get(), Article\__set(), CacheTime\__set(), ParserOutput\__set(), ParserOutput\addWarningMsg(), Parser\braceSubstitution(), MediaWiki\DAO\deprecateInvalidCrossWiki(), Wikimedia\Rdbms\InsertQueryBuilder\execute(), MediaWiki\User\User\getActorId(), RecentChange\getAttribute(), MediaWikiSite\getFileUrl(), MediaWiki\Specials\SpecialContributions\getForm(), MediaWiki\MediaWikiServices\getInstance(), HTMLInfoField\getOOUI(), MediaWiki\Parser\Sanitizer\getRecognizedTagData(), MediaWiki\MediaWikiServices\getService(), MediaWiki\Revision\RevisionStore\getTitle(), MediaWiki\Block\DatabaseBlockStore\insertBlock(), LocalFile\loadFromRow(), MediaWiki\User\User\newSystemUser(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetExists(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetGet(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetSet(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetUnset(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\queueRecursiveJobsForTable(), MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml(), CacheTime\setCacheTime(), MediaWiki\Specials\SpecialSearch\showResults(), and MediaWiki\Search\SearchWidgets\DidYouMeanWidget\suggestionHtml().

◆ wfEscapeShellArg()

wfEscapeShellArg ( $args)

Locale-independent version of escapeshellarg()

Originally, this fixed the incorrect use of single quotes on Windows (https://bugs.php.net/bug.php?id=26285) and the locale problems on Linux in PHP 5.2.6+ (https://bugs.php.net/bug.php?id=54391). The second bug is still open as of 2021.

Parameters
string|string[]...$args strings to escape and glue together, or a single array of strings parameter
Returns
string
Deprecated
since 1.30 use MediaWiki\Shell\Shell::escape()

Definition at line 1560 of file GlobalFunctions.php.

◆ wfEscapeWikiText()

wfEscapeWikiText ( $text)

Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.

making its way through. This is achieved by substituting certain characters with HTML entities. As required by the callers, "<nowiki>" is not used.

Parameters
string$textText to be escaped
-taint$textescapes_html
Returns
string

Definition at line 1168 of file GlobalFunctions.php.

References $wgEnableMagicLinks, and $wgUrlProtocols.

Referenced by MediaWiki\Title\MalformedTitleException\__construct(), MediaHandler\addMeta(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), Parser\braceSubstitution(), MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), ApiMain\checkAsserts(), ApiQueryImageInfo\checkParameterNormalise(), MediaWiki\Specials\SpecialContributions\contributionsSub(), ApiMain\createPrinterByName(), CoreParserFunctions\defaultsort(), CoreParserFunctions\displaytitle(), WikiPage\doDeleteArticleBatched(), WikiPage\doDeleteArticleReal(), ApiMain\errorMessagesFromException(), MediaWiki\Specials\SpecialFileDuplicateSearch\execute(), MediaWiki\Specials\SpecialMergeHistory\execute(), MediaWiki\Specials\SpecialUnblock\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiLinkAccount\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOptions\execute(), ApiParse\execute(), ApiProtect\execute(), ApiQueryAllMessages\execute(), ApiQueryLogEvents\execute(), ApiQueryUserContribs\execute(), ApiUndelete\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), ApiBase\extractRequestParams(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), MediaWiki\Status\Status\getErrorMessage(), ApiErrorFormatter\getMessageFromException(), ApiBase\getModuleFromPath(), ApiBase\getTitleFromTitleOrPageId(), ApiBase\getTitleOrPageId(), Parser\getUserSig(), ApiBase\getWatchlistUser(), RollbackAction\handleRollbackRequest(), MediaWiki\EditPage\EditPage\importFormData(), MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(), ApiQueryImageInfo\mergeThumbParams(), MediaWiki\Specials\SpecialRandomInCategory\onSubmit(), MediaWiki\Specials\SpecialBlock\onSuccess(), MediaWiki\Specials\SpecialPasswordReset\onSuccess(), ImagePage\openShowImage(), MediaWiki\Pager\ImageListPager\outputUserDoesNotExist(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), ApiQueryBase\parsePrefixedTitlePart(), MediaWiki\Specials\SpecialBlock\postHtml(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryRecentChanges\run(), ApiQueryRevisions\run(), ApiMain\setupModule(), MediaWiki\Specials\SpecialSearch\showCreateLink(), MediaWiki\Specials\SpecialUserRights\showEditUserGroupsForm(), MediaWiki\Specials\SpecialUndelete\showHistory(), Article\showMissingArticle(), MediaWiki\Specials\SpecialSearch\showResults(), MediaWiki\SpecialPage\LoginSignupSpecialPage\showSuccessPage(), MediaWiki\EditPage\EditPage\spamPageWithContent(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), DeleteAction\tempDelete(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), and MediaWiki\Preferences\SignatureValidator\validateSignature().

◆ wfExpandIRI()

wfExpandIRI ( $url)

Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences.

Deprecated
since 1.39, use UrlUtils::expandIRI()
Parameters
string$url
Returns
string

Definition at line 628 of file GlobalFunctions.php.

References wfGetUrlUtils().

Referenced by Skin\printSource().

◆ wfExpandUrl()

wfExpandUrl ( $url,
$defaultProto = PROTO_CURRENT )

Expand a potentially local URL to a fully-qualified URL using $wgServer (or one of its alternatives).

The meaning of the PROTO_* constants is as follows: PROTO_HTTP: Output a URL starting with http:// PROTO_HTTPS: Output a URL starting with https:// PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer

If $url specifies a protocol, or $url is domain-relative and $wgServer specifies a protocol, PROTO_HTTP, PROTO_HTTPS, PROTO_RELATIVE and PROTO_CURRENT do not change that.

Parent references (/../) in the path are resolved (as in wfRemoveDotSegments).

Deprecated
since 1.39, use UrlUtils::expand()
Parameters
string$urlAn URL; can be absolute (e.g. http://example.com/foo/bar), protocol-relative (//example.com/foo/bar) or domain-relative (/foo/bar).
string | int | null$defaultProtoOne of the PROTO_* constants, as described above.
Returns
string|false Fully-qualified URL, current-path-relative URL or false if no valid URL can be constructed

Definition at line 518 of file GlobalFunctions.php.

References MediaWiki\Utils\UrlUtils\expand(), and wfGetUrlUtils().

Referenced by MWHttpRequest\__construct(), ParsoidVirtualRESTService\__construct(), WebInstallerWelcome\execute(), MediaWiki\Linker\Linker\expandLocalLinks(), CoreParserFunctions\filepath(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\generateIconFromFavicon(), MediaWiki\Feed\FeedItem\getUniqueIdUnescaped(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\headerHtml(), MediaWiki\Feed\AtomFeed\outHeader(), MediaWiki\Feed\RSSFeed\outHeader(), MediaWiki\Feed\AtomFeed\outItem(), MediaWiki\Feed\RSSFeed\outItem(), VirtualRESTServiceClient\runMulti(), SearchSuggestion\setSuggestedTitle(), and wfStreamThumb().

◆ wfFormatStackFrame()

wfFormatStackFrame ( $frame)

Return a string representation of frame.

Parameters
array$frame
Returns
string

Definition at line 1116 of file GlobalFunctions.php.

Referenced by wfGetCaller().

◆ wfGetAllCallers()

wfGetAllCallers ( $limit = 3)

Return a string consisting of callers in the stack.

Useful sometimes for profiling specific points.

Parameters
int | false$limitThe maximum depth of the stack frame to return, or false for the entire stack.
Returns
string

Definition at line 1101 of file GlobalFunctions.php.

References wfDebugBacktrace().

Referenced by MediaWiki\Session\SessionBackend\addData(), MediaWiki\Session\SessionBackend\dirty(), and MediaWiki\Session\SessionBackend\renew().

◆ wfGetCaller()

wfGetCaller ( $level = 2)

Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie.

FUNCTION) wfGetCaller( 2 ) [default] is the caller of the function running wfGetCaller() wfGetCaller( 3 ) is the parent of that.

Parameters
int$level
Returns
string

Definition at line 1085 of file GlobalFunctions.php.

References wfDebugBacktrace(), and wfFormatStackFrame().

Referenced by MediaWiki\StubObject\StubGlobalUser\_unstub(), MediaWiki\StubObject\StubObject\_unstub(), DeferredUpdates\addCallableUpdate(), MWDebug\log(), MWLBFactory\logDeprecation(), MediaWiki\Request\HeaderCallback\warnIfHeadersSent(), wfShellExec(), and wfShellExecWithStderr().

◆ wfGetDB()

wfGetDB ( $db,
$groups = [],
$wiki = false )

Get a Database object.

Parameters
int$dbIndex of the connection to get. May be DB_PRIMARY for the primary (for write queries), DB_REPLICA for potentially lagged read queries, or an integer >= 0 for a particular server.
string | string[]$groupsQuery groups. An array of group names that this query belongs to. May contain a single string if the query is only in one group.
string | false$wikiThe wiki ID, or false for the current wiki

Note: multiple calls to wfGetDB(DB_REPLICA) during the course of one request will always return the same object, unless the underlying connection or load balancer is manually destroyed.

Note 2: use $this->getDB() in maintenance scripts that may be invoked by updater to ensure that a proper database is being updated.

Note 3: When replacing calls to this with calls to methods on an injected LoadBalancer, LoadBalancer::getConnection is more commonly needed than LoadBalancer::getMaintenanceConnectionRef, which is needed for more advanced administrative tasks. See the IMaintainableDatabase and IDatabase interfaces for details.

Deprecated
since 1.39, use LoadBalancer::getConnection() on an injected instance of LoadBalancer instead.
Returns
\Wikimedia\Rdbms\DBConnRef

Definition at line 1873 of file GlobalFunctions.php.

Referenced by MediaWiki\Output\OutputPage\addCategoryLinksToLBAndGetResult(), LogPage\addRelations(), MediaWiki\User\User\addToDatabase(), CheckStorage\check(), MediaWiki\User\User\checkAndSetTouched(), CgzCopyTransaction\commit(), PrefixSearch\defaultSearchBackend(), MediaWiki\Category\CategoryViewer\doCategoryQuery(), WikiPage\doUpdateRestrictions(), MediaWiki\Title\Title\estimateRevisionCount(), MWEval\execute(), RenameRestrictions\execute(), LCStoreDB\get(), ContentHandler\getAutoDeleteReason(), MediaWiki\Title\Title\getBrokenLinksFrom(), WikiPage\getCategories(), RCDatabaseLogEntry\getComment(), WikiPage\getContributors(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\getDB(), MediaWiki\ResourceLoader\WikiModule\getDB(), LocalRepo\getDBFactory(), MediaWiki\Title\Title\getDeletedEditsCount(), WikiPage\getHiddenCategories(), MediaWiki\Title\Title\getLinksFrom(), MediaWiki\Title\Title\getLinksTo(), MediaWiki\Title\Title\getParentCategories(), MediaWiki\Title\Title\getRedirectsHere(), WikiPage\getRedirectTarget(), MediaWiki\Output\OutputPage\getRlClient(), HistoryBlobCurStub\getText(), HistoryBlobStub\getText(), MediaWiki\Title\Title\hasDeletedEdits(), MediaWiki\User\User\idForName(), WikiRevision\importLogItem(), CheckStorage\importRevision(), ManualLogEntry\insert(), WikiPage\insertRedirect(), WikiPage\insertRedirectEntry(), MediaWiki\EditPage\EditPage\internalAttemptSave(), MediaWiki\Title\Title\invalidateCache(), WikiPage\isBatchedDelete(), MediaWiki\Title\Title\isBigDeletion(), WikiPage\isCountable(), MediaWiki\Title\Title\isSingleRevRedirect(), MediaWiki\User\User\load(), MediaWiki\User\User\loadFromCache(), MediaWiki\User\User\loadFromDatabase(), RecentChange\loadFromRow(), WikiPage\lockAndGetLatest(), RecompressTracked\moveTextRow(), RecentChange\newFromConds(), MediaWiki\Title\Title\newFromID(), MediaWiki\Block\DatabaseBlock\newLoad(), ImagePage\openShowImage(), MediaWiki\ResourceLoader\ResourceLoader\preloadModuleInfo(), ManualLogEntry\publish(), RecentChangesUpdateJob\purgeExpiredRows(), ImagePage\queryImageLinks(), RecentChange\reallyMarkPatrolled(), ChangeTagsList\reloadFromPrimary(), ImportReporter\reportPage(), RevisionListBase\reset(), DeleteLinksJob\run(), RecentChange\save(), LogPage\saveContent(), MediaWiki\User\User\saveSettings(), RevDelArchivedFileItem\setBits(), RevDelArchivedRevisionItem\setBits(), RevDelArchiveItem\setBits(), RevDelFileItem\setBits(), RevDelLogItem\setBits(), RevDelRevisionItem\setBits(), Article\showMissingArticle(), Article\showPatrolFooter(), WikiPage\updateCategoryCounts(), and ActivityUpdateJob\updateWatchlistNotification().

◆ wfGetLangObj()

wfGetLangObj ( $langcode = false)

Return a Language object from $langcode.

Deprecated
since 1.41, use MediaWiki\Languages\LanguageFactory::getLanguage instead.
Parameters
Language | string | bool$langcodeEither:
  • a Language object
  • code of the language to get the message for, if it is a valid code create a language for that language, if it is a string but not a valid code then make a basic language object
  • a boolean: if it's false then use the global object for the current user's language (as a fallback for the old parameter functionality), or if it is true then use global object for the wiki's content language.
Returns
Language|StubUserLang

Definition at line 846 of file GlobalFunctions.php.

References $wgLang, $wgLanguageCode, wfDebug(), and wfDeprecated().

◆ wfGetNull()

wfGetNull ( )

Get a platform-independent path to the null file, e.g.

/dev/null

Returns
string

Definition at line 1922 of file GlobalFunctions.php.

References wfIsWindows().

◆ wfGetServerUrl()

wfGetServerUrl ( $proto)

Get the wiki's "server", i.e.

the protocol and host part of the URL, with a protocol specified using a PROTO_* constant as in wfExpandUrl()

Deprecated
since 1.39, use UrlUtils::getServer()
Since
1.32
Parameters
string | int | null$protoOne of the PROTO_* constants.
Returns
string The URL

Definition at line 531 of file GlobalFunctions.php.

References wfGetUrlUtils().

Referenced by MediaWiki\Request\WebRequest\getFullRequestURL().

◆ wfGetUrlUtils()

wfGetUrlUtils ( )
Deprecated
Get a UrlUtils from services, or construct your own
Access: internal
Returns
UrlUtils from services if initialized, otherwise make one from globals

Definition at line 466 of file GlobalFunctions.php.

Referenced by wfExpandIRI(), wfExpandUrl(), wfGetServerUrl(), wfMatchesDomainList(), wfParseUrl(), wfUrlProtocols(), and wfUrlProtocolsWithoutProtRel().

◆ wfHostname()

◆ wfHttpError()

wfHttpError ( $code,
$label,
$desc )

Provide a simple HTTP error.

Parameters
int | string$code
string$label
string$desc

Definition at line 1277 of file GlobalFunctions.php.

References $wgOut.

Referenced by MediaWiki\Specials\SpecialJavaScriptTest\execute(), MediaWiki\Specials\SpecialRunJobs\execute(), and RawAction\getRawText().

◆ wfIniGetBool()

wfIniGetBool ( $setting)

Safety wrapper around ini_get() for boolean settings.

The values returned from ini_get() are pre-normalized for settings set via php.ini or php_flag/php_admin_flag... but not for those set via php_value/php_admin_value.

It's fairly common for people to use php_value instead of php_flag, which can leave you with an 'off' setting giving a false positive for code that just takes the ini_get() return value as a boolean.

To make things extra interesting, setting via php_value accepts "true" and "yes" as true, but php.ini and php_flag consider them false. :) Unrecognized values go false... again opposite PHP's own coercion from string to bool.

Luckily, 'properly' set settings will always come back as '0' or '1', so we only have to worry about them and the 'improper' settings.

I frickin' hate PHP... :P

Parameters
string$setting
Returns
bool

Definition at line 1522 of file GlobalFunctions.php.

References wfStringToBool().

Referenced by MediaWiki\Http\HttpRequestFactory\canMakeRequests(), MWHttpRequest\canMakeRequests(), UploadBase\isEnabled(), and WebInstaller\startSession().

◆ wfIsDebugRawPage()

wfIsDebugRawPage ( )

Returns true if debug logging should be suppressed if $wgDebugRawPage = false.

Returns
bool

Definition at line 686 of file GlobalFunctions.php.

References MW_ENTRY_POINT.

Referenced by MediaWiki\Logger\LegacyLogger\__construct(), and wfDebug().

◆ wfIsInfinity()

wfIsInfinity ( $str)

Determine input string is represents as infinity.

Parameters
string$strThe string to determine
Returns
bool
Since
1.25

Definition at line 2077 of file GlobalFunctions.php.

Referenced by ApiProtect\execute(), MediaWiki\Specials\SpecialUserRights\expiryToTimestamp(), ApiResult\formatExpiry(), BlockLogFormatter\getParametersForApi(), WatchAction\onSuccess(), MediaWiki\Block\BlockUser\parseExpiryInput(), and Language\translateBlockExpiry().

◆ wfLoadExtension()

wfLoadExtension ( $ext,
$path = null )

Load an extension.

This queues an extension to be loaded through the ExtensionRegistry system.

Parameters
string$extName of the extension to load
string | null$pathAbsolute path of where to find the extension.json file
Since
1.25

Definition at line 49 of file GlobalFunctions.php.

References $path, and $wgExtensionDirectory.

◆ wfLoadExtensions()

wfLoadExtensions ( array $exts)

Load multiple extensions at once.

Same as wfLoadExtension, but more efficient if you are loading multiple extensions.

If you want to specify custom paths, you should interact with ExtensionRegistry directly.

See also
wfLoadExtension
Parameters
string[]$extsArray of extension names to load
Since
1.25

Definition at line 70 of file GlobalFunctions.php.

References $ext, and $wgExtensionDirectory.

◆ wfLoadSkin()

wfLoadSkin ( $skin,
$path = null )

Load a skin.

See also
wfLoadExtension
Parameters
string$skinName of the extension to load
string | null$pathAbsolute path of where to find the skin.json file
Since
1.25

Definition at line 86 of file GlobalFunctions.php.

References $path, and $wgStyleDirectory.

◆ wfLoadSkins()

wfLoadSkins ( array $skins)

Load multiple skins at once.

See also
wfLoadExtensions
Parameters
string[]$skinsArray of extension names to load
Since
1.25

Definition at line 101 of file GlobalFunctions.php.

References $wgStyleDirectory.

◆ wfLogDBError()

wfLogDBError ( $text,
array $context = [] )

Log for database errors.

Since
1.25 support for additional context data
Parameters
string$textDatabase error message.
array$contextAdditional logging context data

Definition at line 746 of file GlobalFunctions.php.

◆ wfLogWarning()

wfLogWarning ( $msg,
$callerOffset = 1,
$level = E_USER_WARNING )

Send a warning as a PHP error and the debug log.

This is intended for logging warnings in production. For logging development warnings, use WfWarn instead.

Parameters
string$msgMessage to send
int$callerOffsetNumber of items to go back in the backtrace to find the correct caller (1 = function calling wfLogWarning, ...)
int$levelPHP error level; defaults to E_USER_WARNING

Definition at line 826 of file GlobalFunctions.php.

Referenced by MediaWiki\User\User\__get(), MediaWiki\User\User\__set(), MediaWiki\SpecialPage\ChangesListSpecialPage\areFiltersInConflict(), MediaWiki\Storage\SqlBlobStore\compressData(), Language\convertGrammar(), MediaWiki\Linker\Linker\emailLink(), FormatMetadata\flattenArrayReal(), LogFormatter\formatParametersForApi(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), MediaWiki\Html\Html\inlineScript(), MediaWiki\Output\OutputPage\transformFilePath(), and wfMkdirParents().

◆ wfMatchesDomainList()

wfMatchesDomainList ( $url,
$domains )

Check whether a given URL has a domain that occurs in a given set of domains.

Deprecated
since 1.39, use UrlUtils::expandIRI()
Parameters
string$url
array$domainsArray of domains (strings)
Returns
bool True if the host part of $url ends in one of the strings in $domains

Definition at line 640 of file GlobalFunctions.php.

References wfGetUrlUtils().

Referenced by Skin\addToSidebarPlain(), and Parser\getExternalLinkRel().

◆ wfMemoryLimit()

wfMemoryLimit ( $newLimit)

Raise PHP's memory limit (if needed).

Access: internal
For use by Setup.php
Parameters
int$newLimit

Definition at line 1953 of file GlobalFunctions.php.

References wfDebug(), and wfShorthandToInteger().

◆ wfMerge()

wfMerge ( string $old,
string $mine,
string $yours,
?string & $simplisticMergeAttempt,
string & $mergeLeftovers = null )

wfMerge attempts to merge differences between three texts.

Parameters
string$oldCommon base revision
string$mineThe edit we wish to store but which potentially conflicts with another edit which happened since we started editing.
string$yoursThe most recent stored revision of the article. Note that "mine" and "yours" might have another meaning depending on the specific use case.
string | null&$simplisticMergeAttemptAutomatically merged text, with overlapping edits falling back to "my" text.
string | null&$mergeLeftoversOptional out parameter containing an "ed" script with the remaining bits of "your" text that could not be merged into $simplisticMergeAttempt. The "ed" file format is documented here: https://www.gnu.org/software/diffutils/manual/html_node/Detailed-ed.html
Returns
bool true for a clean merge and false for failure or a conflict.

Definition at line 1692 of file GlobalFunctions.php.

Referenced by TextContentHandler\merge3().

◆ wfMergeErrorArrays()

wfMergeErrorArrays ( $args)

Merge arrays in the style of PermissionManager::getPermissionErrors, with duplicate removal e.g.

wfMergeErrorArrays( [ [ 'x' ] ], [ [ 'x', '2' ] ], [ [ 'x' ] ], [ [ 'y' ] ] ); returns: [ [ 'x', '2' ], [ 'x' ], [ 'y' ] ]

Parameters
array[]...$args
Returns
array

Definition at line 169 of file GlobalFunctions.php.

Referenced by MediaWiki\Specials\SpecialImport\execute().

◆ wfMessage()

wfMessage ( $key,
$params )

This is the function for getting translated interface messages.

See also
Message class for documentation how to use them.
https://www.mediawiki.org/wiki/Manual:Messages_API

This function replaces all old wfMsg* functions.

When the MessageSpecifier object is an instance of Message, a clone of the object is returned. This is unlike the new Message( … ) constructor, which returns a new object constructed from scratch with the same key. This difference is mostly relevant when the passed object is an instance of a subclass like RawMessage or ApiMessage.

Parameters
string | string[] | MessageSpecifier$keyMessage key, or array of keys, or a MessageSpecifier
mixed...$params Normal message parameters
Returns
Message
Since
1.17
See also
Message::__construct

Definition at line 903 of file GlobalFunctions.php.

References Message\newFromSpecifier(), and wfMessageFallback().

Referenced by MediaWiki\Title\MalformedTitleException\__construct(), MessageContent\__construct(), MediaTransformError\__construct(), IncompatibleDiffTypesException\__construct(), HTMLAutoCompleteSelectField\__construct(), HTMLSelectOrOtherField\__construct(), TransformParameterError\__construct(), TransformTooBigImageAreaError\__construct(), UploadStashFile\__construct(), CollapsibleFieldsetLayout\__construct(), MediaWiki\Widget\DateInputWidget\__construct(), MediaWiki\Widget\SizeFilterWidget\__construct(), UploadChunkVerificationException\__construct(), LogPage\actionText(), MediaHandler\addMeta(), WikitextContent\addSectionHeader(), JsonContent\arrayTable(), MediaWiki\Specials\SpecialVersion\arrayToString(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountCreation(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), MediaWiki\Linker\Linker\blockLink(), Parser\braceSubstitution(), MediaWiki\Output\OutputPage\buildBacklinkSubtitle(), Xml\buildForm(), ChangesFeed\buildItems(), MediaWiki\Specials\SpecialEditWatchlist\buildTools(), MediaWiki\SpecialPage\SpecialPage\checkLoginSecurityLevel(), UploadStash\clear(), Language\commaList(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\User\TempUser\TempUserCreator\create(), Installer\createMainpage(), Xml\dateMenu(), MediaWiki\Session\SessionProvider\describe(), MediaWiki\Auth\PasswordAuthenticationRequest\describeCredentials(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\describeCredentials(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\describeCredentials(), MediaWiki\Session\SessionProvider\describeMessage(), UploadBase\detectVirus(), MediaWiki\Block\DatabaseBlock\doAutoblock(), ContentModelChange\doContentModelChange(), MediaWiki\Page\File\FileDeleteForm\doDelete(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), WikiPage\doUpdateRestrictions(), MediaWiki\Linker\Linker\emailLink(), WebInstallerPage\endForm(), WebInstallerInstall\endStage(), Installer\envCheckDB(), WebInstallerComplete\execute(), WebInstallerDBConnect\execute(), WebInstallerExistingWiki\execute(), WebInstallerInstall\execute(), WebInstallerName\execute(), WebInstallerRestart\execute(), WebInstallerUpgrade\execute(), WebInstallerWelcome\execute(), CleanupSpam\execute(), DumpIterator\execute(), DumpMessages\execute(), DumpRenderer\execute(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(), MediaWiki\ResourceLoader\MessageBlobStore\fetchMessage(), DeleteEqualMessages\fetchMessageInfo(), FallbackContentHandler\fillParserOutput(), JsonContentHandler\fillParserOutput(), ChangesList\flag(), BlockLogFormatter\formatBlockFlag(), BlockLogFormatter\formatBlockFlags(), MediaWiki\Feed\FeedUtils\formatDiff(), MediaWiki\Feed\FeedUtils\formatDiffRow2(), Language\formatDuration(), LanguageZh_hans\formatDuration(), WikiPage\formatExpiry(), MediaWiki\Linker\Linker\formatHiddenCategories(), MediaWiki\Linker\Linker\formatRevisionSize(), File\generateAndSaveThumb(), ContentHandler\getAutoDeleteReason(), ContentHandler\getAutosummary(), WebInstallerOptions\getCCDoneBox(), WebInstaller\getCheckBox(), MysqlInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), MediaWiki\Specials\SpecialVersion\getCopyrightAndAuthorList(), Interwiki\getDescription(), LogPage\getDescription(), MediaWiki\Config\ConfigRepository\getDescriptionOf(), MediaWiki\Feed\FeedUtils\getDiffLink(), ImageHandler\getDimensionsString(), MediaWiki\Title\Title\getEditNotices(), MediaWiki\Specials\SpecialUpload\getExistsWarning(), MediaWiki\Specials\SpecialVersion\getExtensionTypes(), MediaWiki\Auth\ConfirmLinkAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\CreationReasonAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\RememberMeAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UsernameAuthenticationRequest\getFieldInfo(), WebInstallerPage\getFieldsetStart(), UploadStash\getFile(), WebInstallerDocument\getFileContents(), UploadBase\getFilenamePrefixBlacklist(), IcuCollation\getFirstLetter(), NumericUppercaseCollation\getFirstLetter(), MediaHandler\getGeneralLongDesc(), MediaWiki\User\UserGroupMembership\getGroupPage(), WebInstaller\getHelpBox(), WebInstaller\getInfoBox(), MediaWiki\Specials\SpecialUpload\getInitialPageText(), DatabaseInstaller\getInstallUserBox(), LogFormatter\getIRCActionComment(), LogFormatter\getIRCActionText(), ContentHandler\getLocalizedName(), ImageHandler\getLongDesc(), SvgHandler\getLongDesc(), GIFHandler\getLongDesc(), PNGHandler\getLongDesc(), Licenses\getMessageFromParams(), ErrorPageError\getMessageObject(), MediaWiki\Title\MalformedTitleException\getMessageObject(), CliInstaller\getMessageText(), Interwiki\getName(), LogPage\getName(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getPasswordResetData(), MediaWiki\EditPage\EditPage\getPreviewLimitReport(), WebInstaller\getRadioElements(), LogPage\getRcComment(), LogPage\getRcCommentIRC(), DatabaseInstaller\getReadableName(), MediaWiki\Block\DatabaseBlock\getRedactedName(), MediaWiki\Utils\MWTimestamp\getRelativeTimestamp(), MediaWiki\User\User\getRightDescription(), ImageHandler\getShortDesc(), MediaWiki\Specials\SpecialBlock\getSuggestedDurations(), MediaWiki\Utils\MWTimestamp\getTimezoneMessage(), MediaWiki\Category\TrackingCategories\getTrackingCategories(), Parser\getUserSig(), Language\getVariantname(), MediaWiki\Specials\SpecialVersion\getVersion(), FormatMetadata\getVisibleFields(), DatabaseInstaller\getWebUserBox(), PageDataRequestHandler\handleRequest(), MediaWiki\Title\Title\hasSourceText(), QuickTemplate\haveMsg(), PageDataRequestHandler\httpContentNegotiation(), UploadStash\initFile(), WikiPage\insertNullProtectionRevision(), DifferenceEngine\intermediateEditsMsg(), Parser\interwikiTransclude(), CoreParserFunctions\intFunction(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), MediaWiki\Page\MovePage\isValidMove(), WebInstaller\label(), Xml\languageSelector(), UploadStash\listFiles(), MediaWiki\User\BotPassword\login(), MediaWiki\Linker\LinkRenderer\makeBrokenLink(), WebInstaller\makeDownloadLinkHtml(), MediaWiki\Linker\Linker\makeImageLink(), ApiBase\makeMessage(), MediaWiki\Linker\LinkRenderer\makeRedirectHeader(), SkinTemplate\makeSearchButtonInternal(), MediaWiki\Linker\Linker\makeThumbLink2(), MediaWiki\Page\MergeHistory\merge(), Xml\monthSelector(), MWException\msg(), DerivativeContext\msg(), RequestContext\msg(), HTMLFormField\msg(), QuickTemplate\msg(), SearchEngineConfig\namespacesAsText(), MediaWiki\Html\Html\namespaceSelectorOptions(), MediaWiki\Title\Title\newMainPage(), WikiImporter\notice(), JsonContent\objectTable(), RawAction\onView(), WebInstallerOutput\outputFooter(), WebInstallerOutput\outputTitle(), FormatJson\parse(), ConverterRule\parse(), SearchEngine\parseNamespacePrefixes(), Language\pipeList(), WikiPage\protectDescription(), TextPassDumper\readDump(), LanguageConverter\recursiveConvertRule(), UploadStash\removeFile(), WikitextContent\replaceSection(), MediaWiki\Linker\Linker\revDeleteLink(), MediaWiki\Linker\Linker\revDeleteLinkDisabled(), MediaWiki\Linker\Linker\revUserLink(), MediaWiki\Linker\Linker\revUserTools(), DoubleRedirectJob\run(), MediaWiki\Storage\PageUpdater\saveRevision(), Language\semicolonList(), MediaWiki\User\User\sendConfirmationMail(), MediaWiki\User\User\sendMail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendNewAccountEmail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendPasswordResetEmail(), MediaWiki\User\User\setEmailWithConfirmation(), WikiImporter\setTargetRootPage(), WebInstallerUpgrade\showDoneMessage(), WebInstaller\showError(), WebInstallerExistingWiki\showKeyForm(), WebInstaller\showMessage(), MediaWiki\Linker\Linker\specialLink(), WebInstallerInstall\startStage(), UploadStash\stashFile(), Parser\statelessFetchTemplate(), WebInstallerName\submit(), WebInstallerOptions\submit(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAuthentication(), MediaWiki\Linker\Linker\tocList(), TraditionalImageGallery\toHTML(), File\transform(), File\transformErrorOutput(), BitmapHandler\transformGd(), Language\truncateHtml(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset(), MediaWiki\Storage\PageUpdater\updateRevision(), MediaWiki\Linker\Linker\userLink(), MediaWiki\Linker\Linker\userTalkLink(), MediaWiki\Linker\Linker\userToolLinks(), Article\view(), wfForbidden(), wfGenerateThumbnail(), wfOpenSearchDescMain(), wfStreamThumb(), MediaWiki\Session\CookieSessionProvider\whyNoSession(), MediaWiki\Session\ImmutableSessionProviderWithCookie\whyNoSession(), and MediaWiki\CommentFormatter\CommentFormatter\wrapCommentWithBlock().

◆ wfMessageFallback()

wfMessageFallback ( $keys)

This function accepts multiple message keys and returns a message instance for the first message which is non-empty.

If all messages are empty then an instance of the last message key is returned.

Parameters
string...$keys Message keys
Returns
Message
Since
1.18
See also
Message::newFallbackSequence

Definition at line 931 of file GlobalFunctions.php.

References Message\newFallbackSequence().

Referenced by FileRepo\getDisplayName(), ImagePage\openShowImage(), SkinTemplate\tabAction(), and wfMessage().

◆ wfMkdirParents()

wfMkdirParents ( $dir,
$mode = null,
$caller = null )

Make directory, and make all parent directories if they don't exist.

Parameters
string$dirFull path to directory to create
int | null$modeChmod value to use, default is $wgDirectoryMode
string | null$callerOptional caller param for debugging.
Exceptions
MWException
Returns
bool

Definition at line 1427 of file GlobalFunctions.php.

References $wgDirectoryMode, FileBackend\isStoragePath(), wfDebug(), and wfLogWarning().

Referenced by FileCacheBase\checkCacheDirs(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), GenerateSitemap\execute(), MediaWiki\Utils\GitInfo\precomputeValues(), MediaWiki\ResourceLoader\ForeignResourceManager\run(), LCStoreCDB\startWrite(), and LCStoreStaticArray\startWrite().

◆ wfMsgReplaceArgs()

wfMsgReplaceArgs ( $message,
$args )

Replace message parameter keys on the given formatted output.

Parameters
string$message
array$args
Returns
string
Access: internal

Definition at line 943 of file GlobalFunctions.php.

Referenced by MWException\msg().

◆ wfObjectToArray()

wfObjectToArray ( $objOrArray,
$recursive = true )

Recursively converts the parameter (an object) to an array with the same data.

@phpcs:ignore MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam

Parameters
object | array$objOrArray
bool$recursive
Returns
array

Definition at line 223 of file GlobalFunctions.php.

References wfObjectToArray().

Referenced by wfObjectToArray().

◆ wfParseUrl()

wfParseUrl ( $url)

parse_url() work-alike, but non-broken.

Differences:

1) Handles protocols that don't use :// (e.g., mailto: and news:, as well as protocol-relative URLs) correctly. 2) Adds a "delimiter" element to the array (see (2)). 3) Verifies that the protocol is on the $wgUrlProtocols allowed list. 4) Rejects some invalid URLs that parse_url doesn't, e.g. the empty string or URLs starting with a line feed character.

Deprecated
since 1.39, use UrlUtils::parse()
Parameters
string$urlA URL to parse
Returns
string[]|false Bits of the URL in an associative array, or false on failure. Possible fields:
  • scheme: URI scheme (protocol), e.g. 'http', 'mailto'. Lowercase, always present, but can be an empty string for protocol-relative URLs.
  • delimiter: either '://', ':' or '//'. Always present.
  • host: domain name / IP. Always present, but could be an empty string, e.g. for file: URLs.
  • port: port number. Will be missing when port is not explicitly specified.
  • user: user name, e.g. for HTTP Basic auth URLs such as http://user:pass@example.com/ Missing when there is no username.
  • pass: password, same as above.
  • path: path including the leading /. Will be missing when empty (e.g. 'http://example.com')
  • query: query string (as a string; see wfCgiToArray() for parsing it), can be missing.
  • fragment: the part after #, can be missing.

Definition at line 615 of file GlobalFunctions.php.

References wfGetUrlUtils().

Referenced by MWHttpRequest\__construct(), ParsoidVirtualRESTService\__construct(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiLinkAccount\execute(), DeleteSelfExternals\execute(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\generateIconFromFavicon(), MediaWiki\WikiMap\WikiMap\getCanonicalServerInfoForAllWikis(), MediaWiki\WikiMap\WikiMap\getWikiFromUrl(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\headerHtml(), ThumbnailRenderJob\hitThumbUrl(), UploadFromUrl\isAllowedHost(), MediaWiki\ExternalLinks\LinkFilter\makeIndexes(), MediaWiki\ExternalLinks\LinkFilter\makeLikeArray(), MediaWiki\ExternalLinks\LinkFilter\reverseIndexes(), RedisPubSubFeedEngine\send(), and MWHttpRequest\setReverseProxy().

◆ wfPercent()

wfPercent ( $nr,
int $acc = 2,
bool $round = true )
Parameters
float | int$nrThe number to format
int$accThe number of digits after the decimal point, default 2
bool$roundWhether or not to round the value, default true
Returns
string

Definition at line 1493 of file GlobalFunctions.php.

◆ wfRandom()

wfRandom ( )

Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for any realistic number of articles.

Note
This is designed for use in relation to Special:RandomPage and the page_random database field.
Returns
string

Definition at line 249 of file GlobalFunctions.php.

Referenced by CompareParserCache\execute(), ResetPageRandom\execute(), MediaWiki\Specials\SpecialRandomInCategory\getRandomTitle(), MediaWiki\Specials\SpecialRandomPage\getRandomTitle(), WikiPage\insertOn(), and ApiQueryRandom\run().

◆ wfRandomString()

wfRandomString ( $length = 32)

Get a random string containing a number of pseudo-random hex characters.

Note
This is not secure, if you are trying to generate some sort of token please use MWCryptRand instead.
Parameters
int$lengthThe length of the string to generate
Returns
string
Since
1.20

Definition at line 267 of file GlobalFunctions.php.

Referenced by JobQueueDB\doPop(), SvgHandler\doTransform(), BenchmarkLruHash\execute(), BenchmarkSanitizer\execute(), MakeTestEdits\execute(), MediaWiki\Http\Telemetry\getRequestId(), BenchmarkTitleValue\randomize(), and UploadSourceAdapter\registerSource().

◆ wfRecursiveRemoveDir()

wfRecursiveRemoveDir ( $dir)

Remove a directory and all its content.

Does not hide error.

Parameters
string$dir

Definition at line 1470 of file GlobalFunctions.php.

References wfRecursiveRemoveDir().

Referenced by MediaWiki\ResourceLoader\ForeignResourceManager\run(), and wfRecursiveRemoveDir().

◆ wfRelativePath()

wfRelativePath ( $path,
$from )

Generate a relative path name to the given file.

May explode on non-matching case-insensitive paths, funky symlinks, etc.

Parameters
string$pathAbsolute destination path including target filename
string$fromAbsolute source path, directory only
Returns
string

Definition at line 1806 of file GlobalFunctions.php.

References $path, and wfBaseName().

◆ wfRemoveDotSegments()

wfRemoveDotSegments ( $urlPath)

Remove all dot-segments in the provided URL path.

For example, '/a/./b/../c/' becomes '/a/c/'. For details on the algorithm, please see RFC3986 section 5.2.4.

Deprecated
since 1.39, use UrlUtils::removeDotSegments()
Since
1.19
Parameters
string$urlPathURL path, potentially containing dot-segments
Returns
string URL path with all dot-segments removed

Definition at line 561 of file GlobalFunctions.php.

Referenced by MediaWiki\Request\PathRouter\parse().

◆ wfReportTime()

wfReportTime ( $nonce = null,
$triggerWarnings = true )

Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'.

If $wgShowHostnames is true, the script will also set 'wgHostname' to the hostname of the server handling the request.

Deprecated
since 1.40
Parameters
string | null$nonceUnused
bool$triggerWarningsintroduced in 1.41 whether to trigger deprecation notice.
Returns
string|WrappedString HTML

Definition at line 993 of file GlobalFunctions.php.

References $wgShowHostnames, wfDeprecated(), and wfHostname().

Referenced by SkinTemplate\prepareQuickTemplate().

◆ wfResetOutputBuffers()

wfResetOutputBuffers ( $resetGzipEncoding = true)

Clear away any user-level output buffers, discarding contents.

Suitable for 'starting afresh', for instance when streaming relatively large amounts of data without buffering, or wanting to output image files without ob_gzhandler's compression.

The optional $resetGzipEncoding parameter controls suppression of the Content-Encoding header sent by ob_gzhandler; by default it is left. This should be used for HTTP 304 responses, where you need to preserve the Content-Encoding header of the real result, but also need to suppress the output of ob_gzhandler to keep to spec and avoid breaking Firefox in rare cases where the headers and body are broken over two packets.

Note that some PHP configuration options may add output buffer layers which cannot be removed; these are left in place.

Parameters
bool$resetGzipEncoding

Definition at line 1320 of file GlobalFunctions.php.

Referenced by ApiMain\checkConditionalRequestHeaders(), MediaWiki\Output\OutputPage\checkLastModified(), MediaWiki\Specials\SpecialExport\execute(), and MediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().

◆ wfScript()

◆ wfSetBit()

wfSetBit ( & $dest,
$bit,
$state = true )

As for wfSetVar except setting a bit.

Parameters
int&$dest
int$bit
bool$state
Returns
bool

Definition at line 1242 of file GlobalFunctions.php.

◆ wfSetVar()

◆ wfShellExec()

wfShellExec ( $cmd,
& $retval = null,
$environ = [],
$limits = [],
$options = [] )

Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.

Parameters
string | string[]$cmdIf string, a properly shell-escaped command line, or an array of unescaped arguments, in which case each value will be escaped Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'"
null | mixed&$retvalOptional, will receive the program's exit code. (non-zero is usually failure). If there is an error from read, select, or proc_open(), this will be set to -1.
array$environOptional environment variables which should be added to the executed command environment.
array$limitsOptional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits.
array$optionsArray of options:
  • duplicateStderr: Set this to true to duplicate stderr to stdout, including errors from limit.sh
  • profileMethod: By default this function will profile based on the calling method. Set this to a string for an alternative method to profile from
Returns
string Collected stdout as a string
Deprecated
since 1.30 use class MediaWiki\Shell\Shell

Definition at line 1588 of file GlobalFunctions.php.

References wfGetCaller().

Referenced by DjVuHandler\doTransform(), DjVuImage\retrieveMetaData(), and wfShellExecWithStderr().

◆ wfShellExecWithStderr()

wfShellExecWithStderr ( $cmd,
& $retval = null,
$environ = [],
$limits = [] )

Execute a shell command, returning both stdout and stderr.

Convenience function, as all the arguments to wfShellExec can become unwieldy.

Note
This also includes errors from limit.sh, e.g. if $wgMaxShellFileSize is exceeded.
Parameters
string | string[]$cmdIf string, a properly shell-escaped command line, or an array of unescaped arguments, in which case each value will be escaped Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'"
null | mixed&$retvalOptional, will receive the program's exit code. (non-zero is usually failure)
array$environOptional environment variables which should be added to the executed command environment.
array$limitsOptional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits.
Returns
string Collected stdout and stderr as a string
Deprecated
since 1.30 use class MediaWiki\Shell\Shell

Definition at line 1641 of file GlobalFunctions.php.

References wfGetCaller(), and wfShellExec().

Referenced by UploadBase\detectVirus(), TransformationalImageHandler\getMagickVersion(), SvgHandler\rasterize(), BitmapHandler\rotate(), BitmapHandler\transformCustom(), and BitmapHandler\transformImageMagick().

◆ wfShellWikiCmd()

wfShellWikiCmd ( $script,
array $parameters = [],
array $options = [] )

Generate a shell-escaped command line string to run a MediaWiki cli script.

Note that $parameters should be a flat array and an option with an argument should consist of two consecutive items in the array (do not use "--option value").

Deprecated
since 1.31, use Shell::makeScriptCommand()
Parameters
string$scriptMediaWiki cli script path
array$parametersArguments and options to the script
array$optionsAssociative array of options: 'php': The path to the php executable 'wrapper': Path to a PHP wrapper to handle the maintenance script
Returns
string

Definition at line 1661 of file GlobalFunctions.php.

References $wgPhpCli.

Referenced by CleanupSpam\execute().

◆ wfShorthandToInteger()

wfShorthandToInteger ( ?string $string = '',
int $default = -1 )

Converts shorthand byte notation to integer form.

Parameters
null | string$string
int$defaultReturned if $string is empty
Returns
int

Definition at line 2010 of file GlobalFunctions.php.

Referenced by Installer\envCheckMemory(), UploadBase\getMaxPhpUploadSize(), ApiUpload\getMinUploadChunkSize(), MediaWiki\Request\WebRequestUpload\isIniSizeOverflow(), and wfMemoryLimit().

◆ wfStringToBool()

wfStringToBool ( $val)

Convert string value to boolean, when the following are interpreted as true:

  • on
  • true
  • yes
  • Any number, except 0 All other strings are interpreted as false.
Parameters
string$val
Returns
bool
Since
1.31

Definition at line 1538 of file GlobalFunctions.php.

Referenced by wfIniGetBool().

◆ wfStripIllegalFilenameChars()

wfStripIllegalFilenameChars ( $name)

Replace all invalid characters with '-'.

Additional characters can be defined in $wgIllegalFileChars (see T22489). By default, $wgIllegalFileChars includes ':', '/', '\'.

Parameters
string$nameFilename to process
Returns
string

Definition at line 1934 of file GlobalFunctions.php.

References $wgIllegalFileChars, and wfBaseName().

Referenced by UploadBase\getTitle(), and MediaWiki\Page\MovePage\isValidFileMove().

◆ wfTempDir()

wfTempDir ( )

Tries to get the system directory for temporary files.

First $wgTmpDirectory is checked, and then the TMPDIR, TMP, and TEMP environment variables are then checked in sequence, then sys_get_temp_dir(), then upload_tmp_dir from php.ini.

NOTE: When possible, use instead the tmpfile() function to create temporary files to avoid race conditions on file creation, etc.

Returns
string

Definition at line 1408 of file GlobalFunctions.php.

References $wgTmpDirectory.

Referenced by SvgHandler\doTransform(), ImportableUploadRevisionImporter\downloadSource(), MWDocGen\execute(), MediaWikiShell\execute(), and MediaWiki\ResourceLoader\Image\rasterize().

◆ wfThumbIsStandard()

wfThumbIsStandard ( File $file,
array $params )

Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output.

$params is considered non-standard if they involve a non-standard width or any non-default parameters aside from width and page number. The number of possible files with standard parameters is far less than that of all combinations; rate-limiting for them can thus be more generous.

Parameters
File$file
array$params
Returns
bool
Since
1.24 Moved from thumb.php to GlobalFunctions in 1.25

Definition at line 2096 of file GlobalFunctions.php.

References $file, $wgImageLimits, $wgResponsiveImages, and $wgThumbLimits.

Referenced by wfStreamThumb().

◆ wfTimestamp()

wfTimestamp ( $outputtype = TS_UNIX,
$ts = 0 )

Get a timestamp string in one of various formats.

Parameters
mixed$outputtypeOutput format, one of the TS_* constants. Defaults to Unix timestamp.
mixed$tsA timestamp in any supported format. The function will autodetect which format is supplied and act accordingly. Use 0 or omit to use current time
Returns
string|false The date in the specified format, or false on error.

Definition at line 1364 of file GlobalFunctions.php.

References wfDebug().

Referenced by MediaWiki\Block\AbstractBlock\__construct(), MediaWiki\Output\OutputPage\adaptCdnTTL(), DumpCategoriesAsRdf\addDumpHeader(), ApiMain\addRequestedFields(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendGeneralInfo(), MediaWiki\SpecialPage\ChangesListSpecialPage\buildQuery(), FileCacheBase\cacheTimestamp(), MediaWiki\Storage\PageEditStash\checkCache(), ApiMain\checkConditionalRequestHeaders(), MediaWiki\Output\OutputPage\checkLastModified(), MediaWiki\User\User\confirmationToken(), Language\date(), LanguageWa\date(), DifferenceEngine\debug(), MediaWiki\Specials\SpecialExport\execute(), ApiEditPage\execute(), ApiFeedWatchlist\execute(), ApiMergeHistory\execute(), ApiProtect\execute(), ApiQueryAllUsers\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiSetNotificationTimestamp\execute(), ApiUndelete\execute(), LocalFileRestoreBatch\execute(), BenchmarkParse\execute(), CleanupUploadStash\execute(), FixTimestamps\execute(), GenerateSitemap\execute(), ImportTextFiles\execute(), RemoveUnusedAccounts\execute(), TestCompression\execute(), UpdateSearchIndex\execute(), MediaWiki\Specials\SpecialUserRights\expiryToTimestamp(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryRecentChanges\extractRowInfo(), RepoGroup\findFile(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Feed\FeedUtils\formatDiff(), Language\formatExpiry(), ApiResult\formatExpiry(), LogFormatter\formatParameterValueForApi(), MediaWiki\Specials\SpecialUndelete\formatRevisionRow(), MediaWiki\Pager\MergeHistoryPager\formatRow(), MediaWiki\Pager\ImageListPager\formatValue(), RevDelArchivedFileItem\getApiData(), RevDelFileItem\getApiData(), RevDelRevisionItem\getApiData(), MediaWiki\Block\DatabaseBlock\getAutoblockExpiry(), NewUsersLogFormatter\getComment(), ApiQueryUserInfo\getCurrentUserInfo(), LocalFile\getDescriptionTouched(), MediaWiki\User\User\getExperienceLevel(), FormatMetadata\getExtendedMetadataFromFile(), MediaWiki\User\Registration\UserRegistrationLookup\getFirstRegistration(), ApiQueryImageInfo\getInfo(), MediaWiki\Specials\SpecialActiveUsers\getIntroText(), LogFormatter\getIRCActionText(), MediaWiki\Output\OutputPage\getJSVars(), MachineReadableRCFeedFormatter\getLine(), BlockLogFormatter\getMessageParameters(), PNGMetadataExtractor\getMetadata(), MediaWiki\Specials\SpecialRandomInCategory\getMinAndMaxForCat(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), BlockLogFormatter\getParametersForApi(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), MediaWiki\Pager\ActiveUsersPager\getQueryInfo(), RawAction\getRawText(), ImageHistoryList\getThumbForLine(), ForeignAPIRepo\getThumbUrlFromCache(), ArchivedFile\getTimestamp(), ForeignAPIFile\getTimestamp(), DatabaseLogEntry\getTimestamp(), ManualLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), RevisionItemBase\getTimestamp(), MediaWiki\User\User\getTouched(), ForeignAPIRepo\httpGet(), ImageHistoryList\imageHistoryLine(), MediaWiki\Block\DatabaseBlock\initFromRow(), MediaWiki\User\User\isEmailConfirmationPending(), RecentChange\isInRCLifespan(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), MediaWiki\User\User\loadDefaults(), MediaWiki\User\User\loadFromCache(), RecentChange\loadFromRow(), MediaWiki\User\User\loadFromRow(), LocalFile\loadFromRow(), ApiMain\logRequest(), GenerateSitemap\main(), FormatMetadata\makeFormattedData(), MediaWiki\Session\Token\match(), MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(), MediaWiki\Output\OutputPage\output(), MediaWiki\Specials\SpecialRecentChanges\outputChangesList(), MediaWiki\Storage\PageEditStash\parseAndCache(), MediaWiki\Block\BlockUser\parseExpiryInput(), TableCleanup\progress(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), LocalFile\publishTo(), MediaWiki\SpecialPage\QueryPage\recache(), ApiQueryQueryPage\run(), CategoryMembershipChangeJob\run(), ApiMain\sendCacheHeaders(), MediaWiki\Output\OutputPage\setLastModified(), WikiRevision\setTimestamp(), BackupDumper\showReport(), TextPassDumper\showReport(), Language\time(), Language\timeanddate(), MediaWiki\Session\Token\toString(), ApiUpload\transformWarnings(), RecentChangesUpdateJob\updateActiveUsers(), MediaWiki\Block\DatabaseBlock\updateTimestamp(), CategoryChangesAsRdf\updateTS(), wfApiMain(), wfStreamThumb(), wfTimestampOrNull(), and XmlDumpWriter\writeTimestamp().

◆ wfTimestampNow()

wfTimestampNow ( )

◆ wfTimestampOrNull()

◆ wfTransactionalTimeLimit()

wfTransactionalTimeLimit ( )

Raise the request time limit to $wgTransactionalTimeLimit.

Returns
int Prior time limit
Since
1.26

Definition at line 1980 of file GlobalFunctions.php.

References $wgTransactionalTimeLimit.

Referenced by Action\useTransactionalTimeLimit(), ApiBase\useTransactionalTimeLimit(), and MediaWiki\SpecialPage\SpecialPage\useTransactionalTimeLimit().

◆ wfUnpack()

wfUnpack ( $format,
$data,
$length = false )

Wrapper around php's unpack.

Parameters
string$formatThe format string (See php's docs)
string$dataA binary string of binary data
int | bool$lengthThe minimum length of $data or false. This is to prevent reading beyond the end of $data. false to disable the check.

Also be careful when using this function to read unsigned 32 bit integer because php might make it negative.

Exceptions
MWExceptionIf $data not long enough, or if unpack fails
Returns
array Associative array of the extracted data

Definition at line 2048 of file GlobalFunctions.php.

Referenced by JpegMetadataExtractor\doPSIR(), BmpHandler\getSizeAndMetadata(), and JpegMetadataExtractor\segmentSplitter().

◆ wfUrlencode()

wfUrlencode ( $s)

We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default.

According to RFC 1738, all of the following should be safe:

;:&=$-_.+!*'(),

RFC 1738 says ~ is unsafe, however RFC 3986 considers it an unreserved character which should not be encoded. More importantly, google chrome always converts %7E back to ~, and converting it in this function can cause a redirect loop (T105265).

But + is not safe because it's used to indicate a space; &= are only safe in paths and not in queries (and we don't distinguish here); ' seems kind of scary; and urlencode() doesn't touch -_. to begin with. Plus, although / is reserved, we don't care. So the list we unescape is:

;:$!*(),/~

However, IIS7 redirects fail when the url contains a colon (see T24709), so no fancy : for IIS7.

%2F in the page titles seems to fatally break for some reason.

Parameters
string$s
Returns
string

Definition at line 302 of file GlobalFunctions.php.

Referenced by MediaWiki\Title\Title\__wakeup(), MediaWiki\Output\OutputPage\addHelpLink(), CoreParserFunctions\basepagenamee(), FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), MediaWiki\Title\Title\getLocalURL(), MediaWikiSite\getPageUrl(), MediaWiki\Title\Title\getPrefixedURL(), MediaWiki\SpecialPage\LoginSignupSpecialPage\getReturnToQueryStringFragment(), MediaWiki\Title\Title\getSubpageUrlForm(), ParserOutput\getText(), Interwiki\getURL(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), MediaWiki\Title\Title\makeTitle(), CoreParserFunctions\namespacee(), CoreParserFunctions\nse(), CoreParserFunctions\rootpagenamee(), CoreParserFunctions\speciale(), CoreParserFunctions\subjectspacee(), and CoreParserFunctions\talkspacee().

◆ wfUrlProtocols()

wfUrlProtocols ( $includeProtocolRelative = true)

Returns a regular expression of url protocols.

Deprecated
since 1.39, use UrlUtils::validProtocols()
Parameters
bool$includeProtocolRelativeIf false, remove '//' from the returned protocol list. DO NOT USE this directly, use wfUrlProtocolsWithoutProtRel() instead
Returns
string

Definition at line 573 of file GlobalFunctions.php.

References wfGetUrlUtils().

Referenced by Skin\addToSidebarPlain(), Skin\makeInternalOrExternalUrl(), MediaWiki\Parser\Sanitizer\safeEncodeAttribute(), and MediaWiki\Parser\Sanitizer\validateAttributes().

◆ wfUrlProtocolsWithoutProtRel()

wfUrlProtocolsWithoutProtRel ( )

Like wfUrlProtocols(), but excludes '//' from the protocol list.

Use this if you need a regex that matches all URL protocols but does not match protocol- relative URLs

Deprecated
since 1.39, use UrlUtils::validAbsoluteProtocols()
Returns
string

Definition at line 585 of file GlobalFunctions.php.

References wfGetUrlUtils().

◆ wfVarDump()

wfVarDump ( $var)

A wrapper around the PHP function var_export().

Either print it or add it to the regular output ($wgOut).

Parameters
mixed$varA PHP variable to dump.

Definition at line 1260 of file GlobalFunctions.php.

References $wgOut.

◆ wfWarn()

wfWarn ( $msg,
$callerOffset = 1,
$level = E_USER_NOTICE )

Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.

To log warnings in production, use wfLogWarning() instead.

Parameters
string$msgMessage to send
int$callerOffsetNumber of items to go back in the backtrace to find the correct caller (1 = function calling wfWarn, ...)
int$levelPHP error level; defaults to E_USER_NOTICE; only used when $wgDevelopmentWarnings is true

Definition at line 813 of file GlobalFunctions.php.

Referenced by Exif\__construct(), TextContent\__construct(), MediaWiki\Storage\SqlBlobStore\decompressData(), RecentChange\doMarkPatrolled(), ApiEditPage\execute(), ForeignAPIRepo\fileExistsBatch(), MediaWiki\Pager\ContribsPager\getExtraSortFields(), MediaWiki\Pager\ContribsPager\getIndexField(), MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(), Language\getMagic(), MediaWiki\Revision\SlotRoleRegistry\getRoleHandler(), MediaWiki\Linker\Linker\link(), MediaWiki\Html\Html\linkedScript(), MediaWiki\Linker\Linker\makeBrokenImageLinkObj(), MediaWiki\Html\Html\openElement(), and BacklinkJobUtils\partitionBacklinkJob().