MediaWiki REL1_37
|
Global functions used everywhere. More...
Go to the source code of this file.
Functions | |
mimeTypeMatch ( $type, $avail) | |
Checks if a given MIME type matches any of the keys in the given array. | |
wfAppendQuery ( $url, $query) | |
Append a query string to an existing URL, which may or may not already have query string parameters already. | |
wfArrayDiff2 ( $a, $b) | |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays. | |
wfArrayDiff2_cmp ( $a, $b) | |
wfArrayInsertAfter (array $array, array $insert, $after) | |
Insert 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. | |
wfCanIPUseHTTPS ( $ip) | |
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS. | |
wfCgiToArray ( $query) | |
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns the same string in array form. | |
wfClearOutputBuffers () | |
More legible than passing a 'false' parameter to wfResetOutputBuffers(): | |
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) | |
Version of escapeshellarg() that works better on Windows. | |
wfEscapeWikiText ( $text) | |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc. | |
wfExpandIRI ( $url) | |
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences. | |
wfExpandUrl ( $url, $defaultProto=PROTO_CURRENT) | |
Expand a potentially local URL to a fully-qualified URL. | |
wfFindFile ( $title, $options=[]) | |
Find a file. | |
wfFormatStackFrame ( $frame) | |
Return a string representation of frame. | |
wfGetAllCallers ( $limit=3) | |
Return a string consisting of callers in the stack. | |
wfGetCache ( $cacheType) | |
Get a specific cache object. | |
wfGetCaller ( $level=2) | |
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie. | |
wfGetDB ( $db, $groups=[], $wiki=false) | |
Get a Database object. | |
wfGetLangObj ( $langcode=false) | |
Return a Language object from $langcode. | |
wfGetLB ( $wiki=false) | |
Get a load balancer object. | |
wfGetMainCache () | |
Get the main cache object. | |
wfGetNull () | |
Get a platform-independent path to the null file, e.g. | |
wfGetScriptUrl () | |
Get the script URL. | |
wfGetServerUrl ( $proto) | |
Get the wiki's "server", i.e. | |
wfHostname () | |
Get host name of the current machine, for use in error reporting. | |
wfHttpError ( $code, $label, $desc) | |
Provide a simple HTTP error. | |
wfIncrStats ( $key, $count=1) | |
Increment a statistics counter. | |
wfIniGetBool ( $setting) | |
Safety wrapper around ini_get() for boolean settings. | |
wfIsCLI () | |
Check if we are running from the commandline. | |
wfIsDebugRawPage () | |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false. | |
wfIsInfinity ( $str) | |
Determine input string is represents as infinity. | |
wfIsWindows () | |
Check if the operating system is Windows. | |
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. | |
wfLocalFile ( $title) | |
Get an object referring to a locally registered file. | |
wfLogDBError ( $text, array $context=[]) | |
Log for database errors. | |
wfLogProfilingData () | |
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 ( $old, $mine, $yours, &$result, &$mergeAttemptResult=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) | |
wfQueriesMustScale () | |
Should low-performance queries be disabled? | |
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. | |
wfReadOnly () | |
Check whether the wiki is in read-only mode. | |
wfReadOnlyReason () | |
Check if the site is in read-only mode and return the message if so. | |
wfRecursiveRemoveDir ( $dir) | |
Remove a directory and all its content. | |
wfRelativePath ( $path, $from) | |
Generate a relative path name to the given file. | |
wfRemoveDotSegments ( $urlPath) | |
Remove all dot-segments in the provided URL path. | |
wfReportTime ( $nonce=null) | |
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'. | |
wfResetOutputBuffers ( $resetGzipEncoding=true) | |
Clear away any user-level output buffers, discarding contents. | |
wfScript ( $script='index') | |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptPath etc. | |
wfSetBit (&$dest, $bit, $state=true) | |
As for wfSetVar except setting a bit. | |
wfSetVar (&$dest, $source, $force=false) | |
Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL. | |
wfShellExec ( $cmd, &$retval=null, $environ=[], $limits=[], $options=[]) | |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported. | |
wfShellExecWithStderr ( $cmd, &$retval=null, $environ=[], $limits=[]) | |
Execute a shell command, returning both stdout and stderr. | |
wfShellWikiCmd ( $script, array $parameters=[], array $options=[]) | |
Generate a shell-escaped command line string to run a MediaWiki cli script. | |
wfShorthandToInteger (?string $string='', int $default=-1) | |
Converts shorthand byte notation to integer form. | |
wfShowingResults ( $offset, $limit) | |
wfStringToBool ( $val) | |
Convert string value to boolean, when the following are interpreted as true: | |
wfStripIllegalFilenameChars ( $name) | |
Replace all invalid characters with '-'. | |
wfTempDir () | |
Tries to get the system directory for temporary files. | |
wfThumbIsStandard (File $file, array $params) | |
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output. | |
wfTimestamp ( $outputtype=TS_UNIX, $ts=0) | |
Get a timestamp string in one of various formats. | |
wfTimestampNow () | |
Convenience function; returns MediaWiki timestamp for the present time. | |
wfTimestampOrNull ( $outputtype=TS_UNIX, $ts=null) | |
Return a formatted timestamp, or null if input is null. | |
wfTransactionalTimeLimit () | |
Raise the request time limit to $wgTransactionalTimeLimit. | |
wfUnpack ( $format, $data, $length=false) | |
Wrapper around php's unpack. | |
wfUrlencode ( $s) | |
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default. | |
wfUrlProtocols ( $includeProtocolRelative=true) | |
Returns a regular expression of url protocols. | |
wfUrlProtocolsWithoutProtRel () | |
Like wfUrlProtocols(), but excludes '//' from the protocol list. | |
wfVarDump ( $var) | |
A wrapper around the PHP function var_export(). | |
wfWarn ( $msg, $callerOffset=1, $level=E_USER_NOTICE) | |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings. | |
wfWikiID () | |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys. | |
Global functions used everywhere.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html
Definition in file GlobalFunctions.php.
mimeTypeMatch | ( | $type, | |
$avail | |||
) |
Checks if a given MIME type matches any of the keys in the given array.
Basic wildcards are accepted in the array keys.
Returns the matching MIME type (or wildcard) if a match, otherwise NULL if no match.
string | $type | |
array | $avail |
Definition at line 1668 of file GlobalFunctions.php.
References $type.
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.
string | $url | |
string | array | $query | String or associative array |
Definition at line 422 of file GlobalFunctions.php.
References wfArrayToCgi().
Referenced by SpecialPage\addFeedLinks(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialApiHelp\execute(), SpecialContributions\execute(), LoginSignupSpecialPage\execute(), RedirectSpecialPage\execute(), SpecialRecentChanges\execute(), ImportSiteScripts\execute(), ImportSiteScripts\fetchScriptList(), ApiHelp\fixHelpLinks(), FileRepo\getDescriptionRenderUrl(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), MediaWiki\Linker\LinkRenderer\getLinkURL(), Title\getLocalURL(), ContentSecurityPolicy\getReportUri(), MediaWiki\Rest\Router\getRouteUrl(), ImageHandler\getScriptedTransform(), File\getTransformScript(), Linker\getUploadUrl(), ResourceLoaderImage\getUrl(), ForeignAPIRepo\httpGetCached(), Linker\makeThumbLink2(), FileRepo\makeUrl(), ImportStreamSource\newFromInterwiki(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), MediaWiki\Sparql\SparqlClient\query(), and wfApiMain().
wfArrayDiff2 | ( | $a, | |
$b | |||
) |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
array | $a | |
array | $b |
Definition at line 113 of file GlobalFunctions.php.
Referenced by EditPage\getEditPermissionErrors().
wfArrayDiff2_cmp | ( | $a, | |
$b | |||
) |
array | string | $a | |
array | string | $b |
Definition at line 122 of file GlobalFunctions.php.
wfArrayInsertAfter | ( | array | $array, |
array | $insert, | ||
$after | |||
) |
Insert array into another array after the specified KEY
array | $array | |
array | $insert | The array to insert. |
mixed | $after | The key to insert after. Callers need to make sure the key is set. |
Definition at line 189 of file GlobalFunctions.php.
References $keys.
Referenced by ApiComparePages\getAllowedParams(), SpecialDeletedContributions\getSubTitle(), SkinTemplate\injectLegacyMenusIntoPersonalTools(), and UpdateExtensionJsonSchema\updateTo2().
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).
array | $baseArray | The array where you want to add the values of $newValues to |
array | $newValues | An array with new values |
Definition at line 2652 of file GlobalFunctions.php.
Referenced by HTMLUserTextField\__construct(), and ExtensionRegistry\exportExtractedData().
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.
array | $array1 | ( String|Array ) |
array | null | $array2 | ( String|Array ) |
string | $prefix |
Definition at line 330 of file GlobalFunctions.php.
References wfArrayToCgi().
Referenced by WebRequest\appendQueryArray(), SpecialPage\checkLoginSecurityLevel(), SpecialNewpages\execute(), PhpHttpRequest\execute(), PopulateInterwiki\fetchLinks(), Title\fixUrlQueryArgs(), AllMessagesTablePager\formatValue(), WebInstallerOptions\getCCPartnerUrl(), MediaTransformOutput\getDescLinkAttribs(), FormAction\getForm(), FormSpecialPage\getForm(), SpecialRunJobs\getQuerySignature(), SkinTemplate\getReturnToParam(), WebInstaller\getUrl(), AuthManagerSpecialPage\handleReauthBeforeExecute(), FindBadBlobs\markBlob(), UserNotLoggedIn\report(), SkinTemplate\setupTemplateContext(), PurgeAction\show(), EditPage\showHeader(), OutputPage\showPermissionsErrorPage(), ChangesListSpecialPage\validateOptions(), wfApiMain(), wfAppendQuery(), and wfArrayToCgi().
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]
array | $urlParts | URL parts, as output from wfParseUrl |
Definition at line 570 of file GlobalFunctions.php.
Referenced by ApiCSPReport\matchUrlPattern(), ApiCSPReport\originFromUrl(), and wfExpandUrl().
wfBacktrace | ( | $raw = null | ) |
Get a debug backtrace as a string.
bool | null | $raw | If true, the return value is plain text. If false, HTML. Defaults to $wgCommandLineMode if unset. |
Definition at line 1322 of file GlobalFunctions.php.
References $file, $line, $wgCommandLineMode, and wfDebugBacktrace().
Referenced by LinkBatch\addObj(), MediaWiki\Revision\RevisionStore\constructSlotRecords(), MediaWiki\Revision\RevisionStore\ensureRevisionRowMatchesPage(), MediaWiki\Revision\RevisionStore\getPage(), MediaWiki\Revision\RevisionStore\loadSlotContent(), MediaWiki\Revision\RevisionStore\loadSlotRecords(), MediaWiki\Revision\RevisionStore\newRevisionFromRowAndSlots(), and MWDebug\sendRawDeprecated().
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.
string | $path | |
string | $suffix | String to remove if present |
Definition at line 2117 of file GlobalFunctions.php.
References $matches, and $path.
Referenced by Exif\__construct(), ImageBuilder\checkMissingImage(), FileOpPerfTest\doPerfTest(), ImportImages\execute(), wfImageAuthMain(), wfRelativePath(), and wfStripIllegalFilenameChars().
wfBoolToStr | ( | $value | ) |
Convenience function converts boolean values into "true" or "false" (string) values.
bool | $value |
Definition at line 2350 of file GlobalFunctions.php.
Referenced by ApiRsd\formatRsdApiList().
wfCanIPUseHTTPS | ( | $ip | ) |
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS.
string | $ip | The IPv4/6 address in the normal human-readable form |
Definition at line 2535 of file GlobalFunctions.php.
References wfDeprecated().
wfCgiToArray | ( | $query | ) |
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns the same string in array form.
This allows compatibility with legacy functions that accept raw query strings instead of nice arrays. Of course, keys and values are urldecode()d.
string | $query | Query string |
Definition at line 375 of file GlobalFunctions.php.
References $keys.
Referenced by SkinTemplate\getReturnToParam(), Linker\makeBrokenImageLinkObj(), SpecialChangeEmail\onSuccess(), OutputPage\returnToMain(), LoginHelper\showReturnToPage(), MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), and SpecialCreateAccount\successfulAction().
wfClearOutputBuffers | ( | ) |
More legible than passing a 'false' parameter to wfResetOutputBuffers():
Clear away output buffers, but keep the Content-Encoding header produced by ob_gzhandler, if any.
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.
Definition at line 1651 of file GlobalFunctions.php.
References wfDeprecated(), and wfResetOutputBuffers().
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.
bool | $force | Forces another check even if we already have a cached result. |
Definition at line 1421 of file GlobalFunctions.php.
References wfDebug().
Referenced by MediaWiki\OutputHandler\handleGzip(), HTMLFileCache\loadFromFileCache(), and HTMLFileCache\saveToFileCache().
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.
string | $text | |
string | bool | $dest | Destination of the message:
|
array | $context | Additional logging context data |
Definition at line 894 of file GlobalFunctions.php.
References $wgDebugLogPrefix, $wgDebugRawPage, and wfIsDebugRawPage().
Referenced by ApiMain\__construct(), DifferenceEngine\__construct(), UploadStashFile\__construct(), QuickTemplate\__construct(), ParserFactory\__construct(), UploadFromChunks\__construct(), UploadFromStash\__construct(), StubGlobalUser\_unstub(), StubObject\_unstub(), LogPage\actionText(), ImageGalleryBase\add(), MediaHandler\addMeta(), ParserOutput\addTrackingCategory(), Skin\afterContentHook(), Linker\blockLink(), SkinTemplate\buildContentActionUrls(), EmailNotification\canSendUserTalkEmail(), OutputPage\checkLastModified(), UploadBase\checkSvgScriptCallback(), UploadBase\checkXMLEncodingMissmatch(), JobQueueDB\claimOldest(), LocalRepo\cleanupDeletedBatch(), UploadBase\cleanupTempFile(), SpecialEditWatchlist\cleanupWatchlist(), UploadStash\clear(), CloneDatabase\cloneTableStructure(), MediaWiki\Storage\SqlBlobStore\compressData(), UploadFromChunks\concatenateChunks(), DjVuImage\convertDumpToXML(), UploadBase\createFromRequest(), WikiImporter\debug(), SVGReader\debug(), RecompressTracked\debug(), BaseDump\debug(), ChangeTags\deleteTagEverywhere(), UploadBase\detectScript(), UploadBase\detectVirus(), DiffEngine\diffInternal(), BitmapMetadataHandler\doApp13(), MediaWiki\Block\DatabaseBlock\doAutoblock(), JobQueueDB\doBatchPushInternal(), WikiFilePage\doPurge(), UserrightsPage\doSaveUserGroups(), DjVuHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), EditPage\edit(), MediaWiki\OutputHandler\emitContentLength(), ZipDirectoryReader\error(), SpecialUpload\execute(), LocalFileRestoreBatch\execute(), DjVuHandler\extractTreesFromXML(), MediaWiki\Storage\SqlBlobStore\fetchBlobs(), IcuCollation\fetchFirstLetterData(), Article\fetchRevisionRecord(), DiffEngine\find_middle_snake(), BlockLevelPass\findColonNoLinks(), WikiImporter\finishImportPage(), FormatMetadata\flattenArrayReal(), ContribsPager\formatRow(), DeletedContribsPager\formatRow(), FileRepo\freeTemp(), LCStoreCDB\get(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), User\getBlockedStatus(), PreferencesFormOOUI\getBody(), CoreParserFunctions\getCachedRevisionObject(), Action\getContext(), ContextSource\getContext(), Article\getContext(), SpecialPage\getContext(), SpecialVersion\getCreditsForExtension(), WikiPage\getDeletionUpdates(), File\getDescriptionText(), ForeignDBFile\getDescriptionText(), DifferenceEngine\getEngine(), UploadStash\getFile(), DoubleRedirectJob\getFinalDestination(), WikiFilePage\getForeignCategories(), GenderCache\getGenderOf(), DjVuImage\getInfo(), SpecialUpload\getInitialPageText(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), TransformationalImageHandler\getMagickVersion(), RequestContext\getMainAndWarn(), GIFMetadataExtractor\getMetadata(), PNGMetadataExtractor\getMetadata(), DjVuHandler\getMetaTree(), DjVuImage\getMultiPageInfo(), WebRequestUpload\getName(), Title\getNsText(), DjVuImage\getPageInfo(), SpecialEmailUser\getPermissionsError(), EditPage\getPreloadedContent(), GIFHandler\getSizeAndMetadata(), JpegHandler\getSizeAndMetadata(), PNGHandler\getSizeAndMetadata(), SvgHandler\getSizeAndMetadata(), TiffHandler\getSizeAndMetadata(), DjVuHandler\getSizeAndMetadata(), SpecialEmailUser\getTarget(), ForeignAPIRepo\getThumbError(), ForeignAPIRepo\getThumbUrl(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), Title\getTitleValue(), File\getViewURL(), XCFHandler\getXCFMetaData(), MediaWiki\OutputHandler\handleGzip(), OutputPage\haveCacheVaryCookies(), ThumbnailRenderJob\hitThumbUrl(), ForeignAPIRepo\httpGet(), EditPage\importFormData(), WikiRevision\importLogItem(), EditPage\internalAttemptSave(), FileCacheBase\isCacheGood(), MediaWiki\Shell\Shell\isDisabled(), DjVuHandler\isEnabled(), SvgHandler\isEnabled(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), MediaWiki\Block\DatabaseBlock\isExpired(), FileDependency\isExpired(), ExifBitmapHandler\isFileMetadataValid(), GIFHandler\isFileMetadataValid(), PNGHandler\isFileMetadataValid(), WebPHandler\isFileMetadataValid(), MovePage\isValidMoveTarget(), SiteStats\loadAndLazyInit(), User\loadFromCache(), HTMLFileCache\loadFromFileCache(), PopulateArchiveRevId\makeDummyRevisionRow(), Linker\makeExternalImage(), Linker\makeExternalLink(), Linker\makeImageLink(), Linker\makeMediaLinkFile(), ImportStreamSource\newFromURL(), WikiImporter\notice(), RawAction\onView(), DumpUploads\outputItem(), SearchMySQL\parseQuery(), SearchSqlite\parseQuery(), SearchPostgres\parseQuery(), BacklinkCache\partition(), DiffHistoryBlob\patch(), AjaxDispatcher\performAction(), ApiUpload\performStash(), MediaWiki\preOutputCommit(), SpecialUpload\processUpload(), LocalFile\purgeThumbList(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), TextPassDumper\readDump(), UploadStash\removeFileNoAuth(), WikiPage\replaceSectionAtRev(), MediaWiki\restInPeace(), DjVuImage\retrieveMetaData(), BitmapHandler\rotate(), DoubleRedirectJob\run(), FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), SearchPostgres\searchQuery(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), OutputPage\sendCacheControl(), UserMailer\sendInternal(), UserMailer\sendWithPear(), ApiMain\setCacheMode(), ManualLogEntry\setTags(), ViewAction\show(), SpecialUploadStash\showUploads(), LocalRepo\skipWriteOperationIfSha1(), User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), DeleteAction\tempDeleteArticle(), WikiImporter\throwXmlError(), MediaWiki\Tidy\RemexDriver\tidy(), MediaWiki\Tidy\RemexCompatMunger\trace(), File\transform(), BitmapHandler\transformCustom(), BitmapHandler\transformGd(), BitmapHandler\transformImageMagick(), BitmapHandler\transformImageMagickExt(), LocalisationCacheBulkLoad\trimCache(), Article\tryFileCache(), UploadFromChunks\updateChunkStatus(), LocalFile\upgradeRow(), OldLocalFile\upgradeRow(), MediaWiki\Revision\RevisionRecord\userCanBitfield(), Linker\userLink(), Linker\userTalkLink(), Linker\userToolLinks(), SpecialEmailUser\validateTarget(), ImageHandler\validateThumbParams(), UploadBase\verifyExtension(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), ApiUpload\verifyUpload(), Article\view(), WikiImporter\warn(), wfApiMain(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfGetLangObj(), wfMemoryLimit(), wfMerge(), wfMkdirParents(), wfRecursiveRemoveDir(), and wfTimestamp().
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).
int | $limit | This parameter can be used to limit the number of stack frames returned |
Definition at line 1294 of file GlobalFunctions.php.
References wfDebug().
Referenced by MWDebug\getCallerDescription(), wfBacktrace(), wfGetAllCallers(), and wfGetCaller().
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.
string | $logGroup | |
string | $text | |
string | bool | $dest | Destination of the message:
|
array | $context | Additional logging context data |
Definition at line 958 of file GlobalFunctions.php.
Referenced by GitInfo\__construct(), RCCacheEntryFactory\buildCLink(), RCCacheEntryFactory\buildDiffLink(), ApiMain\checkBotReadOnly(), UploadFromChunks\concatenateChunks(), IPTC\convIPTCHelper(), Exif\debug(), Exif\debugFile(), WebPHandler\decodeLosslessChunkHeader(), WebPHandler\decodeLossyChunkHeader(), JobQueueRedis\doAck(), JobQueueRedis\doBatchPush(), JobQueueRedis\doPop(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), CheckUsernames\execute(), WebPHandler\extractMetadata(), WebPHandler\extractMetadataFromChunks(), AutoLoader\find(), FormatMetadata\formatCoords(), Message\formatListParam(), IPTC\getCharset(), ContentHandler\getContentText(), ResourceLoaderImage\getImageData(), WebResponse\header(), CdnCacheUpdate\HTCPPurge(), PoolCounterWork\logError(), MediaHandler\logErrorForExternalProcess(), JobQueueFederated\logException(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), MediaWiki\maybeDoHttpsRedirect(), LocalFile\move(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), IPTC\parse(), GitInfo\precomputeValues(), MediaWiki\preOutputCommit(), CdnCacheUpdate\purge(), UploadFromUrl\reallyFetchFile(), MediaHandler\removeBadFile(), UploadFromUrl\saveTempFileChunk(), MWDebug\sendMessage(), WebResponse\setCookie(), WebResponse\statusHeader(), IPTC\timeHelper(), wfForbidden(), and wfImageAuthMain().
wfDeprecated | ( | $function, | |
$version = false , |
|||
$component = false , |
|||
$callerOffset = 2 |
|||
) |
Logs a warning that a deprecated feature was used.
To write a custom deprecation message, use wfDeprecatedMsg() instead.
string | $function | Feature that is deprecated. |
string | false | $version | Version of MediaWiki that the feature was deprecated in (Added in 1.19). |
string | bool | $component | Component to which the feature belongs. If false, it is assumed the function is in MediaWiki core (Added in 1.19). |
int | $callerOffset | How far up the call stack is the original caller. 2 = function that called the function that called wfDeprecated (Added in 1.20). |
InvalidArgumentException | If the MediaWiki version number specified by $version is neither a string nor false. |
Definition at line 997 of file GlobalFunctions.php.
Referenced by SearchResultSet\__construct(), DBAccessBase\__construct(), SearchUpdate\__construct(), MediaWiki\Tidy\RemexDriver\__construct(), TemplateParser\__construct(), MWHttpRequest\__construct(), SearchResult\__construct(), LinkHolderArray\__construct(), MediaWiki\Search\SearchWidgets\SimpleSearchResultWidget\__construct(), MediaWiki\Search\SearchWidgets\SimpleSearchResultSetWidget\__construct(), MediaWiki\EditPage\TextConflictHelper\__construct(), LinkCache\__construct(), __get(), User\__get(), __isset(), __set(), User\__set(), DeprecatedGlobal\_newObject(), StubGlobalUser\_newObject(), Skin\aboutLink(), User\addAutopromoteOnceGroups(), ApiModuleManager\addModule(), User\addWatch(), Wikimedia\Rdbms\LoadBalancer\approveMasterChanges(), Wikimedia\Rdbms\Database\assertConditionIsNotEmpty(), Wikimedia\Rdbms\Database\assertIsWritableMaster(), Parser\attributeStripCallback(), BaseSearchResultSet\bcIterator(), Wikimedia\Rdbms\LBFactory\beginMasterChanges(), Wikimedia\Rdbms\LoadBalancer\beginMasterChanges(), MediaWiki\HookContainer\HookContainer\callLegacyHook(), User\changeableByGroup(), User\changeableGroups(), MediaWiki\Debug\DeprecatablePropertyArray\checkDeprecatedAccess(), ActorMigrationBase\checkDeprecation(), ContentModelChange\checkPermissions(), ChangesListSpecialPage\checkStructuredFilterUiEnabled(), SpecialWatchlist\checkStructuredFilterUiEnabled(), SpecialBlock\checkUnblockSelf(), WebRequest\checkUrlExtension(), ContentHandler\cleanupHandlersCache(), Hooks\clear(), Language\commafy(), Wikimedia\Rdbms\LoadBalancer\commitMasterChanges(), Wikimedia\Rdbms\LBFactory\commitMasterChanges(), ResourceLoaderFileModule\compileLessFile(), MediaWiki\Linker\LinkRendererFactory\createForUser(), Http\createMultiClient(), FileBackendGroup\destroySingleton(), RepoGroup\destroySingleton(), LockManagerGroup\destroySingletons(), Skin\disclaimerLink(), Parser\doBlockLevels(), WikiPage\doDeleteUpdates(), WikiPage\doEditContent(), WatchAction\doUnwatch(), WatchAction\doWatch(), WatchAction\doWatchOrUnwatch(), Parser\enableOOUI(), MWNamespace\equals(), Maintenance\error(), Sanitizer\escapeIdReferenceList(), CentralIdLookup\factory(), FileJournal\factory(), Wikimedia\Rdbms\DatabasePostgres\fieldType(), Wikimedia\Rdbms\DatabaseMysqlBase\fieldType(), Wikimedia\Rdbms\LoadBalancer\finalizeMasterChanges(), FormatMetadata\flattenArrayContentLang(), Wikimedia\Rdbms\LoadBalancer\flushMasterSnapshots(), Wikimedia\Rdbms\LoadBalancer\forEachOpenMasterConnection(), Language\formatNum(), LinkCache\forUpdate(), BaseTemplate\getAfterPortlet(), Skin\getAllowedSkins(), LockManagerGroup\getAny(), Maintenance\getArg(), MWNamespace\getAssociated(), User\getAutomaticGroups(), User\getBoolOption(), User\getCanonicalName(), MWNamespace\getCategoryLinkType(), CategoryPage\getCategoryViewerClass(), ResourceLoaderContext\getConfig(), Skin\getCopyrightIcon(), LockManagerGroup\getDefault(), Title\getDefaultNamespace(), User\getDefaultOption(), User\getDefaultOptions(), WikiPage\getDeletionUpdates(), EnhancedChangesList\getDiffHistLinks(), User\getEffectiveGroups(), SpecialVersion\getExtAuthorsFileName(), SpecialVersion\getExtLicenseFileName(), User\getFirstEditTimestamp(), BaseTemplate\getFooterIcons(), SpecialContributions\getForm(), User\getFormerGroups(), ContentHandler\getForTitle(), File\getImageSize(), Skin\getIndicatorsHTML(), ActorMigrationBase\getInsertValuesWithTempTable(), User\getIntOption(), User\getLatestEditTimestamp(), MediaWiki\Storage\SqlBlobStore\getLegacyEncodingConversionLang(), Skin\getLogo(), ExternalStoreDB\getMaster(), DBFileJournal\getMasterDB(), ForeignDBViaLBRepo\getMasterDB(), LocalRepo\getMasterDB(), JobQueueDB\getMasterDB(), Wikimedia\Rdbms\Database\getMasterPos(), Wikimedia\Rdbms\DatabaseMysqlBase\getMasterPos(), Wikimedia\Rdbms\DBConnRef\getMasterPos(), Wikimedia\Rdbms\LoadBalancer\getMasterPos(), Wikimedia\Rdbms\DatabaseMysqlBase\getMasterServerInfo(), MWNamespace\getNamespaceContentModel(), User\getOptionKinds(), User\getOptions(), Skin\getPoweredBy(), Http\getProxy(), ArchivedFile\getRawDescription(), ArchivedFile\getRawUser(), ArchivedFile\getRawUserText(), MWNamespace\getRestrictionLevels(), NamespaceInfo\getRestrictionLevels(), User\getRights(), Skin\getSearchLink(), Skin\getSkinNames(), ExternalStoreDB\getSlave(), MediaWiki\Linker\LinkRenderer\getStubThreshold(), ParserOptions\getStubThreshold(), User\getStubThreshold(), MWNamespace\getSubject(), MWNamespace\getSubjectNamespaces(), MWNamespace\getTalk(), MWNamespace\getTalkNamespaces(), MediaWiki\Block\AbstractBlock\getTarget(), MediaWiki\Block\AbstractBlock\getTargetAndType(), Article\getTimestamp(), JobSpecification\getTitle(), BaseTemplate\getToolbox(), Wikimedia\Rdbms\Database\getTopologyRootMaster(), Wikimedia\Rdbms\DBConnRef\getTopologyRootMaster(), ArchivedFile\getUser(), File\getUser(), Parser\getUser(), ParserOptions\getUser(), WatchAction\getWatchToken(), JobQueue\getWiki(), EditPage\handleStatus(), Maintenance\hasArg(), MWNamespace\hasGenderDistinction(), Wikimedia\Rdbms\LBFactory\hasMasterChanges(), Wikimedia\Rdbms\LoadBalancer\hasMasterChanges(), Wikimedia\Rdbms\LoadBalancer\hasMasterConnection(), Wikimedia\Rdbms\LBFactory\hasOrMadeRecentMasterChanges(), Wikimedia\Rdbms\LoadBalancer\hasOrMadeRecentMasterChanges(), MWNamespace\hasTalkNamespace(), OutputPage\headElement(), DatabaseUpdater\ifNoActorTable(), WikiRevision\importUpload(), User\insertNewUser(), CommentStore\insertWithTempTable(), BotPassword\invalidateAllPasswordsForCentralId(), User\isAllowUsertalk(), MWNamespace\isCapitalized(), User\isCreatableName(), User\isIP(), User\isIPRange(), User\isLoggedIn(), MWNamespace\isMovable(), Title\isNamespaceProtected(), MWNamespace\isNonincludable(), MWNamespace\isSubject(), SpecialMute\isTargetBlacklisted(), User\isTempWatched(), User\isUsableName(), User\isValidUserName(), MWNamespace\isWatchable(), Title\isWatchable(), User\isWatched(), MediaWiki\Block\DatabaseBlock\isWhitelistedFromAutoblocks(), Wikimedia\Rdbms\LoadBalancer\lastMasterChangeTimestamp(), SpecialPage\listed(), User\listOptionKinds(), Skin\mainPageLink(), Skin\makeUrl(), Skin\makeVariablesScript(), Wikimedia\Rdbms\Database\masterPosWait(), Wikimedia\Rdbms\DBConnRef\masterPosWait(), User\matchEditTokenNoSuffix(), HtmlFileCacheUpdate\newFromTitles(), BaseSearchResultSet\next(), Linker\normaliseSpecialPage(), Parser\Options(), Parser\OutputType(), Wikimedia\Rdbms\LoadBalancer\pendingMasterChangeCallers(), ApiQueryBase\prefixedTitlePartToKey(), AbstractContent\preloadTransform(), WikiPage\prepareContentForEdit(), AbstractContent\preSaveTransform(), Skin\privacyLink(), Profiler\profileIn(), Profiler\profileOut(), MediaWiki\HookContainer\HookContainer\register(), RevDelList\reloadFromMaster(), Wikimedia\Rdbms\DatabasePostgres\remappedTableName(), BotPassword\removeAllPasswordsForCentralId(), User\removeWatch(), BaseTemplate\renderAfterPortlet(), User\resetIdByNameCache(), User\resetOptions(), BaseSearchResultSet\rewind(), Wikimedia\Rdbms\LBFactory\rollbackMasterChanges(), Wikimedia\Rdbms\LoadBalancer\rollbackMasterChanges(), MWExceptionHandler\rollbackMasterChangesAndLog(), Wikimedia\Rdbms\LoadBalancer\runMasterTransactionIdleCallbacks(), Wikimedia\Rdbms\LoadBalancer\runMasterTransactionListenerCallbacks(), MediaWiki\User\UserNamePrefixSearch\search(), Maintenance\setAgentAndTriggers(), ParserOptions\setAllowExternalImages(), ParserOptions\setAllowExternalImagesFrom(), CategoryPage\setCategoryViewerClass(), MediaWiki\Auth\AbstractAuthenticationProvider\setConfig(), MediaWiki\Session\SessionProvider\setConfig(), BagOStuff\setDebug(), ParserOptions\setEnableImageWhitelist(), setExtensionData(), MediaWiki\Session\SessionProvider\setHookContainer(), MediaWiki\Auth\AbstractAuthenticationProvider\setHookContainer(), SpecialPage\setListed(), MediaWiki\Auth\AbstractAuthenticationProvider\setLogger(), JobRunner\setLogger(), MediaWiki\Session\SessionProvider\setLogger(), MediaWiki\Auth\AbstractAuthenticationProvider\setManager(), MediaWiki\Session\SessionProvider\setManager(), RepoGroup\setSingleton(), MediaWiki\Linker\LinkRenderer\setStubThreshold(), ParserOptions\setStubThreshold(), ParserOptions\setTidy(), ParserOptions\setWrapOutputClass(), ApiQueryBase\showHiddenUsersAddBlockInfo(), LogEventsList\showOptions(), LockManagerGroup\singleton(), LinkCache\singleton(), MessageCache\singleton(), RepoGroup\singleton(), LogFormatter\styleRestricedElement(), MWNamespace\subjectEquals(), Skin\subPageSubtitle(), MediaWiki\Tidy\TidyDriverBase\supportsValidate(), Wikimedia\Rdbms\ResultWrapper\unwrap(), HTMLTitleTextField\validate(), Sanitizer\validateAttributes(), Wikimedia\Rdbms\LoadBalancer\waitForMasterPos(), MWNamespace\wantSignatures(), wfCanIPUseHTTPS(), wfClearOutputBuffers(), wfFindFile(), wfGetLB(), wfGetScriptUrl(), wfIncrStats(), wfLocalFile(), and MediaWiki\Session\PHPSessionHandler\write().
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.
string | $msg | The message |
string | false | $version | Version of MediaWiki that the function was deprecated in. |
string | bool | $component | Component to which the function belongs. If false, it is assumed the function is in MediaWiki core. |
int | false | $callerOffset | How far up the call stack is the original caller. 2 = function that called the function that called us. If false, the caller description will not be appended. |
Definition at line 1028 of file GlobalFunctions.php.
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), Wikimedia\Rdbms\DatabasePostgres\__construct(), ParsoidVirtualRESTService\__construct(), MediaWiki\User\UserIdentityValue\__construct(), MovePage\__construct(), StubGlobalUser\__destruct(), Article\__get(), Article\__set(), OutputPage\addVaryHeader(), ApiBase\checkTitleUserPermissions(), ApiBase\checkUserRightsAny(), MediaWiki\DAO\deprecateInvalidCrossWiki(), MediaWiki\User\ActorStore\deprecateInvalidCrossWikiParam(), Parser\expandMagicVariable(), ExtensionProcessor\extractSkins(), Title\fixUrlQueryArgs(), User\getActorId(), RecentChange\getAttribute(), MediaWiki\MediaWikiServices\getInstance(), HTMLInfoField\getOOUI(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), Sanitizer\getRecognizedTagData(), MediaWiki\MediaWikiServices\getService(), MediaWiki\Revision\RevisionStore\getTitle(), LocalFile\loadFromRow(), User\newSystemUser(), LinksUpdate\queueRecursiveJobsForTable(), ExtensionRegistry\readFromQueue(), Hooks\register(), MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml(), ApiQuerySearch\run(), MediaWiki\Block\DatabaseBlock\setBlocker(), CacheTime\setCacheTime(), SpecialSearch\showResults(), and MediaWiki\Search\SearchWidgets\DidYouMeanWidget\suggestionHtml().
wfEscapeShellArg | ( | $args | ) |
Version of escapeshellarg() that works better on Windows.
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+ (bug backported to earlier distro releases of PHP).
string|string[] | ...$args strings to escape and glue together, or a single array of strings parameter |
Definition at line 1907 of file GlobalFunctions.php.
References $args.
wfEscapeWikiText | ( | $text | ) |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
making its way through. This is achieved by substituting certain characters with HTML entities. As required by the callers, "<nowiki>" is not used.
string | $text | Text to be escaped |
-taint | $text | escapes_html |
Definition at line 1455 of file GlobalFunctions.php.
References $wgEnableMagicLinks, and $wgUrlProtocols.
Referenced by MalformedTitleException\__construct(), MediaHandler\addMeta(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), Parser\braceSubstitution(), SpecialPageLanguage\changePageLanguage(), ApiMain\checkAsserts(), ApiQueryImageInfo\checkParameterNormalise(), SpecialContributions\contributionsSub(), ApiMain\createPrinterByName(), CoreParserFunctions\defaultsort(), CoreParserFunctions\displaytitle(), Article\doDelete(), WikiPage\doDeleteArticleBatched(), WikiPage\doDeleteArticleReal(), ApiCSPReport\error(), ApiMain\errorMessagesFromException(), SpecialFileDuplicateSearch\execute(), SpecialMergeHistory\execute(), SpecialUnblock\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiComparePages\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiLinkAccount\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiOptions\execute(), ApiParse\execute(), ApiProtect\execute(), ApiQueryAllMessages\execute(), ApiQueryLogEvents\execute(), ApiQueryUserContribs\execute(), ApiUndelete\execute(), ApiUserrights\execute(), ApiValidatePassword\execute(), CoreMagicVariables\expand(), ApiQueryRevisionsBase\extractAllSlotInfo(), ApiQueryRevisionsBase\extractDeprecatedContent(), ApiBase\extractRequestParams(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), ApiComparePages\getDiffRevision(), Status\getErrorMessage(), ApiFeedRecentChanges\getFeedObject(), ApiErrorFormatter\getMessageFromException(), ApiBase\getModuleFromPath(), ApiRollback\getRbTitle(), TextSlotDiffRenderer\getTextDiffInternal(), ApiBase\getTitleFromTitleOrPageId(), ApiBase\getTitleOrPageId(), Parser\getUserSig(), ApiBase\getWatchlistUser(), RollbackAction\handleRollbackRequest(), EditPage\importFormData(), SpecialBlock\maybeAlterFormDefaults(), ApiQueryImageInfo\mergeThumbParams(), PPFrame_Hash\newChild(), SpecialRandomInCategory\onSubmit(), SpecialBlock\onSuccess(), SpecialPasswordReset\onSuccess(), ImagePage\openShowImage(), ImageListPager\outputUserDoesNotExist(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), ApiQueryBase\parsePrefixedTitlePart(), SpecialBlock\postText(), FileDeleteForm\prepareMessage(), ApiQueryBlocks\prepareUsername(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryCategories\run(), ApiQueryImages\run(), ApiQueryLinks\run(), ApiQueryRecentChanges\run(), ApiQueryRevisions\run(), ApiMain\setupModule(), ProtectionForm\show(), SpecialSearch\showCreateLink(), UserrightsPage\showEditUserGroupsForm(), SpecialUndelete\showHistory(), EditPage\showIntro(), Article\showMissingArticle(), SpecialSearch\showResults(), LoginSignupSpecialPage\showSuccessPage(), EditPage\spamPageWithContent(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), DeleteAction\tempDeleteArticle(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), and MediaWiki\Preferences\SignatureValidator\validateSignature().
wfExpandIRI | ( | $url | ) |
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences.
string | $url |
Definition at line 844 of file GlobalFunctions.php.
References $matches, and wfExpandUrl().
Referenced by Skin\printSource().
wfExpandUrl | ( | $url, | |
$defaultProto = PROTO_CURRENT |
|||
) |
Expand a potentially local URL to a fully-qualified URL.
Assumes $wgServer is correct.
The meaning of the PROTO_* constants is as follows: PROTO_HTTP: Output a URL starting with http:// PROTO_HTTPS: Output a URL starting with https:// PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer
string | $url | Either fully-qualified or a local path + query |
string | int | null | $defaultProto | One of the PROTO_* constants. Determines the protocol to use if $url or $wgServer is protocol-relative |
Definition at line 474 of file GlobalFunctions.php.
References $wgCanonicalServer, $wgHttpsPort, $wgInternalServer, $wgRequest, $wgServer, PROTO_CANONICAL, PROTO_CURRENT, PROTO_HTTP, PROTO_HTTPS, PROTO_INTERNAL, wfAssembleUrl(), wfParseUrl(), and wfRemoveDotSegments().
Referenced by MWHttpRequest\__construct(), ParsoidVirtualRESTService\__construct(), DumpCategoriesAsRdf\addDumpHeader(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendRightsInfo(), EmailNotification\composeCommonMailtext(), SpecialApiHelp\execute(), ApiQueryExternalLinks\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), WebInstallerWelcome\execute(), CdnCacheUpdate\expand(), ApiQueryInfo\extractPageInfo(), CoreParserFunctions\filepath(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), Title\getCanonicalURL(), File\getCanonicalUrl(), SpecialVersion\getEntryPointInfo(), RevertAction\getFormFields(), Title\getFullURL(), File\getFullUrl(), OutputPage\getHeadLinksArray(), ApiQueryImageInfo\getInfo(), LocalRepo\getInfo(), Title\getInternalURL(), ApiRsd\getRsdApiList(), FeedItem\getUniqueIdUnescaped(), MediaWiki\Search\SearchWidgets\SimpleSearchResultSetWidget\headerHtml(), ForeignAPIRepo\httpGet(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\iwIcon(), RevertAction\onSuccess(), AtomFeed\outHeader(), RSSFeed\outHeader(), AtomFeed\outItem(), RSSFeed\outItem(), OutputPage\output(), SpecialUploadStash\outputRemoteScaledThumb(), MediaWiki\performAction(), FileDeleteForm\prepareMessage(), ApiQueryExtLinksUsage\run(), VirtualRESTServiceClient\runMulti(), ApiOpenSearch\search(), SearchSuggestion\setSuggestedTitle(), MediaWiki\shouldDoHttpRedirect(), EditPage\showIntro(), ApiMain\substituteResultWithError(), File\transform(), MediaWiki\tryNormaliseRedirect(), wfApiMain(), wfExpandIRI(), wfGetServerUrl(), wfOpenSearchDescMain(), and wfStreamThumb().
wfFindFile | ( | $title, | |
$options = [] |
|||
) |
Find a file.
string | LinkTarget | $title | |
array | $options | Associative array of options (see RepoGroup::findFile) |
Definition at line 2267 of file GlobalFunctions.php.
References $title, and wfDeprecated().
wfFormatStackFrame | ( | $frame | ) |
Return a string representation of frame.
array | $frame |
Definition at line 1390 of file GlobalFunctions.php.
Referenced by wfGetCaller().
wfGetAllCallers | ( | $limit = 3 | ) |
Return a string consisting of callers in the stack.
Useful sometimes for profiling specific points.
int | $limit | The maximum depth of the stack frame to return, or false for the entire stack. |
Definition at line 1375 of file GlobalFunctions.php.
References wfDebugBacktrace().
Referenced by MediaWiki\Session\SessionBackend\addData(), MediaWiki\Session\SessionBackend\dirty(), and MediaWiki\Session\SessionBackend\renew().
wfGetCache | ( | $cacheType | ) |
Get a specific cache object.
int | string | $cacheType | A CACHE_* constants, or other key in $wgObjectCaches |
Definition at line 2476 of file GlobalFunctions.php.
wfGetCaller | ( | $level = 2 | ) |
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie.
FUNCTION) wfGetCaller( 2 ) [default] is the caller of the function running wfGetCaller() wfGetCaller( 3 ) is the parent of that.
int | $level |
Definition at line 1359 of file GlobalFunctions.php.
References wfDebugBacktrace(), and wfFormatStackFrame().
Referenced by StubGlobalUser\_unstub(), StubObject\_unstub(), DeferredUpdates\addCallableUpdate(), MWDebug\log(), MWLBFactory\logDeprecation(), MediaWiki\HeaderCallback\warnIfHeadersSent(), wfShellExec(), and wfShellExecWithStderr().
wfGetDB | ( | $db, | |
$groups = [] , |
|||
$wiki = false |
|||
) |
Get a Database object.
int | $db | Index of the connection to get. May be DB_PRIMARY for the primary (for write queries), DB_REPLICA for potentially lagged read queries, or an integer >= 0 for a particular server. |
string | string[] | $groups | Query groups. An array of group names that this query belongs to. May contain a single string if the query is only in one group. |
string | bool | $wiki | The wiki ID, or false for the current wiki |
Note: multiple calls to wfGetDB(DB_REPLICA) during the course of one request will always return the same object, unless the underlying connection or load balancer is manually destroyed.
Note 2: use $this->getDB() in maintenance scripts that may be invoked by updater to ensure that a proper database is being updated.
Note 3: When replacing calls to this with calls to methods on an injected LoadBalancer, LoadBalancer::getConnectionRef is more commonly needed than LoadBalancer::getMaintenanceConnectionRef, which is needed for more advanced administrative tasks. See the IMaintainableDatabase and IDatabase interfaces for details.
Definition at line 2225 of file GlobalFunctions.php.
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), IndexPager\__construct(), OutputPage\addCategoryLinksToLBAndGetResult(), LogPage\addRelations(), User\addToDatabase(), SpecialPageLanguage\changePageLanguage(), CheckStorage\check(), User\checkAndSetTouched(), TrackBlobs\checkIntegrity(), RecompressTracked\checkTrackingTable(), CgzCopyTransaction\commit(), PrefixSearch\defaultSearchBackend(), ChangeTags\defineTag(), DifferenceEngine\deletedLink(), ChangeTags\deleteTagEverywhere(), RecompressTracked\doAllOrphans(), RecompressTracked\doAllPages(), CategoryViewer\doCategoryQuery(), RecompressTracked\doOrphanList(), RecompressTracked\doPage(), WikiPage\doUpdateRestrictions(), LinkHolderArray\doVariants(), Title\estimateRevisionCount(), RenameRestrictions\execute(), HistoryAction\fetchRevisions(), TrackBlobs\findOrphanBlobs(), User\findUsersByGroup(), RecompressTracked\finishIncompleteMoves(), DoubleRedirectJob\fixRedirects(), Language\formatExpiry(), ApiResult\formatExpiry(), LCStoreDB\get(), RecentChange\getAttribute(), ContentHandler\getAutoDeleteReason(), MediaWiki\Block\DatabaseBlock\getBlocksForIPList(), Title\getBrokenLinksFrom(), WikiPage\getCategories(), RCDatabaseLogEntry\getComment(), WikiPage\getContributors(), AllMessagesTablePager\getCustomisedStatuses(), UserRightsProxy\getDB(), ApiBase\getDB(), BacklinkCache\getDB(), LinksUpdate\getDB(), ResourceLoaderWikiModule\getDB(), ChangesListSpecialPage\getDB(), LocalRepo\getDBFactory(), Title\getDeletedEditsCount(), DoubleRedirectJob\getFinalDestination(), WikiPage\getHiddenCategories(), EditPage\getLastDelete(), Title\getLinksFrom(), Title\getLinksTo(), ApiQuery\getNamedDB(), Title\getParentCategories(), LocalRepo\getPrimaryDB(), LinkFilter\getQueryConditions(), MediaWiki\Block\DatabaseBlock\getRangeCond(), Title\getRedirectsHere(), WikiPage\getRedirectTarget(), LocalRepo\getReplicaDB(), OutputPage\getRlClient(), Linker\getRollbackEditCount(), SpecialVersion\getSoftwareInformation(), HistoryBlobCurStub\getText(), HistoryBlobStub\getText(), TrackBlobs\getTextClause(), Title\getTouched(), LCStoreDB\getWriteConnection(), Title\hasDeletedEdits(), User\idForName(), WikiRevision\importLogItem(), CheckStorage\importRevision(), MediaWiki\Block\DatabaseBlock\initFromRow(), TrackBlobs\initTrackingTable(), ManualLogEntry\insert(), User\insertNewUser(), WikiPage\insertRedirect(), WikiPage\insertRedirectEntry(), EditPage\internalAttemptSave(), Title\invalidateCache(), WikiPage\isBatchedDelete(), Title\isBigDeletion(), WikiPage\isCountable(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), Title\isNewPage(), Title\isSingleRevRedirect(), ChangeTags\listExplicitlyDefinedTags(), PageArchive\listPagesByPrefix(), PageArchive\listPagesBySearch(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), User\load(), ArchivedFile\load(), MessageCache\loadCachedMessagePageEntry(), Title\loadFieldFromDB(), User\loadFromCache(), User\loadFromDatabase(), MessageCache\loadFromDB(), RecentChange\loadFromRow(), ArchivedFile\loadFromRow(), DifferenceEngine\loadRevisionData(), WikiPage\lockAndGetLatest(), ChangeTags\logTagManagementAction(), LinkFilter\makeLikeArray(), ChangeTags\makeTagSummarySubquery(), ChangeTags\modifyDisplayQuery(), RecompressTracked\moveTextRow(), moveToExternal(), RecentChange\newFromConds(), MediaWiki\Block\DatabaseBlock\newFromID(), Title\newFromID(), Title\newFromIDs(), UserArray\newFromIDs(), UserArray\newFromNames(), MediaWiki\Block\DatabaseBlock\newLoad(), RecentChange\notifyEdit(), RecentChange\notifyNew(), HistoryAction\onView(), ImagePage\openShowImage(), ResourceLoader\preloadModuleInfo(), ManualLogEntry\publish(), Title\purgeExpiredRestrictions(), RecentChangesUpdateJob\purgeExpiredRows(), ImagePage\queryImageLinks(), RecentChange\reallyMarkPatrolled(), MessageBlobStore\recacheMessageBlob(), ChangeTagsList\reloadFromPrimary(), LinkHolderArray\replaceInternal(), ImportReporter\reportPage(), RevisionListBase\reset(), resolveStub(), resolveStubs(), CheckStorage\restoreText(), DeleteLinksJob\run(), RecentChange\save(), LogPage\saveContent(), User\saveSettings(), RevDelArchivedFileItem\setBits(), RevDelArchivedRevisionItem\setBits(), RevDelArchiveItem\setBits(), RevDelFileItem\setBits(), RevDelLogItem\setBits(), RevDelRevisionItem\setBits(), RevisionDeleteUser\setUsernameBitfields(), EditPage\showIntro(), LogEventsList\showLogExtract(), Article\showMissingArticle(), Article\showPatrolFooter(), UserOptionsMaintenance\showUsageStats(), RevDelLogList\suggestTarget(), RecompressTracked\syncDBs(), ChangeTags\tagUsageStatistics(), DeleteAction\tempDeleteArticle(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), ResourceLoader\tryRespondFromFileCache(), ChangeTags\undefineTag(), RecentChangesUpdateJob\updateActiveUsers(), WikiPage\updateCategoryCounts(), UserOptionsMaintenance\updateOptions(), ChangeTags\updateTags(), ChangeTags\updateTagsWithChecks(), MediaWiki\Block\DatabaseBlock\updateTimestamp(), and ActivityUpdateJob\updateWatchlistNotification().
wfGetLangObj | ( | $langcode = false | ) |
Return a Language object from $langcode.
Language | string | bool | $langcode | Either:
|
Definition at line 1132 of file GlobalFunctions.php.
References $wgLang, $wgLanguageCode, and wfDebug().
Referenced by AllMessagesTablePager\__construct(), MessageCache\get(), Title\getPageLanguage(), ContentHandler\getPageLanguage(), and Title\getPageViewLanguage().
wfGetLB | ( | $wiki = false | ) |
Get a load balancer object.
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 2248 of file GlobalFunctions.php.
References wfDeprecated().
wfGetMainCache | ( | ) |
Get the main cache object.
Definition at line 2486 of file GlobalFunctions.php.
wfGetNull | ( | ) |
Get a platform-independent path to the null file, e.g.
/dev/null
Definition at line 2359 of file GlobalFunctions.php.
References wfIsWindows().
Referenced by Dump7ZipOutput\setup7zCommand().
wfGetScriptUrl | ( | ) |
Get the script URL.
Definition at line 2324 of file GlobalFunctions.php.
References wfDeprecated().
wfGetServerUrl | ( | $proto | ) |
Get the wiki's "server", i.e.
the protocol and host part of the URL, with a protocol specified using a PROTO_* constant as in wfExpandUrl()
string | int | null | $proto | One of the PROTO_* constants. |
Definition at line 552 of file GlobalFunctions.php.
References wfExpandUrl().
Referenced by WebRequest\getFullRequestURL(), and GenerateSitemap\indexEntry().
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.
Definition at line 1245 of file GlobalFunctions.php.
References $wgOverrideHostname.
Referenced by MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), ApiMain\addRequestedFields(), DifferenceEngine\debug(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), ApiMain\getMaxLag(), MediaHandler\logErrorForExternalProcess(), RecompressTracked\logToFile(), Parser\makeLimitReport(), wfReportTime(), and wfThumbError().
wfHttpError | ( | $code, | |
$label, | |||
$desc | |||
) |
Provide a simple HTTP error.
int | string | $code | |
string | $label | |
string | $desc |
Definition at line 1563 of file GlobalFunctions.php.
Referenced by SpecialJavaScriptTest\execute(), SpecialRunJobs\execute(), RawAction\getRawText(), and AjaxDispatcher\performAction().
wfIncrStats | ( | $key, | |
$count = 1 |
|||
) |
Increment a statistics counter.
string | $key | |
int | $count |
Definition at line 1088 of file GlobalFunctions.php.
References wfDeprecated().
wfIniGetBool | ( | $setting | ) |
Safety wrapper around ini_get() for boolean settings.
The values returned from ini_get() are pre-normalized for settings set via php.ini or php_flag/php_admin_flag... but not for those set via php_value/php_admin_value.
It's fairly common for people to use php_value instead of php_flag, which can leave you with an 'off' setting giving a false positive for code that just takes the ini_get() return value as a boolean.
To make things extra interesting, setting via php_value accepts "true" and "yes" as true, but php.ini and php_flag consider them false. :) Unrecognized values go false... again opposite PHP's own coercion from string to bool.
Luckily, 'properly' set settings will always come back as '0' or '1', so we only have to worry about them and the 'improper' settings.
I frickin' hate PHP... :P
string | $setting |
Definition at line 1870 of file GlobalFunctions.php.
References wfStringToBool().
Referenced by PhpHttpRequest\__construct(), MediaWiki\Http\HttpRequestFactory\canMakeRequests(), MWHttpRequest\canMakeRequests(), UploadBase\isEnabled(), and WebInstaller\startSession().
wfIsCLI | ( | ) |
Check if we are running from the commandline.
Definition at line 1739 of file GlobalFunctions.php.
Referenced by ForkController\__construct(), MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), MWExceptionHandler\handleUncaughtException(), and ProfilerOutputText\log().
wfIsDebugRawPage | ( | ) |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
Definition at line 916 of file GlobalFunctions.php.
References $cache, and MW_ENTRY_POINT.
Referenced by wfDebug().
wfIsInfinity | ( | $str | ) |
Determine input string is represents as infinity.
string | $str | The string to determine |
Definition at line 2547 of file GlobalFunctions.php.
Referenced by ApiProtect\execute(), UserrightsPage\expiryToTimestamp(), ProtectLogFormatter\formatExpiry(), ApiResult\formatExpiry(), ProtectionForm\getExpiry(), BlockLogFormatter\getParametersForApi(), WatchAction\onSuccess(), MediaWiki\Block\BlockUser\parseExpiryInput(), and Language\translateBlockExpiry().
wfIsWindows | ( | ) |
Check if the operating system is Windows.
Definition at line 1729 of file GlobalFunctions.php.
Referenced by Installer\envCheckDiff3(), Installer\envCheckGit(), Installer\envCheckGraphics(), TransformationalImageHandler\escapeMagickPath(), RebuildLocalisationCache\execute(), Maintenance\getTermSize(), Maintenance\readlineEmulation(), UserMailer\sendInternal(), SevenZipStream\stream_open(), MailAddress\toString(), wfGetNull(), and CLIParser\Wikitext().
wfLoadExtension | ( | $ext, | |
$path = null |
|||
) |
Load an extension.
This queues an extension to be loaded through the ExtensionRegistry system.
string | $ext | Name of the extension to load |
string | null | $path | Absolute path of where to find the extension.json file |
Definition at line 47 of file GlobalFunctions.php.
References $path, and $wgExtensionDirectory.
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.
string[] | $exts | Array of extension names to load |
Definition at line 68 of file GlobalFunctions.php.
References $ext, and $wgExtensionDirectory.
wfLoadSkin | ( | $skin, | |
$path = null |
|||
) |
Load a skin.
string | $skin | Name of the extension to load |
string | null | $path | Absolute path of where to find the skin.json file |
Definition at line 84 of file GlobalFunctions.php.
References $path, and $wgStyleDirectory.
wfLoadSkins | ( | array | $skins | ) |
Load multiple skins at once.
string[] | $skins | Array of extension names to load |
Definition at line 99 of file GlobalFunctions.php.
References $wgStyleDirectory.
wfLocalFile | ( | $title | ) |
Get an object referring to a locally registered file.
Returns a valid placeholder object if the file does not exist.
Title | string | $title |
Definition at line 2280 of file GlobalFunctions.php.
References $title, and wfDeprecated().
wfLogDBError | ( | $text, | |
array | $context = [] |
||
) |
Log for database errors.
string | $text | Database error message. |
array | $context | Additional logging context data |
Definition at line 976 of file GlobalFunctions.php.
wfLogProfilingData | ( | ) |
document
Move logic to MediaWiki.php
Definition at line 1064 of file GlobalFunctions.php.
Referenced by MediaWiki\restInPeace(), and Maintenance\shutdown().
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.
string | $msg | Message to send |
int | $callerOffset | Number of items to go back in the backtrace to find the correct caller (1 = function calling wfLogWarning, ...) |
int | $level | PHP error level; defaults to E_USER_WARNING |
Definition at line 1056 of file GlobalFunctions.php.
Referenced by User\__get(), User\__set(), ChangesListSpecialPage\areFiltersInConflict(), MediaWiki\Storage\SqlBlobStore\compressData(), Language\convertGrammar(), Linker\emailLink(), LogFormatter\formatParametersForApi(), CommentStore\getCommentInternal(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), SiteImporter\handleException(), Html\inlineScript(), ParserOutput\mergeInternalMetaDataFrom(), OutputPage\transformFilePath(), Title\warnIfPageCannotExist(), and wfMkdirParents().
wfMatchesDomainList | ( | $url, | |
$domains | |||
) |
Check whether a given URL has a domain that occurs in a given set of domains.
string | $url | |
array | $domains | Array of domains (strings) |
Definition at line 860 of file GlobalFunctions.php.
References wfParseUrl().
Referenced by Skin\addToSidebarPlain(), and Parser\getExternalLinkRel().
wfMemoryLimit | ( | $newLimit | ) |
Raise PHP's memory limit (if needed).
int | $newLimit |
Definition at line 2390 of file GlobalFunctions.php.
References wfDebug(), and wfShorthandToInteger().
wfMerge | ( | $old, | |
$mine, | |||
$yours, | |||
& | $result, | ||
& | $mergeAttemptResult = null |
||
) |
wfMerge attempts to merge differences between three texts.
Returns true for a clean merge and false for failure or a conflict.
string | $old | |
string | $mine | |
string | $yours | |
string | &$result | |
string | null | &$mergeAttemptResult |
Definition at line 2033 of file GlobalFunctions.php.
References $wgDiff3, wfDebug(), and wfTempDir().
Referenced by TextContentHandler\merge3().
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' ] ]
array[] | ...$args |
Definition at line 163 of file GlobalFunctions.php.
References $args.
Referenced by SpecialImport\execute().
wfMessage | ( | $key, | |
$params | |||
) |
This is the function for getting translated interface messages.
This function replaces all old wfMsg* functions.
string | string[] | MessageSpecifier | $key | Message key, or array of keys, or a MessageSpecifier |
mixed | ...$params Normal message parameters |
Definition at line 1182 of file GlobalFunctions.php.
Referenced by MalformedTitleException\__construct(), MessageContent\__construct(), MediaTransformError\__construct(), HTMLAutoCompleteSelectField\__construct(), HTMLSelectOrOtherField\__construct(), TransformParameterError\__construct(), TransformTooBigImageAreaError\__construct(), UploadStashFile\__construct(), CollapsibleFieldsetLayout\__construct(), MediaWiki\Widget\DateInputWidget\__construct(), MediaWiki\Widget\SizeFilterWidget\__construct(), UploadChunkVerificationException\__construct(), Linker\accesskey(), LogPage\actionText(), MediaHandler\addMeta(), WikitextContent\addSectionHeader(), ParserOutput\addTrackingCategory(), ApiQuerySiteinfo\appendInterwikiMap(), JsonContent\arrayTable(), SpecialVersion\arrayToString(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountCreation(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), Linker\blockLink(), Parser\braceSubstitution(), OutputPage\buildBacklinkSubtitle(), SkinTemplate\buildContentNavigationUrls(), Xml\buildForm(), ChangesFeed\buildItems(), SpecialEditWatchlist\buildTools(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), MediaWiki\Permissions\PermissionManager\checkActionPermissions(), SpecialPage\checkLoginSecurityLevel(), MediaWiki\Permissions\PermissionManager\checkSpecialsAndNSPermissions(), CleanupSpam\cleanupArticle(), UploadStash\clear(), Language\commaList(), Linker\commentBlock(), EmailNotification\composeCommonMailtext(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), LanguageConverter\convertNamespace(), Installer\createMainpage(), Xml\dateMenu(), CoreParserFunctions\defaultsort(), MediaWiki\Session\SessionProvider\describe(), MediaWiki\Auth\PasswordAuthenticationRequest\describeCredentials(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\describeCredentials(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\describeCredentials(), MediaWiki\Session\SessionProvider\describeMessage(), UploadBase\detectVirus(), CoreParserFunctions\displaytitle(), MediaWiki\Block\DatabaseBlock\doAutoblock(), ContentModelChange\doContentModelChange(), Article\doDelete(), FileDeleteForm\doDelete(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), WikiPage\doUpdateRestrictions(), Linker\emailLink(), WebInstallerPage\endForm(), WebInstallerInstall\endStage(), Installer\envCheckDB(), ApiEditPage\execute(), ApiFeedContributions\execute(), ApiFeedWatchlist\execute(), ApiImageRotate\execute(), ApiQueryAllMessages\execute(), WebInstallerComplete\execute(), WebInstallerDBConnect\execute(), WebInstallerExistingWiki\execute(), WebInstallerInstall\execute(), WebInstallerName\execute(), WebInstallerOptions\execute(), WebInstallerRestart\execute(), WebInstallerUpgrade\execute(), WebInstallerWelcome\execute(), CleanupSpam\execute(), DumpIterator\execute(), DumpMessages\execute(), DumpRenderer\execute(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(), ApiFeedContributions\feedItemDesc(), MessageBlobStore\fetchMessage(), DeleteEqualMessages\fetchMessageInfo(), FallbackContent\fillParserOutput(), ChangesList\flag(), Linker\formatAutocomments(), BlockLogFormatter\formatBlockFlag(), BlockLogFormatter\formatBlockFlags(), FeedUtils\formatDiff(), FeedUtils\formatDiffRow(), Language\formatDuration(), LanguageZh_hans\formatDuration(), WikiPage\formatExpiry(), Linker\formatHiddenCategories(), Linker\formatRevisionSize(), ApiParse\formatSummary(), Language\formatTimePeriod(), File\generateAndSaveThumb(), ContentHandler\getAutoDeleteReason(), ContentHandler\getAutosummary(), WebInstallerOptions\getCCDoneBox(), CategoryMembershipChange\getChangeMessageText(), WebInstaller\getCheckBox(), MysqlInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), SpecialVersion\getCopyrightAndAuthorList(), EditPage\getCopyrightWarning(), MWExceptionRenderer\getCustomMessage(), Title\getDefaultMessageText(), Interwiki\getDescription(), LogPage\getDescription(), MediaWiki\Config\ConfigRepository\getDescriptionOf(), FeedUtils\getDiffLink(), ImageHandler\getDimensionsString(), Title\getEditNotices(), SpecialUpload\getExistsWarning(), SpecialVersion\getExtensionTypes(), MediaWiki\Auth\ConfirmLinkAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\CreationReasonAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\RememberMeAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UsernameAuthenticationRequest\getFieldInfo(), WebInstallerPage\getFieldsetStart(), UploadStash\getFile(), WebInstallerDocument\getFileContents(), UploadBase\getFilenamePrefixBlacklist(), IcuCollation\getFirstLetter(), NumericUppercaseCollation\getFirstLetter(), MediaHandler\getGeneralLongDesc(), MWGrants\getGrantsWikiText(), UserGroupMembership\getGroupMemberName(), UserGroupMembership\getGroupName(), UserGroupMembership\getGroupPage(), WebInstaller\getHelpBox(), Language\getHumanTimestampInternal(), WikiTextStructure\getIgnoredHeadings(), WebInstaller\getInfoBox(), SpecialUpload\getInitialPageText(), DatabaseInstaller\getInstallUserBox(), LogFormatter\getIRCActionComment(), LogFormatter\getIRCActionText(), ContentHandler\getLocalizedName(), ImageHandler\getLongDesc(), SvgHandler\getLongDesc(), GIFHandler\getLongDesc(), PNGHandler\getLongDesc(), SpecialVersion\getMediaWikiCredits(), Licenses\getMessageFromParams(), ErrorPageError\getMessageObject(), MalformedTitleException\getMessageObject(), CliInstaller\getMessageText(), Interwiki\getName(), LogPage\getName(), WebInstaller\getPageListItem(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getPasswordResetData(), EditPage\getPreviewLimitReport(), WebInstaller\getRadioElements(), LogPage\getRcComment(), LogPage\getRcCommentIRC(), DatabaseInstaller\getReadableName(), MediaWiki\Block\DatabaseBlock\getRedactedName(), Article\getRedirectHeaderHtml(), MWTimestamp\getRelativeTimestamp(), User\getRightDescription(), ImageHandler\getShortDesc(), SpecialBlock\getSuggestedDurations(), MediaWiki\Preferences\DefaultPreferencesFactory\getTimeZoneList(), MWTimestamp\getTimezoneMessage(), TrackingCategories\getTrackingCategories(), DoubleRedirectJob\getUser(), Parser\getUserSig(), Language\getVariantname(), SpecialVersion\getVersion(), FormatMetadata\getVisibleFields(), StripState\getWarning(), DatabaseInstaller\getWebUserBox(), MWGrants\grantName(), PageDataRequestHandler\handleRequest(), Title\hasSourceText(), QuickTemplate\haveMsg(), CoreTagHooks\html(), PageDataRequestHandler\httpContentNegotiation(), BackupReader\importFromHandle(), CoreTagHooks\indicator(), UploadStash\initFile(), WikiPage\insertNullProtectionRevision(), DifferenceEngine\intermediateEditsMsg(), Parser\interwikiTransclude(), CoreParserFunctions\intFunction(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), MovePage\isValidMove(), WebInstaller\label(), Xml\languageSelector(), Parser\limitationWarn(), UploadStash\listFiles(), BotPassword\login(), Parser\magicLinkCallback(), MediaWiki\Linker\LinkRenderer\makeBrokenLink(), ContentSecurityPolicy\makeCSPDirectives(), WebInstaller\makeDownloadLinkHtml(), Parser\makeLimitReport(), ApiBase\makeMessage(), WebInstallerOptions\makeScreenshotsLink(), Linker\makeThumbLink2(), Parser\maybeMakeExternalImage(), MergeHistory\merge(), Xml\monthSelector(), MovePage\moveToInternal(), MovePage\moveUnsafe(), MWException\msg(), MWExceptionRenderer\msg(), DerivativeContext\msg(), RequestContext\msg(), HTMLFormField\msg(), QuickTemplate\msg(), SearchEngineConfig\namespacesAsText(), Html\namespaceSelectorOptions(), PPFrame_Hash\newChild(), Title\newMainPage(), WikiImporter\notice(), JsonContent\objectTable(), RawAction\onView(), WebInstallerOutput\outputFooter(), WebInstallerOutput\outputTitle(), FormatJson\parse(), ConverterRule\parse(), SearchEngine\parseNamespacePrefixes(), Language\pipeList(), WikiPage\protectDescription(), TextPassDumper\readDump(), LanguageConverter\recursiveConvertRule(), UploadStash\removeFile(), WikitextContent\replaceSection(), CheckStorage\restoreText(), Linker\revComment(), Linker\revDeleteLink(), Linker\revDeleteLinkDisabled(), Linker\revUserLink(), Linker\revUserTools(), DoubleRedirectJob\run(), MediaWiki\Storage\PageUpdater\saveRevision(), Language\semicolonList(), User\sendConfirmationMail(), EmailNotification\sendImpersonal(), User\sendMail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendNewAccountEmail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendPasswordResetEmail(), User\setEmailWithConfirmation(), WikiImporter\setTargetRootPage(), Article\showDiffPage(), WebInstallerUpgrade\showDoneMessage(), WebInstaller\showError(), WebInstallerExistingWiki\showKeyForm(), WebInstaller\showMessage(), Article\showMissingArticle(), Article\showNamespaceHeader(), Article\showPatrolFooter(), SpecialVersion\softwareInformation(), Linker\specialLink(), WebInstaller\startPageWrapper(), WebInstallerInstall\startStage(), UploadStash\stashFile(), Parser\statelessFetchTemplate(), WebInstallerName\submit(), WebInstallerOptions\submit(), Installer\subscribeToMediaWikiAnnounce(), DeleteAction\tempDeleteArticle(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAuthentication(), Linker\titleAttrib(), Linker\tocList(), File\transform(), File\transformErrorOutput(), BitmapHandler\transformGd(), Language\truncateHtml(), Language\truncateInternal(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset(), PageArchive\undeleteRevisions(), MediaWiki\Storage\PageUpdater\updateRevision(), MergeHistory\updateSourcePage(), Linker\userLink(), Linker\userTalkLink(), Linker\userToolLinks(), Article\view(), Article\viewRedirect(), wfForbidden(), wfGenerateThumbnail(), wfOpenSearchDescMain(), wfShowingResults(), wfStreamThumb(), MediaWiki\Session\CookieSessionProvider\whyNoSession(), and MediaWiki\Session\ImmutableSessionProviderWithCookie\whyNoSession().
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 first message key is returned.
string | ...$keys Message keys |
Definition at line 1205 of file GlobalFunctions.php.
References $keys, and Message\newFallbackSequence().
Referenced by SkinTemplate\buildContentNavigationUrls(), FileRepo\getDisplayName(), ImagePage\openShowImage(), and SkinTemplate\tabAction().
wfMkdirParents | ( | $dir, | |
$mode = null , |
|||
$caller = null |
|||
) |
Make directory, and make all parent directories if they don't exist.
string | $dir | Full path to directory to create |
int | null | $mode | Chmod value to use, default is $wgDirectoryMode |
string | null | $caller | Optional caller param for debugging. |
MWException |
Definition at line 1773 of file GlobalFunctions.php.
References $wgDirectoryMode, FileBackend\isStoragePath(), wfDebug(), and wfLogWarning().
Referenced by ForeignResourceManager\cacheSet(), FileCacheBase\checkCacheDirs(), SqliteInstaller\createDataDir(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), GenerateSitemap\execute(), ForeignResourceManager\handleTypeFile(), ForeignResourceManager\handleTypeMultiFile(), ForeignResourceManager\handleTypeTar(), CleanupImages\pokeFile(), GitInfo\precomputeValues(), ForeignResourceManager\run(), LCStoreCDB\startWrite(), and LCStoreStaticArray\startWrite().
wfMsgReplaceArgs | ( | $message, | |
$args | |||
) |
Replace message parameter keys on the given formatted output.
string | $message | |
array | $args |
Definition at line 1217 of file GlobalFunctions.php.
References $args.
Referenced by MWException\msg(), and MWExceptionRenderer\msg().
wfObjectToArray | ( | $objOrArray, | |
$recursive = true |
|||
) |
Recursively converts the parameter (an object) to an array with the same data.
@phpcs:ignore MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
object | array | $objOrArray | |
bool | $recursive |
Definition at line 213 of file GlobalFunctions.php.
References wfObjectToArray().
Referenced by wfObjectToArray().
wfParseUrl | ( | $url | ) |
parse_url() work-alike, but non-broken.
Differences:
1) Handles protocols that don't use :// (e.g., mailto: and news:, as well as protocol-relative URLs) correctly. 2) Adds a "delimiter" element to the array (see (2)). 3) Verifies that the protocol is on the $wgUrlProtocols allowed list. 4) Rejects some invalid URLs that parse_url doesn't, e.g. the empty string or URLs starting with a line feed character.
string | $url | A URL to parse |
Definition at line 776 of file GlobalFunctions.php.
References $wgUrlProtocols.
Referenced by MWHttpRequest\__construct(), ParsoidVirtualRESTService\__construct(), OutputPage\addParserOutputMetadata(), SpecialLinkSearch\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), ApiLinkAccount\execute(), DeleteSelfExternals\execute(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), WikiMap\getCanonicalServerInfoForAllWikis(), WikiReference\getDisplayName(), WikiMap\getWikiFromUrl(), WikiMap\getWikiWikiReferenceFromSites(), MediaWiki\Search\SearchWidgets\SimpleSearchResultSetWidget\headerHtml(), ThumbnailRenderJob\hitThumbUrl(), UploadFromUrl\isAllowedHost(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\iwIcon(), LinkFilter\makeIndexes(), LinkFilter\makeLikeArray(), UserMailer\makeMsgId(), ApiCSPReport\matchUrlPattern(), CdnCacheUpdate\naivePurge(), ApiCSPReport\originFromUrl(), ContentSecurityPolicy\prepareUrlForCSP(), RedisPubSubFeedEngine\send(), MediaWiki\triggerAsyncJobs(), wfExpandUrl(), and wfMatchesDomainList().
wfPercent | ( | $nr, | |
int | $acc = 2 , |
||
bool | $round = true |
||
) |
float | int | $nr | The number to format |
int | $acc | The number of digits after the decimal point, default 2 |
bool | $round | Whether or not to round the value, default true |
Definition at line 1841 of file GlobalFunctions.php.
wfQueriesMustScale | ( | ) |
Should low-performance queries be disabled?
Definition at line 2291 of file GlobalFunctions.php.
References $wgMiserMode, SiteStats\edits(), SiteStats\pages(), and SiteStats\users().
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.
Definition at line 239 of file GlobalFunctions.php.
Referenced by CompareParserCache\execute(), ResetPageRandom\execute(), SpecialRandomInCategory\getRandomTitle(), SpecialRandomPage\getRandomTitle(), WikiPage\insertOn(), and ApiQueryRandom\run().
wfRandomString | ( | $length = 32 | ) |
Get a random string containing a number of pseudo-random hex characters.
int | $length | The length of the string to generate |
Definition at line 257 of file GlobalFunctions.php.
Referenced by JobQueueDB\doPop(), SvgHandler\doTransform(), BenchmarkLruHash\execute(), BenchmarkSanitizer\execute(), MakeTestEdits\execute(), WebRequest\getRequestId(), BenchmarkTitleValue\randomize(), and UploadSourceAdapter\registerSource().
wfReadOnly | ( | ) |
Check whether the wiki is in read-only mode.
Definition at line 1099 of file GlobalFunctions.php.
Referenced by ProtectionForm\__construct(), Action\checkCanExecute(), SpecialPage\checkReadOnly(), WikiPage\doUpdateRestrictions(), WikiPage\doViewUpdates(), EditPage\edit(), BackupReader\execute(), LocalFile\getSha1(), EditPage\handleFailedConstraint(), Title\invalidateCache(), LocalFile\maybeUpgradeRow(), Title\purgeExpiredRestrictions(), LocalFile\reserializeMetadata(), MediaWiki\Session\SessionBackend\save(), User\saveSettings(), MediaWiki\schedulePostSendJobs(), EditPage\showHeader(), DeleteAction\tempDeleteArticle(), WikiPage\triggerOpportunisticLinksUpdate(), and LocalFile\upgradeRow().
wfReadOnlyReason | ( | ) |
Check if the site is in read-only mode and return the message if so.
This checks wfConfiguredReadOnlyReason() and the main load balancer for replica DB lag. This may result in DB connection being made.
Definition at line 1112 of file GlobalFunctions.php.
Referenced by ReadOnlyError\__construct(), ProtectionForm\__construct(), ApiBase\dieReadOnly(), WikiPage\doUpdateRestrictions(), and EditPage\showHeader().
wfRecursiveRemoveDir | ( | $dir | ) |
Remove a directory and all its content.
Does not hide error.
string | $dir |
Definition at line 1816 of file GlobalFunctions.php.
References wfDebug(), and wfRecursiveRemoveDir().
Referenced by ForeignResourceManager\cleanUp(), ForeignResourceManager\run(), and wfRecursiveRemoveDir().
wfRelativePath | ( | $path, | |
$from | |||
) |
Generate a relative path name to the given file.
May explode on non-matching case-insensitive paths, funky symlinks, etc.
string | $path | Absolute destination path including target filename |
string | $from | Absolute source path, directory only |
Definition at line 2141 of file GlobalFunctions.php.
References $path, and wfBaseName().
Referenced by DumpUploads\outputItem().
wfRemoveDotSegments | ( | $urlPath | ) |
Remove all dot-segments in the provided URL path.
For example, '/a/./b/../c/' becomes '/a/c/'. For details on the algorithm, please see RFC3986 section 5.2.4.
string | $urlPath | URL path, potentially containing dot-segments |
Definition at line 624 of file GlobalFunctions.php.
Referenced by PathRouter\parse(), and wfExpandUrl().
wfReportTime | ( | $nonce = null | ) |
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'.
If $wgShowHostnames is true, the script will also set 'wgHostname' to the hostname of the server handling the request.
string | null | $nonce | Value from OutputPage->getCSP()->getNonce() |
Definition at line 1265 of file GlobalFunctions.php.
References $wgShowHostnames, ResourceLoader\makeConfigSetScript(), ResourceLoader\makeInlineScript(), and wfHostname().
Referenced by SkinTemplate\prepareQuickTemplate(), and OutputPage\tailElement().
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. See comments for wfClearOutputBuffers() for why it would be used.
Note that some PHP configuration options may add output buffer layers which cannot be removed; these are left in place.
bool | $resetGzipEncoding |
Definition at line 1603 of file GlobalFunctions.php.
Referenced by ApiMain\checkConditionalRequestHeaders(), OutputPage\checkLastModified(), SpecialExport\execute(), SpecialUploadStash\outputContents(), ResourceLoader\tryRespondNotModified(), and wfClearOutputBuffers().
wfScript | ( | $script = 'index' | ) |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptPath etc.
except for 'index' and 'load' which use $wgScript/$wgLoadScript
string | $script | Script filename, sans extension |
Definition at line 2307 of file GlobalFunctions.php.
References $wgLoadScript, $wgScript, and $wgScriptPath.
Referenced by ParsoidVirtualRESTService\__construct(), SpecialPage\addFeedLinks(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), SpecialApiHelp\execute(), SpecialContributions\execute(), SpecialFileDuplicateSearch\execute(), SpecialLinkSearch\execute(), RedirectSpecialPage\execute(), SpecialRecentChanges\execute(), ApiHelp\fixHelpLinks(), HTMLForm\getAction(), SpecialLog\getActionButtons(), SpecialVersion\getEntryPointInfo(), SpecialContributions\getForm(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), TablePager\getLimitForm(), ApiOpenSearch\getOpenSearchTemplate(), ContentSecurityPolicy\getReportUri(), ApiRsd\getRsdApiList(), HistoryPager\getStartBody(), HistoryAction\onView(), MediaWiki\Search\SearchWidgets\SearchFormWidget\render(), SpecialMergeHistory\showMergeForm(), SpecialUndelete\showSearchForm(), ApiMain\substituteResultWithError(), UserrightsPage\switchForm(), wfApiMain(), and SpecialWhatLinksHere\whatlinkshereForm().
wfSetBit | ( | & | $dest, |
$bit, | |||
$state = true |
|||
) |
As for wfSetVar except setting a bit.
int | &$dest | |
int | $bit | |
bool | $state |
Definition at line 1528 of file GlobalFunctions.php.
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.
mixed | &$dest | |
mixed | $source | |
bool | $force |
Definition at line 1511 of file GlobalFunctions.php.
References $source.
Referenced by OutputPage\enableClientCache(), LinkCache\forUpdate(), SpecialPage\including(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), SpecialPage\listed(), Parser\Options(), Parser\OutputType(), ParserOutput\preventClickjacking(), CacheTime\setCacheTime(), ParserOutput\setCategoryLinks(), OutputPage\setFileVersion(), ParserOutput\setIndexPolicy(), ParserOutput\setLanguageLinks(), SpecialPage\setListed(), WikiImporter\setNoticeCallback(), ParserOptions\setOptionLegacy(), OutputPage\setRevisionId(), OutputPage\setRevisionTimestamp(), ParserOutput\setSections(), ParserOutput\setText(), ParserOutput\setTimestamp(), ParserOptions\setTimestamp(), ParserOutput\setTitleText(), and ParserOutput\setTOCHTML().
wfShellExec | ( | $cmd, | |
& | $retval = null , |
||
$environ = [] , |
|||
$limits = [] , |
|||
$options = [] |
|||
) |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.
string | string[] | $cmd | If 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 | &$retval | Optional, 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 | $environ | Optional environment variables which should be added to the executed command environment. |
array | $limits | Optional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits. |
array | $options | Array of options:
|
Definition at line 1935 of file GlobalFunctions.php.
References wfGetCaller().
Referenced by DjVuHandler\doTransform(), DjVuImage\retrieveMetaData(), and 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.
string | string[] | $cmd | If 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 | &$retval | Optional, will receive the program's exit code. (non-zero is usually failure) |
array | $environ | Optional environment variables which should be added to the executed command environment. |
array | $limits | Optional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits. |
Definition at line 1988 of file GlobalFunctions.php.
References wfGetCaller(), and wfShellExec().
Referenced by UploadBase\detectVirus(), TransformationalImageHandler\getMagickVersion(), SvgHandler\rasterize(), BitmapHandler\rotate(), BitmapHandler\transformCustom(), and BitmapHandler\transformImageMagick().
wfShellWikiCmd | ( | $script, | |
array | $parameters = [] , |
||
array | $options = [] |
||
) |
Generate a shell-escaped command line string to run a MediaWiki cli script.
Note that $parameters should be a flat array and an option with an argument should consist of two consecutive items in the array (do not use "--option value").
string | $script | MediaWiki cli script path |
array | $parameters | Arguments and options to the script |
array | $options | Associative array of options: 'php': The path to the php executable 'wrapper': Path to a PHP wrapper to handle the maintenance script |
Definition at line 2008 of file GlobalFunctions.php.
References $wgPhpCli.
Referenced by CleanupSpam\execute().
wfShorthandToInteger | ( | ?string | $string = '' , |
int | $default = -1 |
||
) |
Converts shorthand byte notation to integer form.
null | string | $string | |
int | $default | Returned if $string is empty |
Definition at line 2445 of file GlobalFunctions.php.
Referenced by Installer\envCheckMemory(), UploadBase\getMaxPhpUploadSize(), ApiUpload\getMinUploadChunkSize(), WebRequestUpload\isIniSizeOverflow(), and wfMemoryLimit().
wfShowingResults | ( | $offset, | |
$limit | |||
) |
int | $offset | |
int | $limit |
Definition at line 1408 of file GlobalFunctions.php.
References wfMessage().
wfStringToBool | ( | $val | ) |
Convert string value to boolean, when the following are interpreted as true:
string | $val |
Definition at line 1886 of file GlobalFunctions.php.
Referenced by wfIniGetBool().
wfStripIllegalFilenameChars | ( | $name | ) |
Replace all invalid characters with '-'.
Additional characters can be defined in $wgIllegalFileChars (see T22489). By default, $wgIllegalFileChars includes ':', '/', '\'.
string | $name | Filename to process |
Definition at line 2371 of file GlobalFunctions.php.
References $wgIllegalFileChars, and wfBaseName().
Referenced by UploadBase\getTitle(), and MovePage\isValidFileMove().
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.
Definition at line 1754 of file GlobalFunctions.php.
References $wgTmpDirectory.
Referenced by SvgHandler\doTransform(), ImportableUploadRevisionImporter\downloadSource(), WikiImporter\dumpTemp(), MWDocGen\execute(), MediaWikiShell\execute(), MediaWiki\Shell\CommandFactory\getLocalShellboxOptions(), TextSlotDiffRenderer\getTextDiffInternal(), JobRunner\loadBackoffs(), ResourceLoaderImage\rasterize(), CheckStorage\restoreText(), JobRunner\syncBackoffDeltas(), and wfMerge().
wfThumbIsStandard | ( | File | $file, |
array | $params | ||
) |
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output.
$params is considered non-standard if they involve a non-standard width or any non-default parameters aside from width and page number. The number of possible files with standard parameters is far less than that of all combinations; rate-limiting for them can thus be more generious.
File | $file | |
array | $params |
Definition at line 2566 of file GlobalFunctions.php.
References $file, $wgImageLimits, $wgResponsiveImages, and $wgThumbLimits.
Referenced by wfStreamThumb().
wfTimestamp | ( | $outputtype = TS_UNIX , |
|
$ts = 0 |
|||
) |
Get a timestamp string in one of various formats.
mixed | $outputtype | A timestamp in one of the supported formats, the function will autodetect which format is supplied and act accordingly. |
mixed | $ts | Optional timestamp to convert, default 0 for the current time |
Definition at line 1691 of file GlobalFunctions.php.
References wfDebug().
Referenced by MediaWiki\Block\AbstractBlock\__construct(), OutputPage\adaptCdnTTL(), DumpCategoriesAsRdf\addDumpHeader(), ApiMain\addRequestedFields(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendGeneralInfo(), ChangesListSpecialPage\buildQuery(), FileCacheBase\cacheTimestamp(), MediaWiki\Storage\PageEditStash\checkCache(), ApiMain\checkConditionalRequestHeaders(), OutputPage\checkLastModified(), User\confirmationToken(), LanguageWa\date(), Language\date(), DifferenceEngine\debug(), JobRunner\debugCallback(), SpecialUndelete\diffHeader(), JobRunner\doExecuteJob(), SpecialExport\execute(), ApiEditPage\execute(), ApiFeedWatchlist\execute(), ApiMergeHistory\execute(), ApiProtect\execute(), ApiQueryAllUsers\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiSetNotificationTimestamp\execute(), ApiUndelete\execute(), LocalFileRestoreBatch\execute(), BenchmarkParse\execute(), CleanupUploadStash\execute(), FixTimestamps\execute(), GenerateSitemap\execute(), ImportTextFiles\execute(), RemoveUnusedAccounts\execute(), UpdateSearchIndex\execute(), CoreMagicVariables\expand(), Parser\expandMagicVariable(), UserrightsPage\expiryToTimestamp(), ApiQueryWatchlist\extractOutputData(), ApiQueryInfo\extractPageInfo(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryUserContribs\extractRowInfo(), HistoryAction\feedEmpty(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), FeedUtils\formatDiff(), Language\formatExpiry(), ApiResult\formatExpiry(), SpecialUndelete\formatFileRow(), LogFormatter\formatParameterValueForApi(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), AtomFeed\formatTime(), RSSFeed\formatTime(), ImageListPager\formatValue(), GenerateSitemap\generateLimit(), RevDelArchivedFileItem\getApiData(), RevDelFileItem\getApiData(), RevDelRevisionItem\getApiData(), MediaWiki\Block\DatabaseBlock\getAutoblockExpiry(), NewUsersLogFormatter\getComment(), MediaWiki\Rest\Handler\UserContributionsHandler\getContributionsList(), ApiQueryUserInfo\getCurrentUserInfo(), LocalFile\getDescriptionTouched(), User\getExperienceLevel(), ProtectionForm\getExpiry(), FormatMetadata\getExtendedMetadataFromFile(), ApiQueryImageInfo\getInfo(), SpecialActiveUsers\getIntroText(), LogFormatter\getIRCActionText(), OutputPage\getJSVars(), MachineReadableRCFeedFormatter\getLine(), BlockLogFormatter\getMessageParameters(), PNGMetadataExtractor\getMetadata(), SpecialRandomInCategory\getMinAndMaxForCat(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), BlockLogFormatter\getParametersForApi(), RefreshLinksJob\getParserOutputFromCache(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), PageArchive\getPreviousRevisionRecord(), ActiveUsersPager\getQueryInfo(), RawAction\getRawText(), CoreMagicVariables\getRevisionTimestampSubstring(), ApiQuerySearch\getSearchResultData(), FindBadBlobs\getStartTimestamp(), ImageHistoryList\getThumbForLine(), ArchivedFile\getTimestamp(), ForeignAPIFile\getTimestamp(), DatabaseLogEntry\getTimestamp(), ManualLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), RevisionItemBase\getTimestamp(), WANCacheReapUpdate\getTitleChangeEvents(), User\getTouched(), ApiQueryInfo\getVisitingWatcherInfo(), ForeignAPIRepo\httpGet(), ImageHistoryList\imageHistoryLine(), MediaWiki\Block\DatabaseBlock\initFromRow(), Language\internalUserTimeAndDate(), RefreshLinksJob\isAlreadyRefreshed(), User\isEmailConfirmationPending(), RecentChange\isInRCLifespan(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), User\loadDefaults(), LocalFile\loadFromCache(), User\loadFromCache(), MessageCache\loadFromDB(), RecentChange\loadFromRow(), User\loadFromRow(), LocalFile\loadFromRow(), SpecialUndelete\loadRequest(), MediaWiki\Rest\Handler\PageHistoryCountHandler\loggingTableTime(), ApiMain\logRequest(), GenerateSitemap\main(), FormatMetadata\makeFormattedData(), MediaWiki\Session\Token\match(), SpecialBlock\maybeAlterFormDefaults(), User\newTouchedTimestamp(), OutputPage\output(), SpecialRecentChanges\outputChangesList(), InfoAction\pageCounts(), MediaWiki\Storage\PageEditStash\parseAndCache(), MediaWiki\Block\BlockUser\parseExpiryInput(), MediaWiki\Rest\Handler\PageHistoryHandler\processDbResults(), ImageBuilder\progress(), TableCleanup\progress(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), LocalFile\publishTo(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), QueryPage\recache(), ManageJobs\repushAbandoned(), ApiQueryCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryDuplicateFiles\run(), ApiQueryProtectedTitles\run(), ApiQueryQueryPage\run(), ApiQueryWatchlistRaw\run(), CategoryMembershipChangeJob\run(), ApiMain\sendCacheHeaders(), MediaWiki\Block\BlockManager\setBlockCookie(), OutputPage\setLastModified(), WikiRevision\setTimestamp(), ApiComparePages\setVals(), BackupDumper\showReport(), TextPassDumper\showReport(), MediaWiki\Storage\PageEditStash\storeStashValue(), Language\time(), Language\timeanddate(), IPTC\timeHelper(), MediaWiki\Session\Token\toString(), ApiUpload\transformWarnings(), RecentChangesUpdateJob\updateActiveUsers(), MediaWiki\Block\DatabaseBlock\updateTimestamp(), CategoryChangesAsRdf\updateTS(), EditPage\wasDeletedSinceLastEdit(), wfApiMain(), wfStreamThumb(), wfTimestampOrNull(), and XmlDumpWriter\writeTimestamp().
wfTimestampNow | ( | ) |
Convenience function; returns MediaWiki timestamp for the present time.
Definition at line 1720 of file GlobalFunctions.php.
Referenced by UserGroupMembership\__construct(), CategoryMembershipChange\__construct(), LinksDeletionUpdate\__construct(), User\confirmEmail(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Block\DatabaseBlock\doAutoblock(), SpecialWatchlist\doHeader(), PoolWorkArticleView\doWork(), SpecialExport\execute(), ApiEditPage\execute(), ApiProtect\execute(), ApiUserrights\execute(), GenerateSitemap\execute(), ImportTextFiles\execute(), MigrateFileRepoLayout\execute(), PPFuzzTest\execute(), ResetUserEmail\execute(), UpdateSearchIndex\execute(), FormatMetadata\fetchExtendedMetadata(), MediaWiki\Permissions\RestrictionStore\getCascadeProtectionSourcesInternal(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), RefreshLinksJob\getParserOutput(), ManualLogEntry\getTimestamp(), ParserOptions\getTimestamp(), EditPage\importFormData(), ManualLogEntry\insert(), MessageCache\isCacheExpired(), MediaWiki\Block\DatabaseBlock\isExpired(), Job\newRootJobParams(), SpecialLockdb\onSubmit(), SpecialRecentChanges\optionsPanel(), AtomFeed\outHeader(), RSSFeed\outHeader(), WikiImporter\processRevision(), ManageJobs\repushAbandoned(), ProtectionForm\save(), MediaWiki\Parser\RevisionOutputCache\save(), ParserCache\save(), LogPage\saveContent(), HTMLFileCache\saveToFileCache(), UserrightsPage\saveUserGroups(), and MergeHistory\updateSourcePage().
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.
int | $outputtype | |
string | null | $ts |
Definition at line 1707 of file GlobalFunctions.php.
References wfTimestamp().
Referenced by ApiQueryUsers\execute(), ResetPageRandom\execute(), MediaWiki\Rest\Handler\PageHistoryCountHandler\getLastModifiedTimes(), NoWriteWatchedItemStore\getLatestNotificationTimestamp(), WatchedItemStore\getLatestNotificationTimestamp(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), Job\getQueuedTimestamp(), Job\getReleaseTimestamp(), JobSpecification\getReleaseTimestamp(), HTMLCacheUpdateJob\invalidateTitles(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), MediaWiki\Storage\PageEditStash\lastEditTime(), and User\loadFromRow().
wfTransactionalTimeLimit | ( | ) |
Raise the request time limit to $wgTransactionalTimeLimit.
Definition at line 2415 of file GlobalFunctions.php.
References $wgTransactionalTimeLimit.
Referenced by RollbackAction\enableTransactionalTimelimit(), Action\useTransactionalTimeLimit(), ApiBase\useTransactionalTimeLimit(), and SpecialPage\useTransactionalTimeLimit().
wfUnpack | ( | $format, | |
$data, | |||
$length = false |
|||
) |
Wrapper around php's unpack.
string | $format | The format string (See php's docs) |
string | $data | A binary string of binary data |
int | bool | $length | The minimum length of $data or false. This is to prevent reading beyond the end of $data. false to disable the check. |
Also be careful when using this function to read unsigned 32 bit integer because php might make it negative.
MWException | If $data not long enough, or if unpack fails |
Definition at line 2504 of file GlobalFunctions.php.
Referenced by JpegMetadataExtractor\doPSIR(), BmpHandler\getSizeAndMetadata(), XCFHandler\getXCFMetaData(), JpegMetadataExtractor\jpegExtractMarker(), and JpegMetadataExtractor\segmentSplitter().
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.
string | $s |
Definition at line 292 of file GlobalFunctions.php.
References $s.
Referenced by Title\__wakeup(), OutputPage\addHelpLink(), CoreParserFunctions\basepagenamee(), CoreMagicVariables\expand(), FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), WikiReference\getLocalUrl(), Title\getLocalURL(), MediaWikiSite\getPageUrl(), Title\getPrefixedURL(), LoginSignupSpecialPage\getReturnToQueryStringFragment(), Title\getSubpageUrlForm(), ParserOutput\getText(), Interwiki\getURL(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), Title\makeTitle(), CoreParserFunctions\namespacee(), CoreParserFunctions\nse(), CoreParserFunctions\rootpagenamee(), Title\secureAndSplit(), CoreParserFunctions\speciale(), CoreParserFunctions\subjectspacee(), and CoreParserFunctions\talkspacee().
wfUrlProtocols | ( | $includeProtocolRelative = true | ) |
Returns a regular expression of url protocols.
bool | $includeProtocolRelative | If false, remove '//' from the returned protocol list. DO NOT USE this directly, use wfUrlProtocolsWithoutProtRel() instead |
Definition at line 702 of file GlobalFunctions.php.
References $wgUrlProtocols.
Referenced by Skin\addToSidebarPlain(), Skin\makeInternalOrExternalUrl(), Sanitizer\safeEncodeAttribute(), Sanitizer\validateAttributes(), and wfUrlProtocolsWithoutProtRel().
wfUrlProtocolsWithoutProtRel | ( | ) |
Like wfUrlProtocols(), but excludes '//' from the protocol list.
Use this if you need a regex that matches all URL protocols but does not match protocol- relative URLs
Definition at line 747 of file GlobalFunctions.php.
References wfUrlProtocols().
Referenced by Parser\handleExternalLinks(), and Parser\handleMagicLinks().
wfVarDump | ( | $var | ) |
A wrapper around the PHP function var_export().
Either print it or add it to the regular output ($wgOut).
mixed | $var | A PHP variable to dump. |
Definition at line 1546 of file GlobalFunctions.php.
wfWarn | ( | $msg, | |
$callerOffset = 1 , |
|||
$level = E_USER_NOTICE |
|||
) |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
To log warnings in production, use wfLogWarning() instead.
string | $msg | Message to send |
int | $callerOffset | Number of items to go back in the backtrace to find the correct caller (1 = function calling wfWarn, ...) |
int | $level | PHP error level; defaults to E_USER_NOTICE; only used when $wgDevelopmentWarnings is true |
Definition at line 1043 of file GlobalFunctions.php.
Referenced by Exif\__construct(), TextContent\__construct(), Action\__construct(), MediaWiki\Storage\SqlBlobStore\decompressData(), ApiEditPage\execute(), TextPassDumper\exportTransform(), ForeignAPIRepo\fileExistsBatch(), Http\get(), MediaWiki\SpecialPage\SpecialPageFactory\getAliasList(), DifferenceEngine\getEngine(), ContribsPager\getExtraSortFields(), ContribsPager\getIndexField(), MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(), Language\getMagic(), MediaWiki\Revision\SlotRoleRegistry\getRoleHandler(), ChangeTags\getSoftwareTags(), MediaWiki\initializeArticle(), Html\inlineScript(), Linker\link(), Html\linkedScript(), Linker\makeBrokenImageLinkObj(), MediaWiki\Storage\PageUpdater\makeNewRevision(), Html\openElement(), BacklinkJobUtils\partitionBacklinkJob(), and EditPage\showEditForm().
wfWikiID | ( | ) |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition at line 2184 of file GlobalFunctions.php.
References $wgDBname, and $wgDBprefix.