Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
Functions
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 ofwfArrayToCgi(): 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 ( $input)
 Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
 
 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 thewfGetCaller() call (ie.
 
 wfGetNull ()
 Get a platform-independent path to the null file, e.g.
 
 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.
 
 wfResetOutputBuffers ( $resetGzipEncoding=true)
 Clear away any user-level output buffers, discarding contents.
 
 wfScript ( $script='index')
 Get the URL path to aMediaWiki 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 aMediaWiki 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 thatMediaWiki 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; returnsMediaWiki 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.
 
 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 partial regular expression of recognized URL protocols, e.g.
 
 wfUrlProtocolsWithoutProtRel ()
 LikewfUrlProtocols(), 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.

Note
GPL-2.0-or-later

Definition in fileGlobalFunctions.php.

Function Documentation

◆ wfAppendQuery()

wfAppendQuery($url,
$query )

Append a query string to an existing URL, which may or may not already have query string parameters already.

If so, they will be combined.

Parameters
string$url
string | array$queryString or associative array
Returns
string

Definition at line428 of fileGlobalFunctions.php.

References$url, andwfArrayToCgi().

Referenced byMediaWiki\SpecialPage\SpecialPage\addFeedLinks(),MediaWiki\Specials\SpecialRedirect\dispatchLog(),MediaWiki\Specials\SpecialRedirect\dispatchPage(),MediaWiki\Specials\SpecialRedirect\dispatchRevision(),MediaWiki\SpecialPage\ContributionsSpecialPage\execute(),MediaWiki\Specials\SpecialApiHelp\execute(),MediaWiki\SpecialPage\LoginSignupSpecialPage\execute(),MediaWiki\SpecialPage\RedirectSpecialPage\execute(),MediaWiki\Specials\SpecialRecentChanges\execute(),MediaWiki\Api\ApiEntryPoint\execute(),ImportSiteScripts\execute(),MediaWiki\Api\ApiHelp\fixHelpLinks(),MediaWiki\FileRepo\FileRepo\getDescriptionRenderUrl(),MediaWiki\FileRepo\File\File\getFilePageThumbUrl(),MediaWiki\Output\OutputPage\getHeadLinksArray(),MediaWiki\Title\Title\getLocalURL(),ImageHandler\getScriptedTransform(),MediaWiki\Linker\Linker\getUploadUrl(),MediaWiki\ResourceLoader\Image\getUrl(),MediaWiki\FileRepo\ForeignAPIRepo\httpGetCached(),MediaWiki\Linker\Linker\makeThumbLink2(),MediaWiki\FileRepo\FileRepo\makeUrl(),ImportStreamSource\newFromInterwiki(), andMediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName().

◆ wfArrayDiff2()

wfArrayDiff2($arr1,
$arr2 )

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

Deprecated
since 1.43 Use StatusValue::merge() instead
Parameters
string[] | array[]$arr1
string[] | array[]$arr2
Returns
array

Definition at line109 of fileGlobalFunctions.php.

ReferenceswfDeprecated().

◆ 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 line192 of fileGlobalFunctions.php.

Referenced byMediaWiki\Api\ApiComparePages\getAllowedParams(),MediaWiki\Specials\SpecialDeletedContributions\getUserLinks(),MediaWiki\Skin\SkinTemplate\injectLegacyMenusIntoPersonalTools(), andUpdateExtensionJsonSchema\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 line2024 of fileGlobalFunctions.php.

Referenced byMediaWiki\HTMLForm\Field\HTMLUserTextField\__construct(), andMediaWiki\Registration\ExtensionRegistry\exportExtractedData().

◆ wfArrayToCgi()

wfArrayToCgi($array1,
$array2 =null,
$prefix ='' )

This function takes one or two arrays as input, and returns a CGI-style string, e.g.

"days=7&limit=100". Options in the first array override options in the second. Options set to null or false will not be output.

Parameters
array$array1( String|Array )
array | null$array2( String|Array )
string$prefix
Returns
string

Definition at line336 of fileGlobalFunctions.php.

ReferenceswfArrayToCgi().

Referenced byMediaWiki\Request\WebRequest\appendQueryArray(),MediaWiki\SpecialPage\SpecialPage\checkLoginSecurityLevel(),MediaWiki\Specials\SpecialNewPages\execute(),PopulateInterwiki\fetchLinks(),MediaWiki\Specials\Pager\AllMessagesTablePager\formatValue(),MediaWiki\Title\Title\getCanonicalURL(),MediaTransformOutput\getDescLinkAttribs(),MediaWiki\SpecialPage\LoginSignupSpecialPage\getFieldDefinitions(),MediaWiki\Actions\FormAction\getForm(),MediaWiki\SpecialPage\FormSpecialPage\getForm(),MediaWiki\Title\Title\getFullURL(),MediaWiki\Title\Title\getInternalURL(),MediaWiki\Title\Title\getLocalURL(),MediaWiki\Specials\SpecialRunJobs\getQuerySignature(),MediaWiki\Skin\Components\SkinComponentUtils\getReturnToParam(),MediaWiki\Installer\WebInstaller\getUrl(),MediaWiki\SpecialPage\AuthManagerSpecialPage\handleReauthBeforeExecute(),MediaWiki\Exception\UserNotLoggedIn\report(),MediaWiki\Actions\PurgeAction\show(),MediaWiki\Output\OutputPage\showPermissionStatus(),MediaWiki\SpecialPage\ChangesListSpecialPage\validateOptions(),wfAppendQuery(), andwfArrayToCgi().

◆ 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(); hard-deprecated since 1.45
Since
1.19
Parameters
array$urlPartsURL parts, as output from wfParseUrl
Returns
string URL assembled from its component parts

Definition at line532 of fileGlobalFunctions.php.

ReferenceswfDeprecated().

◆ 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 true if MW_ENTRY_POINT is 'cli', otherwise false.
Returns
string
Since
1.25 Supports $raw parameter.

Definition at line936 of fileGlobalFunctions.php.

ReferencesMW_ENTRY_POINT, andwfDebugBacktrace().

◆ 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 line1706 of fileGlobalFunctions.php.

References$matches, and$path.

Referenced byExif\__construct(),FileOpPerfTest\doPerfTest(),MediaWiki\FileRepo\AuthenticatedFileEntryPoint\execute(),ImportImages\execute(),wfRelativePath(), andwfStripIllegalFilenameChars().

◆ wfBoolToStr()

wfBoolToStr($value)

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

Parameters
bool$value
Returns
string

Definition at line1793 of fileGlobalFunctions.php.

Referenced byMediaWiki\Api\ApiRsd\formatRsdApiList(), andMediaWiki\Cache\FileCacheBase\isCacheGood().

◆ wfCgiToArray()

wfCgiToArray($query)

This is the logical opposite ofwfArrayToCgi(): 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 line381 of fileGlobalFunctions.php.

Referenced byMediaWiki\Linker\Linker\makeBrokenImageLinkObj(),MediaWiki\Specials\SpecialChangeEmail\onSuccess(),MediaWiki\Output\OutputPage\returnToMain(),LoginHelper\showReturnToPage(),MediaWiki\Linker\Linker\specialLink(),MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), andMediaWiki\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 line1022 of fileGlobalFunctions.php.

ReferenceswfDebug().

Referenced byMediaWiki\Cache\HTMLFileCache\loadFromFileCache(), andMediaWiki\Cache\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 line632 of fileGlobalFunctions.php.

References$wgDebugLogPrefix,$wgDebugRawPage, andwfIsDebugRawPage().

Referenced byMediaWiki\Api\ApiMain\__construct(),DifferenceEngine\__construct(),MediaWiki\Upload\UploadStashFile\__construct(),MediaWiki\Skin\QuickTemplate\__construct(),MediaWiki\Upload\UploadFromStash\__construct(),MediaWiki\Parser\ParserFactory\__construct(),MediaWiki\Upload\UploadFromChunks\__construct(),MediaWiki\StubObject\StubGlobalUser\_unstub(),MediaWiki\StubObject\StubObject\_unstub(),MediaWiki\Logging\LogPage\actionText(),MediaWiki\Gallery\ImageGalleryBase\add(),MediaHandler\addMeta(),MediaWiki\Skin\Skin\afterContentHook(),MediaWiki\Linker\Linker\blockLink(),MediaWiki\Output\OutputPage\checkLastModified(),MediaWiki\JobQueue\JobQueueDB\claimOldest(),MediaWiki\FileRepo\LocalRepo\cleanupDeletedBatch(),MediaWiki\Upload\UploadBase\cleanupTempFile(),MediaWiki\Upload\UploadStash\clear(),MediaWiki\MediaWikiEntryPoint\commitMainTransaction(),MediaWiki\Storage\SqlBlobStore\compressData(),MediaWiki\Upload\UploadBase\createFromRequest(),WikiImporter\debug(),BaseDump\debug(),RecompressTracked\debug(),MediaWiki\Upload\UploadVerification\detectScript(),MediaWiki\Upload\UploadVerification\detectVirus(),MediaWiki\JobQueue\JobQueueDB\doBatchPushInternal(),MediaWiki\Page\WikiFilePage\doPurge(),DjVuHandler\doTransform(),TransformationalImageHandler\doTransform(),MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(),MediaWiki\EditPage\EditPage\edit(),MediaWiki\Specials\SpecialUpload\execute(),MediaWiki\FileRepo\File\LocalFileRestoreBatch\execute(),MediaWiki\Page\Article\fetchRevisionRecord(),WikiImporter\finishImportPage(),FormatMetadata\flattenArrayReal(),MediaWiki\FileRepo\FileRepo\freeTemp(),MediaWiki\FileRepo\File\File\generateAndSaveThumb(),LCStoreCDB\get(),MediaWiki\PoolCounter\PoolCounterConnectionManager\get(),MediaWiki\Actions\Action\getContext(),MediaWiki\Context\ContextSource\getContext(),MediaWiki\SpecialPage\SpecialPage\getContext(),MediaWiki\Specials\SpecialVersion\getCreditsForExtension(),MediaWiki\FileRepo\File\File\getDescriptionText(),MediaWiki\FileRepo\File\ForeignDBFile\getDescriptionText(),MediaWiki\Upload\UploadStash\getFile(),MediaWiki\JobQueue\Jobs\DoubleRedirectJob\getFinalDestination(),MediaWiki\Page\WikiFilePage\getForeignCategories(),MediaWiki\Cache\GenderCache\getGenderOf(),MediaWiki\Specials\SpecialUpload\getInitialPageText(),TransformationalImageHandler\getMagickVersion(),MediaWiki\Context\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(),MediaWiki\FileRepo\ForeignAPIRepo\getThumbError(),MediaWiki\Upload\UploadStashFile\getThumbUrl(),MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache(),MediaWiki\Title\Title\getTitleValue(),MediaWiki\FileRepo\File\File\getViewURL(),MediaWiki\Output\OutputPage\haveCacheVaryCookies(),MediaWiki\JobQueue\Jobs\ThumbnailRenderJob\hitThumbUrl(),MediaWiki\FileRepo\ForeignAPIRepo\httpGet(),MediaWiki\EditPage\EditPage\importFormData(),WikiRevision\importLogItem(),MediaWiki\Cache\FileCacheBase\isCacheGood(),MediaWiki\Shell\Shell\isDisabled(),DjVuHandler\isEnabled(),SvgHandler\isEnabled(),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(),MediaWiki\Cache\HTMLFileCache\loadFromFileCache(),MediaWiki\Linker\Linker\makeExternalImage(),MediaWiki\Linker\LinkRenderer\makeExternalLink(),MediaWiki\Linker\Linker\makeImageLink(),MediaWiki\Linker\Linker\makeMediaLinkFile(),ImportStreamSource\newFromURL(),WikiImporter\notice(),MediaWiki\Actions\RawAction\onView(),MediaWiki\FileRepo\File\LocalFile\purgeThumbList(),SvgHandler\rasterize(),MediaWiki\Maintenance\TextPassDumper\readDump(),MediaWiki\Upload\UploadStash\removeFileNoAuth(),MediaWiki\Page\WikiPage\replaceSectionAtRev(),MediaWiki\MediaWikiEntryPoint\restInPeace(),DjVuImage\retrieveMetaData(),BitmapHandler\rotate(),MediaWiki\JobQueue\Jobs\DoubleRedirectJob\run(),MediaWiki\Cache\FileCacheBase\saveText(),MediaWiki\Cache\HTMLFileCache\saveToFileCache(),JpegMetadataExtractor\segmentSplitter(),MediaWiki\Mail\UserMailer\send(),MediaWiki\Output\OutputPage\sendCacheControl(),MediaWiki\Mail\UserMailer\sendInternal(),MediaWiki\Mail\UserMailer\sendWithPear(),MediaWiki\Api\ApiMain\setCacheMode(),MediaWiki\Actions\ViewAction\show(),MediaWiki\FileRepo\LocalRepo\skipWriteOperationIfSha1(),MediaWiki\Upload\UploadStash\stashFile(),MediaWiki\FileRepo\FileRepo\storeBatch(),WikiImporter\throwXmlError(),MediaWiki\Tidy\RemexDriver\tidy(),MediaWiki\FileRepo\File\File\transform(),BitmapHandler\transformCustom(),BitmapHandler\transformGd(),BitmapHandler\transformImageMagick(),BitmapHandler\transformImageMagickExt(),LocalisationCacheBulkLoad\trimCache(),MediaWiki\Page\Article\tryFileCache(),MediaWiki\FileRepo\File\LocalFile\upgradeRow(),MediaWiki\FileRepo\File\OldLocalFile\upgradeRow(),MediaWiki\Revision\RevisionRecord\userCanBitfield(),MediaWiki\Linker\Linker\userLink(),MediaWiki\Linker\Linker\userTalkLink(),MediaWiki\Linker\Linker\userToolLinks(),MediaWiki\Upload\UploadVerification\verifyExtension(),MediaWiki\Upload\UploadVerification\verifyFile(),MediaWiki\Upload\UploadBase\verifyMimeType(),MediaWiki\Api\ApiUpload\verifyUpload(),MediaWiki\Page\Article\view(),WikiImporter\warn(),wfClientAcceptsGzip(),wfDebugBacktrace(),wfMemoryLimit(),wfMkdirParents(), andwfTimestamp().

◆ 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 line908 of fileGlobalFunctions.php.

ReferenceswfDebug().

Referenced bywfBacktrace(),wfGetAllCallers(), andwfGetCaller().

◆ 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 line696 of fileGlobalFunctions.php.

Referenced byMediaWiki\MediaWikiEntryPoint\commitMainTransaction(),MediaWiki\Upload\UploadFromChunks\concatenateChunks(),WebPHandler\decodeLosslessChunkHeader(),WebPHandler\decodeLossyChunkHeader(),MediaWiki\JobQueue\JobQueueRedis\doAck(),MediaWiki\JobQueue\JobQueueRedis\doBatchPush(),MediaWiki\JobQueue\JobQueueRedis\doPop(),DjVuHandler\doTransform(),SvgHandler\doTransform(),TransformationalImageHandler\doTransform(),MediaWiki\FileRepo\AuthenticatedFileEntryPoint\execute(),CheckUsernames\execute(),WebPHandler\extractMetadata(),WebPHandler\extractMetadataFromChunks(),MediaWiki\Message\Message\formatListParam(),IPTC\getCharset(),MediaWiki\Request\WebResponse\header(),MediaHandler\logErrorForExternalProcess(),MediaWiki\JobQueue\JobQueueFederated\logException(),MediaWiki\Api\ApiBase\logFeatureUsage(),MediaWiki\Api\ApiMain\logRequest(),MediaWiki\Actions\ActionEntryPoint\maybeDoHttpsRedirect(),MediaWiki\FileRepo\File\LocalFile\move(),MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(),IPTC\parse(),MediaWiki\Deferred\CdnCacheUpdate\purge(),MediaWiki\Upload\UploadFromUrl\reallyFetchFile(),MediaHandler\removeBadFile(),MediaWiki\Upload\UploadFromUrl\saveTempFileChunk(),MediaWiki\Request\WebResponse\setCookie(), andMediaWiki\Request\WebResponse\statusHeader().

◆ wfDeprecated()

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

Logs a warning that a deprecated feature was used.

To write a custom deprecation message, usewfDeprecatedMsg() instead.

Parameters
string$functionFeature that is deprecated.
string | false$versionVersion ofMediaWiki 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 inMediaWiki 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 theMediaWiki version number specified by $version is neither a string nor false.

Definition at line735 of fileGlobalFunctions.php.

Referenced bySearchResultSet\__construct(),MediaWiki\HTMLForm\VFormHTMLForm\__construct(),ImportReporter\__construct(),MediaWiki\SpecialPage\SpecialRedirectWithAction\__construct(),MediaWiki\Rest\Handler\Helper\HtmlMessageOutputHelper\__construct(),MediaWiki\Collation\CollationCkb\__construct(),MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper\__construct(),MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper\__construct(),MediaWiki\Search\Entity\SearchResultThumbnail\__construct(),Wikimedia\Message\ListParam\__construct(),Wikimedia\Message\ScalarParam\__construct(),MediaWiki\Debug\__get(),MediaWiki\User\User\__get(),MediaWiki\Debug\__isset(),MediaWiki\Debug\__set(),MediaWiki\User\User\__set(),MediaWiki\StubObject\DeprecatedGlobal\_newObject(),MediaWiki\StubObject\StubGlobalUser\_newObject(),MediaWiki\Api\ApiModuleManager\addModule(),MediaWiki\Output\OutputPage\addParserOutput(),MediaWiki\Output\OutputPage\addParserOutputContent(),MediaWiki\Output\OutputPage\addParserOutputText(),MediaWiki\ChangeTags\ChangeTags\addTags(),MediaWiki\Parser\Parser\attributeStripCallback(),MediaWiki\User\TempUser\Pattern\buildLike(),MediaWiki\Html\Html\buttonAttributes(),MediaWiki\User\User\canSendEmail(),MediaWiki\User\ActorMigrationBase\checkDeprecation(),MediaWiki\Parser\Parsoid\Config\PageConfigFactory\create(),SearchEngine\defaultNearMatcher(),MediaWiki\ChangeTags\ChangeTags\defineTag(),MediaWiki\ChangeTags\ChangeTags\deleteTagEverywhere(),MediaWiki\Upload\UploadBase\detectScript(),MediaWiki\Upload\UploadBase\detectVirus(),MediaWiki\MediaWikiServices\disableStorageBackend(),MediaWiki\Block\DatabaseBlock\doAutoblock(),MediaWiki\Parser\Parser\doBlockLevels(),MediaWiki\Page\WikiPage\doEditUpdates(),MediaWiki\Parser\Parser\enableOOUI(),MediaWiki\Maintenance\Maintenance\error(),MediaWiki\Config\SiteConfiguration\extractAllGlobals(),MediaWiki\RCFeed\RCFeed\factory(),MediaWiki\Output\OutputPage\forceHideNewSectionLink(),MediaWiki\Config\SiteConfiguration\get(),MediaWiki\Logging\Pager\LogPager\getAction(),MediaWiki\Deferred\LinksUpdate\LinksUpdate\getAddedLinks(),MediaWiki\Config\SiteConfiguration\getAll(),Profiler\getAllowOutput(),MediaWiki\Block\DatabaseBlock\getAutoblockExpiry(),MediaWiki\Page\WikiPage\getAutoDeleteReason(),MediaWiki\Content\ContentHandler\getAutoDeleteReason(),MediaWiki\Block\DatabaseBlock\getBlocksForIPList(),MediaWiki\Config\SiteConfiguration\getBool(),MediaWiki\Logging\LogFormatter\getCommentFormatter(),SearchEngineConfig\getConfig(),MediaWiki\Logging\LogFormatter\getContentLanguage(),MediaWiki\Request\WebRequest\getCrossSiteCookie(),MediaWiki\Logging\Pager\LogPager\getDay(),Wikimedia\Rdbms\DBAccessObjectUtils\getDBOptions(),MediaWiki\Parser\Parser\getDefaultSort(),MediaWiki\RecentChanges\EnhancedChangesList\getDiffHistLinks(),MediaWiki\Language\Language\getDirMarkEntity(),MediaWiki\ChangeTags\ChangeTags\getDisplayTableName(),MediaWiki\ExternalLinks\ExternalLinksLookup\getExternalLinksForPage(),MediaWiki\Parser\ParserOutput\getFileSearchOptions(),MediaWiki\Parser\Parser\getFunctionLang(),MediaWiki\Specials\SpecialVersion\getGitHeadSha1(),MediaWiki\Parser\MagicWord\getId(),MediaWiki\Deferred\LinksUpdate\LinksUpdate\getImages(),MediaWiki\Parser\ParserOutput\getImages(),MediaWiki\Parser\ParserOutput\getInterwikiLinks(),MediaWiki\Parser\ParserOutput\getLanguageLinks(),MediaWiki\Logging\LogFormatter\getLinkRenderer(),MediaWiki\Parser\ParserOutput\getLinks(),MediaWiki\Parser\ParserOutput\getLinksSpecial(),MediaWiki\Watchlist\WatchedItem\getLinkTarget(),MediaWiki\Output\OutputPage\getModules(),MediaWiki\Output\OutputPage\getModuleStyles(),MediaWiki\Logging\Pager\LogPager\getMonth(),MediaWiki\Content\AbstractContent\getNativeData(),MediaWiki\Parser\Parser\getOutput(),MediaWiki\Logging\Pager\LogPager\getPage(),MediaWiki\Parser\Parser\getPage(),MediaWiki\RecentChanges\RecentChangeNotifier\getPageStatus(),MediaWiki\Title\Title\getPageViewLanguage(),MediaWiki\Logging\Pager\LogPager\getPattern(),MediaWiki\SpecialPage\AuthManagerSpecialPage\getPreservedParams(),MediaWiki\FileRepo\File\LocalFile\getQueryInfo(),MediaWiki\FileRepo\File\OldLocalFile\getQueryInfo(),Wikimedia\Rdbms\Platform\SQLPlatform\getQueryVerb(),MediaWiki\Page\Article\getRedirectHeaderHtml(),MediaWiki\Content\WikitextContent\getRedirectTargetAndText(),MediaWiki\Deferred\LinksUpdate\LinksUpdate\getRemovedLinks(),MediaWiki\Revision\RevisionStore\getRevisionByTitle(),MediaWiki\Linker\Linker\getRollbackEditCount(),Wikimedia\ObjectCache\BagOStuff\getSegmentationSize(),Wikimedia\ObjectCache\MediumSpecificBagOStuff\getSegmentationSize(),Wikimedia\ObjectCache\BagOStuff\getSegmentedValueMaxSize(),Wikimedia\ObjectCache\MediumSpecificBagOStuff\getSegmentedValueMaxSize(),MediaWiki\Content\ContentHandler\getSlotDiffRendererWithOptions(),MediaWiki\ChangeTags\ChangeTags\getSoftwareTags(),MediaWiki\Logging\Pager\LogPager\getTagInvert(),MediaWiki\ChangeTags\ChangeTags\getTags(),MediaWiki\ChangeTags\ChangeTags\getTagsWithData(),MediaWiki\Parser\ParserOutput\getTemplateIds(),MediaWiki\Parser\ParserOutput\getTemplates(),MediaWiki\User\UserNameUtils\getTempPlaceholder(),MediaWiki\Html\Html\getTextInputAttributes(),MediaWiki\Parser\ParserOutput\getTimestamp(),MediaWiki\Deferred\LinksUpdate\TitleLinksTable\getTitleArray(),MediaWiki\Parser\PPFrame_Hash\getTTL(),MediaWiki\Logging\Pager\LogPager\getType(),MediaWiki\Block\BlockManager\getUserBlock(),MediaWiki\Logging\LogFormatter\getUserEditTracker(),MediaWiki\HTMLForm\HTMLFormField\getVForm(),WikiImporterFactory\getWikiImporter(),MediaWiki\Logging\Pager\LogPager\getYear(),MediaWiki\Parser\Parser\guessLegacySectionNameFromWikiText(),MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper\init(),MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper\init(),MediaWiki\Block\DatabaseBlock\insert(),MediaWiki\User\User\isBlockedFromEmailuser(),MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(),MediaWiki\Request\WebRequest\isSafeRequest(),MediaWiki\Upload\UploadBase\isThrottled(),MediaWiki\ChangeTags\ChangeTags\listDefinedTags(),MediaWiki\ChangeTags\ChangeTags\listExplicitlyDefinedTags(),MediaWiki\Message\Message\listParam(),Wikimedia\Message\MessageValue\listParamsOfType(),MediaWiki\ChangeTags\ChangeTags\listSoftwareActivatedTags(),MediaWiki\ChangeTags\ChangeTags\listSoftwareDefinedTags(),MediaWiki\Api\ApiBase\makeMessage(),MediaWiki\ChangeTags\ChangeTags\makeTagSummarySubquery(),MediaWiki\Request\WebRequest\markAsSafeRequest(),MediaWiki\ChangeTags\ChangeTags\modifyDisplayQuery(),MediaWiki\Logging\LogFormatter\newFromEntry(),MediaWiki\Block\DatabaseBlock\newFromID(),MediaWiki\Block\DatabaseBlock\newFromRow(),MediaWiki\Logging\LogFormatter\newFromRow(),MediaWiki\Block\DatabaseBlock\newFromTarget(),MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlInputTransformHelper(),MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlMessageOutputHelper(),MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlOutputRendererHelper(),MediaWiki\Block\DatabaseBlock\newListFromTarget(),BaseSearchResultSet\next(),MediaWiki\Parser\Parser\Options(),MediaWiki\Parser\Parser\OutputType(),MediaWiki\Storage\PageEditStash\parseAndCache(),MediaWiki\RecentChanges\RecentChange\parseFromRCType(),MediaWiki\Output\OutputPage\parserOptions(),MediaWiki\RecentChanges\RecentChange\parseToRCType(),MediaWiki\ChangeTags\ChangeTags\purgeTagCacheAll(),MediaWiki\RenameUser\RenameuserSQL\rename(),MediaWiki\Parser\Parser\replaceVariables(),BaseSearchResultSet\rewind(),MediaWiki\Output\OutputPage\setCategoryLinks(),setExtensionData(),MediaWiki\Gallery\ImageGalleryBase\setHeights(),MediaWiki\Output\OutputPage\setIndexPolicy(),TextSlotDiffRenderer\setLanguage(),MediaWiki\Parser\ParserOutput\setLanguageLinks(),MediaWiki\Output\OutputPage\setLanguageLinks(),MediaWiki\Parser\ParserOutput\setOutputFlag(),Profiler\setProfileID(),AutoloadGenerator\setPsr4Namespaces(),MediaWiki\Output\OutputPage\setRevisionTimestamp(),TextSlotDiffRenderer\setStatsdDataFactory(),MediaWiki\Parser\ParserOptions\setSuppressTOC(),MediaWiki\Parser\ParserOutput\setText(),MediaWiki\Parser\ParserOutput\setTimestamp(),MediaWiki\Parser\PPFrame_Hash\setTTL(),MediaWiki\Parser\PPTemplateFrame_Hash\setTTL(),MediaWikiShell\setupLogging(),MediaWiki\Gallery\ImageGalleryBase\setWidths(),MediaWiki\Parser\ParserOptions\setWrapOutputClass(),MediaWiki\Output\OutputPage\showNewSectionLink(),MediaWiki\Cache\UserCache\singleton(),MediaWiki\Config\SiteConfiguration\siteFromDB(),MediaWiki\ChangeTags\ChangeTags\tagUsageStatistics(),Wikimedia\Message\MessageValue\textParamsOfType(),MediaWiki\Json\JsonCodec\unserialize(),MediaWiki\Block\DatabaseBlock\update(),MediaWiki\ChangeTags\ChangeTags\updateTags(),MediaWiki\Block\DatabaseBlock\updateTimestamp(),MediaWiki\Parser\Sanitizer\validateAttributes(),MediaWiki\Rest\Validator\Validator\validateBody(),MediaWiki\Parser\Parsoid\Config\SiteConfig\variants(),MediaWiki\Upload\UploadBase\verifyExtension(),wfArrayDiff2(),wfAssembleUrl(),wfExpandUrl(),wfMatchesDomainList(),wfMergeErrorArrays(),wfParseUrl(),wfUrlProtocols(),wfUrlProtocolsWithoutProtRel(),MediaWiki\Output\OutputPage\wrapWikiTextAsInterface(), andMediaWiki\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 ofMediaWiki that the function was deprecated in.
string | bool$componentComponent to which the function belongs. If false, it is assumed the function is inMediaWiki 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 line766 of fileGlobalFunctions.php.

Referenced byMediaWiki\HTMLForm\HTMLFormField\__construct(),MediaWiki\Api\ApiOptions\__construct(),MediaWiki\Rest\Validator\JsonBodyValidator\__construct(),MediaWiki\Block\AbstractBlock\__construct(),MediaWiki\StubObject\StubGlobalUser\__destruct(),MediaWiki\Parser\Parser\braceSubstitution(),MediaWiki\Block\BlockPermissionChecker\checkBlockPermissions(),MediaWiki\DAO\deprecateInvalidCrossWiki(),MediaWiki\HTMLForm\HTMLForm\factory(),MediaWiki\User\User\getActorId(),MediaWiki\RecentChanges\RecentChange\getAttribute(),MediaWiki\Site\MediaWikiSite\getFileUrl(),MediaWiki\SpecialPage\ContributionsSpecialPage\getForm(),MediaWiki\MediaWikiServices\getInstance(),MediaWiki\HTMLForm\Field\HTMLInfoField\getOOUI(),MediaWiki\MediaWikiServices\getService(),MediaWiki\Revision\RevisionStore\getTitle(),MediaWiki\FileRepo\File\LocalFile\loadFromRow(),MediaWiki\User\User\newSystemUser(),MediaWiki\Deferred\LinksUpdate\LinksUpdate\queueRecursiveJobsForTable(),MediaWiki\Api\ApiBase\requirePostedParameters(),MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml(),MediaWiki\Parser\CacheTime\setCacheTime(),MediaWiki\Block\AbstractBlock\setTarget(), andMediaWiki\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 useMediaWiki\Shell\Shell::escape()

Definition at line1484 of fileGlobalFunctions.php.

◆ wfEscapeWikiText()

wfEscapeWikiText($input)

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 | null | false$inputText to be escaped
Returns
string

Definition at line1056 of fileGlobalFunctions.php.

References$wgEnableMagicLinks, and$wgUrlProtocols.

Referenced byMediaWiki\Title\MalformedTitleException\__construct(),MediaWiki\SpecialPage\ContributionsSpecialPage\addContributionsSubWarning(),MediaHandler\addMeta(),MediaWiki\Parser\CoreParserFunctions\basepagename(),MediaWiki\Parser\CoreParserFunctions\basepagenamee(),MediaWiki\Parser\Parser\braceSubstitution(),MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(),MediaWiki\Api\ApiMain\checkAsserts(),MediaWiki\Api\ApiQueryImageInfo\checkParameterNormalise(),MediaWiki\Parser\CoreParserFunctions\contentmodel(),MediaWiki\Api\ApiMain\createPrinterByName(),MediaWiki\Parser\CoreParserFunctions\defaultsort(),MediaWiki\Parser\CoreParserFunctions\displaytitle(),MediaWiki\Page\WikiPage\doDeleteArticleReal(),MediaWiki\Api\ApiMain\errorMessagesFromException(),MediaWiki\Specials\SpecialAuthenticationPopupSuccess\execute(),MediaWiki\Specials\SpecialFileDuplicateSearch\execute(),MediaWiki\Specials\SpecialMergeHistory\execute(),MediaWiki\Specials\SpecialUnblock\execute(),MediaWiki\Api\ApiAMCreateAccount\execute(),MediaWiki\Api\ApiClientLogin\execute(),MediaWiki\Api\ApiComparePages\execute(),MediaWiki\Api\ApiEditPage\execute(),MediaWiki\Api\ApiEmailUser\execute(),MediaWiki\Api\ApiExpandTemplates\execute(),MediaWiki\Api\ApiLinkAccount\execute(),MediaWiki\Api\ApiMergeHistory\execute(),MediaWiki\Api\ApiMove\execute(),MediaWiki\Api\ApiOptionsBase\execute(),MediaWiki\Api\ApiParse\execute(),MediaWiki\Api\ApiProtect\execute(),MediaWiki\Api\ApiQueryAllMessages\execute(),MediaWiki\Api\ApiQueryLogEvents\execute(),MediaWiki\Api\ApiQueryUserContribs\execute(),MediaWiki\Api\ApiUndelete\execute(),MediaWiki\Api\ApiUserrights\execute(),MediaWiki\Api\ApiValidatePassword\execute(),MediaWiki\Api\ApiBase\extractRequestParams(),MediaWiki\Parser\CoreParserFunctions\fullpagename(),MediaWiki\Parser\CoreParserFunctions\fullpagenamee(),MediaWiki\ChangeTags\ChangeTags\getChangeTagList(),MediaWiki\EditPage\Constraint\RedirectConstraint\getLegacyStatus(),MediaWiki\Api\ApiErrorFormatter\getMessageFromException(),MediaWiki\Api\ApiBase\getModuleFromPath(),MediaWiki\Api\ApiBase\getTitleFromTitleOrPageId(),MediaWiki\Api\ApiBase\getTitleOrPageId(),MediaWiki\Parser\Parser\getUserSig(),MediaWiki\Api\ApiBase\getWatchlistUser(),MediaWiki\Actions\RollbackAction\handleRollbackRequest(),MediaWiki\EditPage\EditPage\importFormData(),MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(),MediaWiki\Api\ApiQueryImageInfo\mergeThumbParams(),MediaWiki\Specials\SpecialPasswordReset\onSubmit(),MediaWiki\Specials\SpecialRandomInCategory\onSubmit(),MediaWiki\Specials\SpecialBlock\onSuccess(),MediaWiki\Page\ImagePage\openShowImage(),MediaWiki\Specials\Pager\ImageListPager\outputUserDoesNotExist(),MediaWiki\Parser\CoreParserFunctions\pagename(),MediaWiki\Parser\CoreParserFunctions\pagenamee(),MediaWiki\Api\ApiQueryBase\parsePrefixedTitlePart(),MediaWiki\Specials\SpecialBlock\postHtml(),MediaWiki\Parser\CoreParserFunctions\rootpagename(),MediaWiki\Parser\CoreParserFunctions\rootpagenamee(),MediaWiki\Api\ApiQueryRecentChanges\run(),MediaWiki\Api\ApiQueryRevisions\run(),MediaWiki\Api\ApiMain\setupModule(),MediaWiki\Specials\SpecialSearch\showCreateLink(),MediaWiki\Specials\SpecialUndelete\showHistory(),MediaWiki\Page\Article\showMissingArticle(),MediaWiki\Specials\SpecialSearch\showResults(),MediaWiki\SpecialPage\LoginSignupSpecialPage\showSuccessPage(),MediaWiki\EditPage\EditPage\spamPageWithContent(),MediaWiki\Parser\CoreParserFunctions\subjectpagename(),MediaWiki\Parser\CoreParserFunctions\subjectpagenamee(),MediaWiki\Parser\CoreParserFunctions\subpagename(),MediaWiki\Parser\CoreParserFunctions\subpagenamee(),MediaWiki\Parser\CoreParserFunctions\talkpagename(),MediaWiki\Parser\CoreParserFunctions\talkpagenamee(),MediaWiki\Actions\DeleteAction\tempDelete(),MediaWiki\Api\ApiQueryBase\titlePartToKey(),MediaWiki\HTMLForm\Field\HTMLUserTextField\validate(),MediaWiki\Block\UserBlockTarget\validateForCreation(),MediaWiki\Api\ApiFileRevert\validateParameters(), andMediaWiki\Preferences\SignatureValidator\validateSignature().

◆ 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 withhttp:// PROTO_HTTPS: Output a URL starting withhttps:// PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) PROTO_CURRENT: Output a URL starting with eitherhttp:// orhttps:// , 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 UrlUtils::removeDotSegments()).

Deprecated
since 1.39, use UrlUtils::expand(); hard-deprecated since 1.45
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 line514 of fileGlobalFunctions.php.

References$url,wfDeprecated(), andwfGetUrlUtils().

◆ wfFormatStackFrame()

wfFormatStackFrame($frame)

Return a string representation of frame.

Typically, the returned value will be in one of these formats:

  • method
  • Fully\Qualified\method
  • Fully\Qualified\Class->method
  • Fully\Qualified\Class::method
Parameters
array$frame
Returns
string

Definition at line1004 of fileGlobalFunctions.php.

Referenced bywfGetAllCallers(), andwfGetCaller().

◆ 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 line985 of fileGlobalFunctions.php.

ReferenceswfDebugBacktrace(), andwfFormatStackFrame().

Referenced byMediaWiki\Session\SessionBackend\addData(),MediaWiki\Session\SessionBackend\dirty(), andMediaWiki\Session\SessionBackend\renew().

◆ wfGetCaller()

wfGetCaller($level =2)

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

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

The format will be the same as for {

See also
wfFormatStackFrame()}.
Parameters
int$level
Returns
string function name or 'unknown'

Definition at line969 of fileGlobalFunctions.php.

ReferenceswfDebugBacktrace(), andwfFormatStackFrame().

Referenced byMediaWiki\StubObject\StubGlobalUser\_unstub(),MediaWiki\StubObject\StubObject\_unstub(),MediaWiki\Deferred\DeferredUpdates\addCallableUpdate(),Wikimedia\Rdbms\DBConnRef\ensureConnection(),MediaWiki\Debug\MWDebug\log(),MediaWiki\Request\HeaderCallback\warnIfHeadersSent(),wfShellExec(), andwfShellExecWithStderr().

◆ wfGetNull()

wfGetNull()

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

/dev/null

Returns
string

Definition at line1802 of fileGlobalFunctions.php.

ReferenceswfIsWindows().

◆ wfGetUrlUtils()

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

Definition at line462 of fileGlobalFunctions.php.

Referenced byMediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\generateIconFromFavicon(),MediaWiki\WikiMap\WikiMap\getCanonicalServerInfoForAllWikis(),MediaWiki\Parser\Parser\getExternalLinkRel(),MediaWiki\WikiMap\WikiMap\getWikiFromUrl(),MediaWiki\JobQueue\Jobs\ThumbnailRenderJob\hitThumbUrl(),MediaWiki\Upload\UploadFromUrl\isAllowedHost(),MediaWiki\RCFeed\RedisPubSubFeedEngine\send(),wfExpandUrl(),wfMatchesDomainList(),wfParseUrl(),wfUrlProtocols(), andwfUrlProtocolsWithoutProtRel().

◆ wfHostname()

wfHostname()

Get host name of the current machine, for use in error reporting.

This helps to know which machine in a data center generated the current page.

Returns
string

Definition at line888 of fileGlobalFunctions.php.

References$wgOverrideHostname.

Referenced byMediaWiki\Logger\Monolog\WikiProcessor\__invoke(),MediaWiki\Api\ApiMain\addRequestedFields(),DifferenceEngine\debug(),DjVuHandler\doTransform(),SvgHandler\doTransform(),TransformationalImageHandler\doTransform(),MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(),MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(),MediaWiki\Output\OutputPage\getBottomScripts(),MediaHandler\logErrorForExternalProcess(),MediaWiki\Parser\Parser\makeLimitReport(), andMediaWiki\FileRepo\ThumbnailEntryPoint\thumbError().

◆ wfHttpError()

wfHttpError($code,
$label,
$desc )

Provide a simple HTTP error.

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

Definition at line1207 of fileGlobalFunctions.php.

References$wgOut.

Referenced byMediaWiki\Specials\SpecialJavaScriptTest\execute(),MediaWiki\Specials\SpecialRunJobs\execute(), andMediaWiki\Actions\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... butnot 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 line1446 of fileGlobalFunctions.php.

ReferenceswfStringToBool().

Referenced byMediaWiki\Http\HttpRequestFactory\canMakeRequests(),MWHttpRequest\canMakeRequests(),MediaWiki\Upload\UploadBase\isEnabled(), andMediaWiki\Installer\WebInstaller\startSession().

◆ wfIsDebugRawPage()

wfIsDebugRawPage()

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

Returns
bool

Definition at line654 of fileGlobalFunctions.php.

ReferencesMW_ENTRY_POINT.

Referenced byMediaWiki\Logger\LegacyLogger\__construct(), andwfDebug().

◆ wfIsInfinity()

wfIsInfinity($str)

Determine input string is represents as infinity.

Parameters
string$strThe string to determine
Returns
bool
Since
1.25

Definition at line1919 of fileGlobalFunctions.php.

Referenced byMediaWiki\Api\ApiQueryBlocks\execute(),MediaWiki\User\UserGroupAssignmentService\expiryToTimestamp(),MediaWiki\Api\ApiResult\formatExpiry(),MediaWiki\Logging\BlockLogFormatter\getParametersForApi(),MediaWiki\Actions\WatchAction\makeSuccessMessage(),MediaWiki\Specials\SpecialBlock\setParameter(), andMediaWiki\Language\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 line42 of fileGlobalFunctions.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 line63 of fileGlobalFunctions.php.

References$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 line79 of fileGlobalFunctions.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 line94 of fileGlobalFunctions.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 line714 of fileGlobalFunctions.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 line794 of fileGlobalFunctions.php.

Referenced byMediaWiki\User\User\__get(),MediaWiki\User\User\__set(),MediaWiki\RecentChanges\ChangesListFilterGroupContainer\areFiltersInConflict(),MediaWiki\Storage\SqlBlobStore\compressData(),MediaWiki\Language\Language\convertGrammar(),MediaWiki\Linker\Linker\emailLink(),FormatMetadata\flattenArrayReal(),MediaWiki\Logging\LogFormatter\formatParametersForApi(),MediaWiki\SpecialPage\SpecialPageFactory\getPage(),MediaWiki\Html\Html\inlineScript(),MediaWiki\Parser\Sanitizer\normalizeSectionNameWhitespace(), andMediaWiki\Output\OutputPage\transformFilePath().

◆ 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::matchesDomainList(); hard-deprecated since 1.44
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 line606 of fileGlobalFunctions.php.

References$url,wfDeprecated(), andwfGetUrlUtils().

◆ wfMemoryLimit()

wfMemoryLimit($newLimit)

Raise PHP's memory limit (if needed).

Access: internal
For use bySetup.php
Parameters
int$newLimit

Definition at line1833 of fileGlobalFunctions.php.

ReferenceswfDebug(), andwfShorthandToInteger().

◆ 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 line1616 of fileGlobalFunctions.php.

Referenced byMediaWiki\Content\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' ] ]

Deprecated
since 1.43 Use StatusValue::merge() instead
Parameters
array[]...$args
Returns
array

Definition at line165 of fileGlobalFunctions.php.

ReferenceswfDeprecated().

◆ 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 thenew 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
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float>...$params See Message::params()
Returns
Message
Since
1.17
See also
Message::__construct

Definition at line820 of fileGlobalFunctions.php.

ReferenceswfMessageFallback().

Referenced byMediaWiki\Title\MalformedTitleException\__construct(),MediaTransformError\__construct(),IncompatibleDiffTypesException\__construct(),MediaWiki\HTMLForm\Field\HTMLAutoCompleteSelectField\__construct(),MediaWiki\HTMLForm\Field\HTMLSelectOrOtherField\__construct(),TransformParameterError\__construct(),TransformTooBigImageAreaError\__construct(),MediaWiki\Upload\UploadStashFile\__construct(),MediaWiki\HTMLForm\CollapsibleFieldsetLayout\__construct(),MediaWiki\Widget\DateInputWidget\__construct(),MediaWiki\Widget\SizeFilterWidget\__construct(),UploadChunkVerificationException\__construct(),MediaWiki\Logging\LogPage\actionText(),MediaHandler\addMeta(),MediaWiki\Content\WikitextContent\addSectionHeader(),MediaWiki\Content\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(),MediaWiki\Parser\Parser\braceSubstitution(),MediaWiki\Output\OutputPage\buildBacklinkSubtitle(),MediaWiki\Xml\Xml\buildForm(),MediaWiki\RecentChanges\ChangesFeed\buildItems(),MediaWiki\Specials\SpecialEditWatchlist\buildTools(),MediaWiki\SpecialPage\SpecialPage\checkLoginSecurityLevel(),MediaWiki\Upload\UploadStash\clear(),MediaWiki\Auth\AuthManager\continueAccountCreation(),MediaWiki\Auth\AuthManager\continueAccountLink(),MediaWiki\Auth\AuthManager\continueAuthentication(),MediaWiki\Upload\UploadFromChunks\continueChunks(),MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(),MediaWiki\Session\SessionProvider\describe(),MediaWiki\Auth\PasswordAuthenticationRequest\describeCredentials(),MediaWiki\Auth\PasswordDomainAuthenticationRequest\describeCredentials(),MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\describeCredentials(),MediaWiki\Session\SessionProvider\describeMessage(),MediaWiki\Upload\UploadVerification\detectVirus(),MediaWiki\Content\ContentModelChange\doContentModelChange(),MediaWiki\Page\File\FileDeleteForm\doDelete(),DjVuHandler\doTransform(),SvgHandler\doTransform(),TransformationalImageHandler\doTransform(),MediaWiki\Page\WikiPage\doUpdateRestrictions(),MediaWiki\Linker\Linker\emailLink(),MediaWiki\Installer\WebInstallerPage\endForm(),MediaWiki\Installer\WebInstallerInstall\endStage(),MediaWiki\Installer\Installer\envCheckDB(),MediaWiki\Maintenance\Maintenance\error(),MediaWiki\Installer\WebInstallerComplete\execute(),MediaWiki\Installer\WebInstallerDBConnect\execute(),MediaWiki\Installer\WebInstallerExistingWiki\execute(),MediaWiki\Installer\WebInstallerInstall\execute(),MediaWiki\Installer\WebInstallerName\execute(),MediaWiki\Installer\WebInstallerRestart\execute(),MediaWiki\Installer\WebInstallerUpgrade\execute(),MediaWiki\Installer\WebInstallerWelcome\execute(),CleanupSpam\execute(),DumpIterator\execute(),DumpMessages\execute(),RenameUser\execute(),DumpRenderer\execute(),MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(),MediaWiki\ResourceLoader\MessageBlobStore\fetchMessage(),DeleteEqualMessages\fetchMessageInfo(),MediaWiki\Content\FallbackContentHandler\fillParserOutput(),MediaWiki\Content\JsonContentHandler\fillParserOutput(),MediaWiki\RecentChanges\ChangesList\flag(),MediaWiki\Logging\BlockLogFormatter\formatBlockFlag(),MediaWiki\Logging\BlockLogFormatter\formatBlockFlags(),MediaWiki\Feed\FeedUtils\formatDiff(),MediaWiki\Feed\FeedUtils\formatDiffRow2(),LanguageZh_hans\formatDuration(),MediaWiki\Page\WikiPage\formatExpiry(),MediaWiki\Linker\Linker\formatHiddenCategories(),MediaWiki\Linker\Linker\formatRevisionSize(),MediaWiki\FileRepo\File\File\generateAndSaveThumb(),MediaWiki\Upload\UploadFromUrl\getAllowedHosts(),MediaWiki\Content\ContentHandler\getAutoDeleteReason(),MediaWiki\Content\ContentHandler\getAutosummary(),MediaWiki\Installer\WebInstaller\getCheckBox(),MediaWiki\Specials\SpecialVersion\getCopyrightAndAuthorList(),MediaWiki\Installer\Task\Task\getDescription(),MediaWiki\Interwiki\Interwiki\getDescription(),MediaWiki\Logging\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(),MediaWiki\Installer\WebInstallerPage\getFieldsetStart(),MediaWiki\Upload\UploadStash\getFile(),MediaWiki\Installer\WebInstallerDocument\getFileContents(),MediaWiki\Upload\UploadBase\getFilenamePrefixBlacklist(),MediaWiki\Collation\IcuCollation\getFirstLetter(),MediaWiki\Collation\NumericUppercaseCollation\getFirstLetter(),MediaHandler\getGeneralLongDesc(),MediaWiki\User\UserGroupMembership\getGroupPage(),MediaWiki\Installer\WebInstaller\getHelpBox(),MediaWiki\Installer\MysqlConnectForm\getHtml(),MediaWiki\Installer\PostgresConnectForm\getHtml(),MediaWiki\Installer\WebInstaller\getInfoBox(),MediaWiki\Specials\SpecialUpload\getInitialPageText(),MediaWiki\Installer\DatabaseConnectForm\getInstallUserBox(),MediaWiki\Logging\LogFormatter\getIRCActionComment(),MediaWiki\Logging\LogFormatter\getIRCActionText(),MediaWiki\Content\ContentHandler\getLocalizedName(),ImageHandler\getLongDesc(),SvgHandler\getLongDesc(),GIFHandler\getLongDesc(),PNGHandler\getLongDesc(),Licenses\getMessageFromParams(),MediaWiki\Exception\ErrorPageError\getMessageObject(),MediaWiki\Title\MalformedTitleException\getMessageObject(),MediaWiki\Installer\CliInstaller\getMessageText(),MediaWiki\Interwiki\Interwiki\getName(),MediaWiki\Logging\LogPage\getName(),MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\getPasswordResetData(),MediaWiki\EditPage\EditPage\getPreviewLimitReport(),MediaWiki\Installer\WebInstaller\getRadioElements(),MediaWiki\Logging\LogPage\getRcComment(),MediaWiki\Logging\LogPage\getRcCommentIRC(),MediaWiki\Installer\DatabaseInstaller\getReadableName(),MediaWiki\Block\DatabaseBlock\getRedactedName(),MediaWiki\Utils\MWTimestamp\getRelativeTimestamp(),MediaWiki\User\User\getRightDescription(),MediaWiki\User\User\getRightDescriptionHtml(),ImageHandler\getShortDesc(),MediaWiki\Utils\MWTimestamp\getTimezoneMessage(),MediaWiki\Parser\Parser\getUserSig(),MediaWiki\Specials\SpecialVersion\getVersion(),FormatMetadata\getVisibleFields(),MediaWiki\Installer\DatabaseSettingsForm\getWebUserBox(),MediaWiki\LinkedData\PageDataRequestHandler\handleRequest(),MediaWiki\Title\Title\hasSourceText(),MediaWiki\Skin\QuickTemplate\haveMsg(),MediaWiki\LinkedData\PageDataRequestHandler\httpContentNegotiation(),MediaWiki\Upload\UploadStash\initFile(),MediaWiki\Upload\UploadFromStash\initialize(),MediaWiki\Page\WikiPage\insertNullProtectionRevision(),DifferenceEngine\intermediateEditsMsg(),MediaWiki\Parser\Parser\interwikiTransclude(),MediaWiki\Parser\CoreParserFunctions\intFunction(),MediaWiki\Page\MovePage\isValidMove(),MediaWiki\Installer\WebInstaller\label(),MediaWiki\Upload\UploadStash\listFiles(),MediaWiki\User\BotPassword\login(),MediaWiki\Linker\LinkRenderer\makeBrokenLink(),MediaWiki\Linker\Linker\makeImageLink(),MediaWiki\Api\ApiBase\makeMessage(),MediaWiki\Linker\LinkRenderer\makeRedirectHeader(),MediaWiki\Linker\Linker\makeThumbLink2(),MediaWiki\Page\MergeHistory\merge(),MediaWiki\Exception\MWException\msg(),MediaWiki\Context\DerivativeContext\msg(),MediaWiki\Context\RequestContext\msg(),MediaWiki\HTMLForm\HTMLFormField\msg(),MediaWiki\Skin\QuickTemplate\msg(),SearchEngineConfig\namespacesAsText(),MediaWiki\Html\Html\namespaceSelectorOptions(),MediaWiki\Title\Title\newMainPage(),WikiImporter\notice(),MediaWiki\Content\JsonContent\objectTable(),MediaWiki\Actions\RawAction\onView(),MediaWiki\Installer\WebInstallerOutput\outputFooter(),MediaWiki\Installer\WebInstallerOutput\outputTitle(),MediaWiki\Json\FormatJson\parse(),SearchEngine\parseNamespacePrefixes(),MediaWiki\Page\WikiPage\protectDescription(),MediaWiki\Maintenance\TextPassDumper\readDump(),MediaWiki\Language\LanguageConverter\recursiveConvertRule(),MediaWiki\Upload\UploadStash\removeFile(),MediaWiki\Content\WikitextContent\replaceSection(),MediaWiki\Linker\Linker\revDeleteLink(),MediaWiki\Linker\Linker\revDeleteLinkDisabled(),MediaWiki\Linker\Linker\revUserLink(),MediaWiki\Linker\Linker\revUserTools(),MediaWiki\JobQueue\Jobs\DoubleRedirectJob\run(),MediaWiki\Storage\PageUpdater\saveRevision(),MediaWiki\User\User\sendMail(),MediaWiki\User\User\setEmailWithConfirmation(),WikiImporter\setTargetRootPage(),MediaWiki\Installer\WebInstaller\showError(),MediaWiki\Installer\WebInstallerExistingWiki\showKeyForm(),MediaWiki\Installer\WebInstaller\showMessage(),MediaWiki\Installer\WebInstaller\showSuccess(),MediaWiki\Installer\WebInstaller\showWarning(),MediaWiki\Linker\Linker\specialLink(),MediaWiki\Installer\WebInstallerInstall\startStage(),MediaWiki\Upload\UploadStash\stashFile(),MediaWiki\Parser\Parser\statelessFetchTemplate(),MediaWiki\Installer\WebInstallerName\submit(),MediaWiki\Installer\WebInstallerOptions\submit(),MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAccountCreation(),MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAuthentication(),MediaWiki\Gallery\TraditionalImageGallery\toHTML(),MediaWiki\FileRepo\File\File\transform(),MediaWiki\FileRepo\File\File\transformErrorOutput(),BitmapHandler\transformGd(),MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset(),MediaWiki\Storage\PageUpdater\updateRevision(),MediaWiki\Linker\Linker\userLink(),MediaWiki\Linker\Linker\userTalkLink(),MediaWiki\Linker\Linker\userToolLinks(),MediaWiki\Page\Article\view(),MediaWiki\Session\CookieSessionProvider\whyNoSession(),MediaWiki\Session\ImmutableSessionProviderWithCookie\whyNoSession(), andMediaWiki\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 line848 of fileGlobalFunctions.php.

Referenced byMediaWiki\FileRepo\FileRepo\getDisplayName(),MediaWiki\Page\ImagePage\openShowImage(),MediaWiki\Skin\SkinTemplate\tabAction(), andwfMessage().

◆ 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. Callers should make sure this is not a storage path.
int | null$modeChmod value to use, default is $wgDirectoryMode
string | null$callerOptional caller param for debugging.
Returns
bool

Definition at line1358 of fileGlobalFunctions.php.

References$wgDirectoryMode, andwfDebug().

Referenced byMediaWiki\Cache\FileCacheBase\checkCacheDirs(),DjVuHandler\doTransform(),SvgHandler\doTransform(),TransformationalImageHandler\doTransform(),GenerateSitemap\execute(),MediaWiki\Utils\GitInfo\precomputeValues(),LCStoreCDB\startWrite(), andLCStoreStaticArray\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 line860 of fileGlobalFunctions.php.

Referenced byMediaWiki\Exception\MWException\msg().

◆ wfObjectToArray()

wfObjectToArray($objOrArray,
$recursive =true )

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

Parameters
object | array$objOrArray
bool$recursive
Returns
array

Definition at line219 of fileGlobalFunctions.php.

ReferenceswfObjectToArray().

Referenced bywfObjectToArray().

◆ wfParseUrl()

wfParseUrl($url)

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

Differences:

1) Handles protocols that don't use :// (e.g., mailto: andnews:, 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(); hard-deprecated since 1.45
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 ashttp://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; seewfCgiToArray() for parsing it), can be missing.
  • fragment: the part after #, can be missing.

Definition at line592 of fileGlobalFunctions.php.

References$url,wfDeprecated(), andwfGetUrlUtils().

◆ 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 line1417 of fileGlobalFunctions.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 line245 of fileGlobalFunctions.php.

Referenced byCompareParserCache\execute(),ResetPageRandom\execute(),MediaWiki\Specials\SpecialRandomInCategory\getRandomTitle(),MediaWiki\Specials\SpecialRandomPage\getRandomTitle(),MediaWiki\Page\WikiPage\insertOn(),MediaWiki\Title\Title\invalidateCache(), andMediaWiki\Api\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 useMWCryptRand instead.
Parameters
int$lengthThe length of the string to generate
Returns
string
Since
1.20

Definition at line263 of fileGlobalFunctions.php.

Referenced byMediaWiki\JobQueue\JobQueueDB\doPop(),SvgHandler\doTransform(),BenchmarkLruHash\execute(),BenchmarkSanitizer\execute(),MakeTestEdits\execute(),MediaWiki\Http\Telemetry\getRequestId(),BenchmarkTitleValue\randomize(), andUploadSourceAdapter\registerSource().

◆ wfRecursiveRemoveDir()

wfRecursiveRemoveDir($dir)

Remove a directory and all its content.

Does not hide error.

Parameters
string$dir

Definition at line1394 of fileGlobalFunctions.php.

ReferenceswfRecursiveRemoveDir().

Referenced bywfRecursiveRemoveDir().

◆ 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 line1730 of fileGlobalFunctions.php.

References$path, andwfBaseName().

◆ 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 line1251 of fileGlobalFunctions.php.

Referenced byMediaWiki\Api\ApiMain\checkConditionalRequestHeaders(),MediaWiki\Output\OutputPage\checkLastModified(),MediaWiki\Specials\SpecialExport\execute(), andMediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().

◆ wfScript()

wfScript($script ='index')

Get the URL path to aMediaWiki entry point.

This is a wrapper to respect $wgScript and $wgLoadScript overrides.

See also
MW_ENTRY_POINT
Parameters
string$scriptName of entrypoint, without.php extension.
Returns
string

Definition at line1775 of fileGlobalFunctions.php.

References$wgLoadScript,$wgScript, and$wgScriptPath.

Referenced byMediaWiki\SpecialPage\SpecialPage\addFeedLinks(),MediaWiki\Specials\SpecialRedirect\dispatchLog(),MediaWiki\Specials\SpecialRedirect\dispatchPage(),MediaWiki\Specials\SpecialRedirect\dispatchRevision(),MediaWiki\Specials\SpecialRecentChanges\doHeader(),MediaWiki\Specials\SpecialWatchlist\doHeader(),MediaWiki\SpecialPage\ContributionsSpecialPage\execute(),MediaWiki\Specials\SpecialApiHelp\execute(),MediaWiki\SpecialPage\RedirectSpecialPage\execute(),MediaWiki\Specials\SpecialRecentChanges\execute(),MediaWiki\Api\ApiEntryPoint\execute(),MediaWiki\Api\ApiHelp\fixHelpLinks(),MediaWiki\Specials\SpecialVersion\getEntryPointInfo(),MediaWiki\SpecialPage\ContributionsSpecialPage\getForm(),MediaWiki\Output\OutputPage\getHeadLinksArray(),MediaWiki\Pager\TablePager\getLimitForm(),MediaWiki\Api\ApiOpenSearch\getOpenSearchTemplate(),MediaWiki\Api\ApiRsd\getRsdApiList(),MediaWiki\Actions\Pager\HistoryPager\getStartBody(),MediaWiki\Actions\HistoryAction\onView(),MediaWiki\Search\SearchWidgets\SearchFormWidget\render(),MediaWiki\Api\ApiMain\substituteResultWithError(), andMediaWiki\Specials\SpecialUserRights\switchForm().

◆ wfSetBit()

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

As for wfSetVar except setting a bit.

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

Definition at line1172 of fileGlobalFunctions.php.

◆ wfSetVar()

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.

Parameters
mixed&$dest
mixed$source
bool$force
Returns
mixed

Definition at line1155 of fileGlobalFunctions.php.

References$source.

Referenced byMediaWiki\SpecialPage\SpecialPage\including(),MediaWiki\Block\DatabaseBlock\isAutoblocking(),MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(),MediaWiki\Parser\Parser\Options(),MediaWiki\Parser\Parser\OutputType(),MediaWiki\Parser\CacheTime\setCacheTime(),MediaWiki\Output\OutputPage\setFileVersion(),WikiImporter\setNoticeCallback(),MediaWiki\Parser\ParserOptions\setOptionLegacy(),MediaWiki\Output\OutputPage\setRevisionId(),MediaWiki\Parser\ParserOutput\setTimestamp(),MediaWiki\Parser\ParserOptions\setTimestamp(), andMediaWiki\Parser\ParserOutput\setTitleText().

◆ 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 classMediaWiki\Shell\Shell

Definition at line1512 of fileGlobalFunctions.php.

ReferenceswfGetCaller().

Referenced byDjVuHandler\doTransform(),DjVuImage\retrieveMetaData(), andwfShellExecWithStderr().

◆ 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 classMediaWiki\Shell\Shell

Definition at line1565 of fileGlobalFunctions.php.

ReferenceswfGetCaller(), andwfShellExec().

Referenced byMediaWiki\Upload\UploadVerification\detectVirus(),TransformationalImageHandler\getMagickVersion(),SvgHandler\rasterize(),BitmapHandler\rotate(),BitmapHandler\transformCustom(), andBitmapHandler\transformImageMagick().

◆ wfShellWikiCmd()

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

Generate a shell-escaped command line string to run aMediaWiki 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 line1585 of fileGlobalFunctions.php.

References$wgPhpCli.

Referenced byCleanupSpam\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 line1888 of fileGlobalFunctions.php.

Referenced byMediaWiki\Installer\Installer\envCheckMemory(),MediaWiki\Upload\UploadBase\getMaxPhpUploadSize(),MediaWiki\Api\ApiUpload\getMinUploadChunkSize(),MediaWiki\Request\WebRequestUpload\isIniSizeOverflow(),RunJobs\memoryLimit(),MediaWiki\Api\ApiMain\setupExternalResponse(), andwfMemoryLimit().

◆ 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 line1462 of fileGlobalFunctions.php.

Referenced bywfIniGetBool().

◆ 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 line1814 of fileGlobalFunctions.php.

References$wgIllegalFileChars, andwfBaseName().

Referenced byMediaWiki\Upload\UploadBase\getTitle(), andMediaWiki\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 line1340 of fileGlobalFunctions.php.

References$wgTmpDirectory.

Referenced bySvgHandler\doTransform(),MWDocGen\execute(),MediaWikiShell\execute(), andMediaWiki\ResourceLoader\Image\rasterize().

◆ wfThumbIsStandard()

wfThumbIsStandard(File$file,
array$params )

Returns true if these thumbnail parameters match one thatMediaWiki 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 fromthumb.php to GlobalFunctions in 1.25

Definition at line1938 of fileGlobalFunctions.php.

References$wgImageLimits,$wgResponsiveImages,$wgThumbLimits, andMediaWiki\FileRepo\File\File\getHandler().

◆ 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 line1296 of fileGlobalFunctions.php.

ReferenceswfDebug().

Referenced byMediaWiki\Block\AbstractBlock\__construct(),MediaWiki\Output\OutputPage\adaptCdnTTL(),DumpCategoriesAsRdf\addDumpHeader(),MediaWiki\Api\ApiMain\addRequestedFields(),MediaWiki\SpecialPage\ChangesListSpecialPage\buildQuery(),MediaWiki\Cache\FileCacheBase\cacheTimestamp(),MediaWiki\Api\ApiMain\checkConditionalRequestHeaders(),MediaWiki\Output\OutputPage\checkLastModified(),MediaWiki\Language\Language\date(),LanguageWa\date(),DifferenceEngine\debug(),MediaWiki\Specials\SpecialExport\execute(),MediaWiki\Api\ApiEditPage\execute(),MediaWiki\Api\ApiFeedWatchlist\execute(),MediaWiki\Api\ApiQueryAllUsers\execute(),MediaWiki\Api\ApiQueryBlocks\execute(),MediaWiki\Api\ApiQueryDeletedrevs\execute(),MediaWiki\Api\ApiQueryFilearchive\execute(),MediaWiki\Api\ApiQueryImageInfo\execute(),MediaWiki\Api\ApiSetNotificationTimestamp\execute(),MediaWiki\Api\ApiUndelete\execute(),MediaWiki\FileRepo\File\LocalFileRestoreBatch\execute(),BenchmarkParse\execute(),CleanupUploadStash\execute(),ExpireTemporaryAccounts\execute(),FixTimestamps\execute(),GenerateSitemap\execute(),ImportTextFiles\execute(),RemoveUnusedAccounts\execute(),TestCompression\execute(),UpdateSearchIndex\execute(),MediaWiki\User\UserGroupAssignmentService\expiryToTimestamp(),MediaWiki\Api\ApiQueryRevisionsBase\extractRevisionInfo(),MediaWiki\Api\ApiQueryRecentChanges\extractRowInfo(),MediaWiki\FileRepo\RepoGroup\findFile(),MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(),MediaWiki\Feed\FeedUtils\formatDiff(),MediaWiki\Language\Language\formatExpiry(),MediaWiki\Api\ApiResult\formatExpiry(),MediaWiki\Logging\LogFormatter\formatParameterValueForApi(),MediaWiki\Specials\SpecialUndelete\formatRevisionRow(),MediaWiki\Specials\Pager\MergeHistoryPager\formatRow(),MediaWiki\Specials\Pager\ImageListPager\formatValue(),RevDelArchivedFileItem\getApiData(),RevDelFileItem\getApiData(),RevDelRevisionItem\getApiData(),MediaWiki\Block\DatabaseBlockStore\getAutoblockExpiry(),MediaWiki\Api\ApiBlockInfoHelper\getBlockDetails(),MediaWiki\Logging\NewUsersLogFormatter\getComment(),MediaWiki\FileRepo\File\LocalFile\getDescriptionTouched(),MediaWiki\User\User\getExperienceLevel(),FormatMetadata\getExtendedMetadataFromFile(),MediaWiki\Api\ApiQueryImageInfo\getInfo(),MediaWiki\Specials\SpecialActiveUsers\getIntroText(),MediaWiki\Logging\LogFormatter\getIRCActionText(),MediaWiki\Output\OutputPage\getJSVars(),MediaWiki\RCFeed\MachineReadableRCFeedFormatter\getLine(),MediaWiki\Logging\BlockLogFormatter\getMessageParameters(),PNGMetadataExtractor\getMetadata(),MediaWiki\Specials\SpecialRandomInCategory\getMinAndMaxForCat(),MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(),MediaWiki\Logging\BlockLogFormatter\getParametersForApi(),MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(),MediaWiki\Specials\Pager\ActiveUsersPager\getQueryInfo(),MediaWiki\Actions\RawAction\getRawText(),DifferenceEngine\getRevisionHeader(),MediaWiki\Page\ImageHistoryList\getThumbForLine(),MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache(),MediaWiki\FileRepo\File\ArchivedFile\getTimestamp(),MediaWiki\FileRepo\File\ForeignAPIFile\getTimestamp(),MediaWiki\Logging\DatabaseLogEntry\getTimestamp(),MediaWiki\Logging\ManualLogEntry\getTimestamp(),MediaWiki\Logging\RCDatabaseLogEntry\getTimestamp(),MediaWiki\RevisionList\RevisionItemBase\getTimestamp(),MediaWiki\User\User\getTouched(),MediaWiki\Page\SitemapGenerator\getXml(),MediaWiki\FileRepo\ForeignAPIRepo\httpGet(),MediaWiki\Page\ImageHistoryList\imageHistoryLine(),MediaWiki\JobQueue\Jobs\HTMLCacheUpdateJob\invalidateTitles(),MediaWiki\User\User\isEmailConfirmationPending(),MediaWiki\RecentChanges\RecentChange\isInRCLifespan(),MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(),MediaWiki\User\User\loadDefaults(),MediaWiki\User\User\loadFromCache(),MediaWiki\RecentChanges\RecentChange\loadFromRow(),MediaWiki\User\User\loadFromRow(),MediaWiki\FileRepo\File\LocalFile\loadFromRow(),FormatMetadata\makeFormattedData(),MediaWiki\Session\Token\match(),MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(),MediaWiki\Output\OutputPage\output(),MediaWiki\Specials\SpecialRecentChanges\outputChangesList(),MediaWiki\Storage\PageEditStash\parseAndCache(),TableCleanup\progress(),MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(),MediaWiki\FileRepo\File\LocalFile\publishTo(),MediaWiki\SpecialPage\QueryPage\recache(),MediaWiki\Api\ApiQueryQueryPage\run(),MediaWiki\JobQueue\Jobs\CategoryMembershipChangeJob\run(),MediaWiki\Api\ApiMain\sendCacheHeaders(),MediaWiki\Output\OutputPage\setLastModified(),WikiRevision\setTimestamp(),MediaWiki\Maintenance\BackupDumper\showReport(),MediaWiki\Maintenance\TextPassDumper\showReport(),MediaWiki\Language\Language\time(),MediaWiki\Language\Language\timeanddate(),MediaWiki\Session\Token\toString(),MediaWiki\Api\ApiUpload\transformWarnings(),MediaWiki\RecentChanges\RecentChangesUpdateJob\updateActiveUsers(),MediaWiki\Block\DatabaseBlockStore\updateBlock(),MediaWiki\Block\DatabaseBlockStore\updateTimestamp(),CategoryChangesAsRdf\updateTS(),wfTimestampOrNull(), andXmlDumpWriter\writeTimestamp().

◆ wfTimestampNow()

wfTimestampNow()

Convenience function; returnsMediaWiki timestamp for the present time.

Returns
string TS_MW timestamp

Definition at line1325 of fileGlobalFunctions.php.

Referenced byMediaWiki\User\UserGroupMembership\__construct(),MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(),MediaWiki\RecentChanges\CategoryMembershipChange\__construct(),MediaWiki\User\User\confirmEmail(),MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(),MediaWiki\Block\DatabaseBlockStore\doAutoblock(),MediaWiki\Specials\SpecialWatchlist\doHeader(),MediaWiki\Specials\SpecialExport\execute(),MediaWiki\Api\ApiEditPage\execute(),MediaWiki\Api\ApiPurge\execute(),MediaWiki\Api\ApiUserrights\execute(),GenerateSitemap\execute(),ImportTextFiles\execute(),MigrateFileRepoLayout\execute(),ResetUserEmail\execute(),UpdateSearchIndex\execute(),FormatMetadata\fetchExtendedMetadata(),MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(),MediaWiki\Logging\ManualLogEntry\getTimestamp(),MediaWiki\Parser\ParserOptions\getTimestamp(),MediaWiki\EditPage\EditPage\importFormData(),MediaWiki\Logging\ManualLogEntry\insert(),MediaWiki\Block\DatabaseBlock\isExpired(),MediaWiki\JobQueue\Job\newRootJobParams(),MediaWiki\Specials\SpecialLockdb\onSubmit(),MediaWiki\Feed\AtomFeed\outHeader(),MediaWiki\Feed\RSSFeed\outHeader(),MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(),MediaWiki\SpecialPage\UserGroupsSpecialPage\readGroupsForm(),MediaWiki\Logging\LogPage\saveContent(),MediaWiki\Cache\HTMLFileCache\saveToFileCache(),MediaWiki\Session\MultiBackendSessionStore\shutdown(), andMediaWiki\Session\SingleBackendSessionStore\shutdown().

◆ wfTimestampOrNull()

wfTimestampOrNull($outputtype =TS_UNIX,
$ts =null )

Return a formatted timestamp, or null if input is null.

For dealing with nullable timestamp columns in the database.

Parameters
mixed$outputtype
mixed | null$ts
Returns
string|false|null Null if called with null, otherwise the result ofwfTimestamp()

Definition at line1312 of fileGlobalFunctions.php.

ReferenceswfTimestamp().

Referenced byMediaWiki\Api\ApiQueryUsers\execute(),ResetPageRandom\execute(),MediaWiki\User\Registration\LocalUserRegistrationProvider\fetchRegistration(),MediaWiki\Rest\Handler\PageHistoryCountHandler\getLastModifiedTimes(),MediaWiki\Watchlist\NoWriteWatchedItemStore\getLatestNotificationTimestamp(),MediaWiki\Watchlist\WatchedItemStore\getLatestNotificationTimestamp(),MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(),MediaWiki\JobQueue\Job\getQueuedTimestamp(),MediaWiki\JobQueue\Job\getReleaseTimestamp(),MediaWiki\JobQueue\JobSpecification\getReleaseTimestamp(),MediaWiki\JobQueue\Jobs\HTMLCacheUpdateJob\invalidateTitles(),MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), andMediaWiki\User\User\loadFromRow().

◆ wfTransactionalTimeLimit()

wfTransactionalTimeLimit()

Raise the request time limit to $wgTransactionalTimeLimit.

Returns
int Prior time limit
Since
1.26

Definition at line1858 of fileGlobalFunctions.php.

References$wgTransactionalTimeLimit.

Referenced byMediaWiki\Actions\Action\useTransactionalTimeLimit(),MediaWiki\Api\ApiBase\useTransactionalTimeLimit(), andMediaWiki\SpecialPage\SpecialPage\useTransactionalTimeLimit().

◆ 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 line298 of fileGlobalFunctions.php.

Referenced byMediaWiki\Title\Title\__wakeup(),MediaWiki\Output\OutputPage\addHelpLink(),MediaWiki\Parser\CoreParserFunctions\basepagenamee(),MediaWiki\FileRepo\FileRepo\getDescriptionRenderUrl(),MediaWiki\FileRepo\FileRepo\getDescriptionUrl(),MediaWiki\Title\Title\getLocalURL(),MediaWiki\Site\MediaWikiSite\getPageUrl(),MediaWiki\Title\TitleFormatter\getPrefixedURL(),MediaWiki\Title\Title\getPrefixedURL(),MediaWiki\Title\Title\getSubpageUrlForm(),MediaWiki\Interwiki\Interwiki\getURL(),MediaWiki\Api\ApiBase\logFeatureUsage(),MediaWiki\Api\ApiMain\logRequest(),MediaWiki\Title\Title\makeTitle(),MediaWiki\Parser\CoreParserFunctions\namespacee(),MediaWiki\Parser\CoreParserFunctions\nse(),MediaWiki\Parser\CoreParserFunctions\rootpagenamee(),MediaWiki\Parser\CoreParserFunctions\speciale(),MediaWiki\Parser\CoreParserFunctions\subjectspacee(),MediaWiki\Parser\CoreParserFunctions\talkspacee(), andMediaWiki\OutputTransform\Stages\DeduplicateStyles\transformText().

◆ wfUrlProtocols()

wfUrlProtocols($includeProtocolRelative =true)

Returns a partial regular expression of recognized URL protocols, e.g.

"http:\\/\\/|https:\\/\\/"

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

Definition at line546 of fileGlobalFunctions.php.

ReferenceswfDeprecated(), andwfGetUrlUtils().

◆ wfUrlProtocolsWithoutProtRel()

wfUrlProtocolsWithoutProtRel()

LikewfUrlProtocols(), 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(); hard-deprecated since 1.44
Returns
string

Definition at line560 of fileGlobalFunctions.php.

ReferenceswfDeprecated(), andwfGetUrlUtils().

◆ 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 line1190 of fileGlobalFunctions.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, usewfLogWarning() 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 line781 of fileGlobalFunctions.php.

Referenced byExif\__construct(),MediaWiki\Content\TextContent\__construct(),MediaWiki\Html\Html\addClass(),MediaWiki\Storage\SqlBlobStore\decompressData(),MediaWiki\Api\ApiEditPage\execute(),MediaWiki\FileRepo\ForeignAPIRepo\fileExistsBatch(),MediaWiki\SpecialPage\SpecialPageFactory\getAliasList(),MediaWiki\Specials\Pager\ContribsPager\getExtraSortFields(),MediaWiki\Specials\Pager\ContribsPager\getIndexField(),MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(),MediaWiki\Language\Language\getMagic(),MediaWiki\Revision\SlotRoleRegistry\getRoleHandler(),MediaWiki\Actions\ActionEntryPoint\initializeArticle(),MediaWiki\Linker\Linker\link(),MediaWiki\Html\Html\linkedScript(),MediaWiki\Linker\Linker\makeBrokenImageLinkObj(),MediaWiki\Html\Html\openElement(), andMediaWiki\JobQueue\Utils\BacklinkJobUtils\partitionBacklinkJob().


[8]ページ先頭

©2009-2025 Movatter.jp