includes/GlobalFunctions.php File Reference

Go to the source code of this file.

Enumerations

enum  TS_UNIX
 Unix time - the number of seconds since 1970-01-01 00:00:00 UTC. More...
enum  TS_MW
 MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS). More...
enum  TS_DB
 MySQL DATETIME (YYYY-MM-DD HH:MM:SS). More...
enum  TS_RFC2822
 RFC 2822 format, for E-mail and HTTP headers. More...
enum  TS_ISO_8601
 ISO 8601 format with no timezone: 1986-02-09T20:00:00Z. More...
enum  TS_EXIF
 An Exif timestamp (YYYY:MM:DD HH:MM:SS). More...
enum  TS_ORACLE
 Oracle format time. More...
enum  TS_POSTGRES
 Postgres format time. More...
enum  TS_DB2
 DB2 format time. More...

Functions

 wfArrayDiff2 ($a, $b)
 Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
 wfArrayDiff2_cmp ($a, $b)
 wfClone ($object)
 Wrapper for clone(), for compatibility with PHP4-friendly extensions.
 wfSeedRandom ()
 Seed Mersenne Twister No-op for compatibility; only necessary in PHP < 4.2.0.
 wfRandom ()
 Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any realistic number of articles.
 wfUrlencode ($s)
 We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default.
 wfDebug ($text, $logonly=false)
 Sends a line to the debug log if enabled or, optionally, to a comment in output.
 wfDebugMem ($exact=false)
 Send a line giving PHP memory usage.
 wfDebugLog ($logGroup, $text, $public=true)
 Send a line to a supplementary debug log file, if configured, or main debug log if not.
 wfLogDBError ($text)
 Log for database errors.
 wfErrorLog ($text, $file)
 Log to a file without getting "file size exceeded" signals.
 wfLogProfilingData ()
 wfReadOnly ()
 Check if the wiki read-only lock file is present.
 wfReadOnlyReason ()
 wfGetLangObj ($langcode=false)
 Return a Language object from $langcode.
 wfMsg ($key)
 Get a message from anywhere, for the current user language.
 wfMsgNoTrans ($key)
 Same as above except doesn't transform the message.
 wfMsgForContent ($key)
 Get a message from anywhere, for the current global language set with $wgLanguageCode.
 wfMsgForContentNoTrans ($key)
 Same as above except doesn't transform the message.
 wfMsgNoDB ($key)
 Get a message from the language file, for the UI elements.
 wfMsgNoDBForContent ($key)
 Get a message from the language file, for the content.
 wfMsgReal ($key, $args, $useDB=true, $forContent=false, $transform=true)
 Really get a message.
 wfMsgWeirdKey ($key)
 This function provides the message source for messages to be edited which are *not* stored in the database.
 wfMsgGetKey ($key, $useDB, $langCode=false, $transform=true)
 Fetch a message string value, but don't replace any keys yet.
 wfMsgReplaceArgs ($message, $args)
 Replace message parameter keys on the given formatted output.
 wfMsgHtml ($key)
 Return an HTML-escaped version of a message.
 wfMsgWikiHtml ($key)
 Return an HTML version of message Parameter replacements, if any, are done *after* parsing the wiki-text message, so parameters may contain HTML (eg links or form controls).
 wfMsgExt ($key, $options)
 Returns message in the requested format.
 wfAbruptExit ($error=false)
 Just like exit() but makes a note of it.
 wfErrorExit ()
 wfDie ($msg='')
 Print a simple message and die, returning nonzero to the shell if any.
 wfDebugDieBacktrace ($msg= '')
 Throw a debugging exception.
 wfHostname ()
 Fetch server name for use in error reporting etc.
 wfReportTime ()
 Returns a HTML comment with the elapsed time since request.
 wfDebugBacktrace ()
 Safety wrapper for debug_backtrace().
 wfBacktrace ()
 wfShowingResults ($offset, $limit)
 wfShowingResultsNum ($offset, $limit, $num)
 wfViewPrevNext ($offset, $limit, $link, $query= '', $atend=false)
 Generate (prev x| next x) (20|50|100.
 wfNumLink ($offset, $limit, $title, $query= '')
 Generate links for (20|50|100.
 wfClientAcceptsGzip ()
 wfCheckLimits ($deflimit=50, $optionname= 'rclimit')
 Obtain the offset and limit values from the request string; used in special pages.
 wfEscapeWikiText ($text)
 Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
 wfQuotedPrintable ($string, $charset= '')
 wfTime ()
 wfSetVar (&$dest, $source)
 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.
 wfSetBit (&$dest, $bit, $state=true)
 As for wfSetVar except setting a bit.
 wfArrayToCGI ($array1, $array2=NULL)
 This function takes two arrays as input, and returns a CGI-style string, e.g.
 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.
 wfAppendQuery ($url, $query)
 Append a query string to an existing URL, which may or may not already have query string parameters already.
 wfExpandUrl ($url)
 Expand a potentially local URL to a fully-qualified URL.
 wfPurgeSquidServers ($urlArr)
 This is obsolete, use SquidUpdate::purge().
 wfEscapeShellArg ()
 Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell, but the escapeshellarg() function puts single quotes in regardless of OS.
 wfMerge ($old, $mine, $yours, &$result)
 wfMerge attempts to merge differences between three texts.
 wfDiff ($before, $after, $params= '-u')
 Returns unified plain-text diff of two texts.
 wfVarDump ($var)
 A wrapper around the PHP function var_export().
 wfHttpError ($code, $label, $desc)
 Provide a simple HTTP error.
 wfResetOutputBuffers ($resetGzipEncoding=true)
 Clear away any user-level output buffers, discarding contents.
 wfClearOutputBuffers ()
 More legible than passing a 'false' parameter to wfResetOutputBuffers():.
 wfAcceptToPrefs ($accept, $def= '*/*')
 Converts an Accept-* header into an array mapping string values to quality factors.
 mimeTypeMatch ($type, $avail)
 Checks if a given MIME type matches any of the keys in the given array.
 wfNegotiateType ($cprefs, $sprefs)
 Returns the 'best' match between a client's requested internet media types and the server's list of available types.
 wfArrayLookup ($a, $b)
 Array lookup Returns an array where the values in the first array are replaced by the values in the second array with the corresponding keys.
 wfTimestampNow ()
 Convenience function; returns MediaWiki timestamp for the present time.
 wfSuppressWarnings ($end=false)
 Reference-counted warning suppression.
 wfRestoreWarnings ()
 Restore error level to previous value.
 wfTimestamp ($outputtype=TS_UNIX, $ts=0)
 wfTimestampOrNull ($outputtype=TS_UNIX, $ts=null)
 Return a formatted timestamp, or null if input is null.
 wfIsWindows ()
 Check if the operating system is Windows.
 swap (&$x, &$y)
 Swap two variables.
 wfGetCachedNotice ($name)
 wfGetNamespaceNotice ()
 wfGetSiteNotice ()
wfGetMimeMagic ()
 BC wrapper for MimeMagic::singleton().
 wfTempDir ()
 Tries to get the system directory for temporary files.
 wfMkdirParents ($dir, $mode=null, $caller=null)
 Make directory, and make all parent directories if they don't exist.
 wfIncrStats ($key)
 Increment a statistics counter.
 wfPercent ($nr, $acc=2, $round=true)
 wfEncryptPassword ($userid, $password)
 Encrypt a username/password.
 wfAppendToArrayIfNotDefault ($key, $value, $default, &$changed)
 Appends to second array if $value differs from that in $default.
 wfEmptyMsg ($msg, $wfMsgOut)
 Since wfMsg() and co suck, they don't return false if the message key they looked up didn't exist but a XHTML string, this function checks for the nonexistance of messages by looking at wfMsg() output.
 in_string ($needle, $str)
 Find out whether or not a mixed variable exists in a string.
 wfSpecialList ($page, $details)
 wfUrlProtocols ()
 Returns a regular expression of url protocols.
 wfIniGetBool ($setting)
 Safety wrapper around ini_get() for boolean settings.
 wfShellExec ($cmd, &$retval=null)
 Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.
 wfInitShellLocale ()
 Workaround for http://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale.
 wfUsePHP ($req_ver)
 This function works like "use VERSION" in Perl, the program will die with a backtrace if the current version of PHP is less than the version provided.
 wfUseMW ($req_ver)
 This function works like "use VERSION" in Perl except it checks the version of MediaWiki, the program will die with a backtrace if the current version of MediaWiki is less than the version provided.
 wfRegexReplacement ($string)
 wfBaseName ($path, $suffix='')
 Return the final portion of a pathname.
 wfRelativePath ($path, $from)
 Generate a relative path name to the given file.
 wfArrayMerge ($array1)
 Backwards array plus for people who haven't bothered to read the PHP manual XXX: will not darn your socks for you.
 wfMergeErrorArrays ()
 Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
 wfParseUrl ($url)
 parse_url() work-alike, but non-broken.
 wfMakeUrlIndex ($url)
 Make a URL index, appropriate for the el_index field of externallinks.
 wfDoUpdates ()
 Do any deferred updates and clear the list TODO: This could be in Wiki.php if that class made any sense at all.
 wfExplodeMarkup ($separator, $text)
 wfBaseConvert ($input, $sourceBase, $destBase, $pad=1, $lowercase=true)
 Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to a minimum column width.
 wfCreateObject ($name, $p)
 Create an object with a given name and an array of construct parameters.
 wfGetHTTP ($url, $timeout= 'default')
 Alias for modularized function.
 wfIsLocalURL ($url)
 Alias for modularized function.
 wfHttpOnlySafe ()
 wfSetupSession ()
 Initialise php session.
 wfGetPrecompiledData ($name)
 Get an object from the precompiled serialized directory.
 wfGetCaller ($level=2)
 wfGetAllCallers ()
 Return a string consisting all callers in stack, somewhat useful sometimes for profiling specific points.
 wfFormatStackFrame ($frame)
 Return a string representation of frame.
 wfMemcKey ()
 Get a cache key.
 wfForeignMemcKey ($db, $prefix)
 Get a cache key for a foreign DB.
 wfWikiID ($db=null)
 Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
 wfSplitWikiID ($wiki)
 Split a wiki ID into DB name and table prefix.
wfGetDB ($db, $groups=array(), $wiki=false)
 wfGetLB ($wiki=false)
 Get a load balancer object.
wfGetLBFactory ()
 Get the load balancer factory object.
 wfFindFile ($title, $time=false, $flags=0, $bypass=false)
 Find a file.
 wfLocalFile ($title)
 Get an object referring to a locally registered file.
 wfQueriesMustScale ()
 Should low-performance queries be disabled?
 wfScript ($script= 'index')
 Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptExtension etc.
 wfBoolToStr ($value)
 Convenience function converts boolean values into "true" or "false" (string) values.
 wfLoadExtensionMessages ($extensionName, $langcode=false)
 Load an extension messages file.
 wfGetNull ()
 Get a platform-independent path to the null file, e.g.
 wfMaxlagError ($host, $lag, $maxLag)
 Displays a maxlag error.
 wfDeprecated ($function)
 Throws an E_USER_NOTICE saying that $function is deprecated.
 wfWaitForSlaves ($maxLag)
 Sleep until the worst slave's replication lag is less than or equal to $maxLag, in seconds.
 wfOut ($s)
 Output some plain text in command-line mode or in the installer (updaters.inc).
 wfGenerateToken ($salt= '')
 Generate a random 32-character hexadecimal token.
 wfStripIllegalFilenameChars ($name)
 Replace all invalid characters with -.

Variables

 if (!defined( 'MEDIAWIKI'))
 Global functions used everywhere.


Enumeration Type Documentation

enum TS_DB

MySQL DATETIME (YYYY-MM-DD HH:MM:SS).

Definition at line 1719 of file GlobalFunctions.php.

enum TS_DB2

DB2 format time.

Definition at line 1755 of file GlobalFunctions.php.

enum TS_EXIF

An Exif timestamp (YYYY:MM:DD HH:MM:SS).

See also:
http://exif.org/Exif2-2.PDF The Exif 2.2 spec, see page 28 for the DateTime tag and page 36 for the DateTimeOriginal and DateTimeDigitized tags.

Definition at line 1740 of file GlobalFunctions.php.

ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.

This is used by Special:Export

Definition at line 1731 of file GlobalFunctions.php.

enum TS_MW

MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS).

Definition at line 1714 of file GlobalFunctions.php.

enum TS_ORACLE

Oracle format time.

Definition at line 1745 of file GlobalFunctions.php.

Postgres format time.

Definition at line 1750 of file GlobalFunctions.php.

enum TS_RFC2822

RFC 2822 format, for E-mail and HTTP headers.

Definition at line 1724 of file GlobalFunctions.php.

enum TS_UNIX

Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.

Definition at line 1709 of file GlobalFunctions.php.


Function Documentation

in_string ( needle,
str 
)

Find out whether or not a mixed variable exists in a string.

Parameters:
mixed needle
string haystack
Returns:
bool

Definition at line 2099 of file GlobalFunctions.php.

Referenced by Article::isCountable().

mimeTypeMatch ( type,
avail 
) [private]

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.

Parameters:
string $type
array $avail
Returns:
string

Definition at line 1591 of file GlobalFunctions.php.

References $type.

Referenced by GlobalTest::testMimeTypeMatch(), and wfNegotiateType().

swap ( &$  x,
&$  y 
)

Swap two variables.

Definition at line 1856 of file GlobalFunctions.php.

wfAbruptExit ( error = false  ) 

Just like exit() but makes a note of it.

Commits open transactions except if the error parameter is set

Deprecated:
Please return control to the caller or throw an exception

Definition at line 774 of file GlobalFunctions.php.

References $error, $file, $i, wfDebug(), wfDebugBacktrace(), wfGetLB(), and wfLogProfilingData().

Referenced by wfErrorExit().

wfAcceptToPrefs ( accept,
def = '*/*' 
)

Converts an Accept-* header into an array mapping string values to quality factors.

Definition at line 1555 of file GlobalFunctions.php.

Referenced by RdfMetaData::setup().

wfAppendQuery ( url,
query 
)

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

If so, they will be combined.

Parameters:
string $url
string $query
Returns:
string

Definition at line 1240 of file GlobalFunctions.php.

References $url.

Referenced by FileRepo::getDescriptionRenderUrl(), Title::getFullURL(), Title::getLocalURL(), Linker::link(), and Linker::makeThumbLink2().

wfAppendToArrayIfNotDefault ( key,
value,
default,
&$  changed 
)

Appends to second array if $value differs from that in $default.

Definition at line 2070 of file GlobalFunctions.php.

References $changed, and $key.

Referenced by wfSpecialWatchlist().

wfArrayDiff2 ( a,
b 
)

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

Definition at line 111 of file GlobalFunctions.php.

Referenced by Article::doRollback(), EditPage::getEditPermissionErrors(), and UploadForm::internalProcessUpload().

wfArrayDiff2_cmp ( a,
b 
)

Definition at line 114 of file GlobalFunctions.php.

wfArrayLookup ( a,
b 
)

Array lookup Returns an array where the values in the first array are replaced by the values in the second array with the corresponding keys.

Returns:
array

Definition at line 1662 of file GlobalFunctions.php.

wfArrayMerge ( array1  ) 

Backwards array plus for people who haven't bothered to read the PHP manual XXX: will not darn your socks for you.

Parameters:
array $array1, [$array2, [...]]
Returns:
array

Definition at line 2365 of file GlobalFunctions.php.

References $args, and $out.

wfArrayToCGI ( array1,
array2 = NULL 
)

wfBacktrace (  ) 

Definition at line 909 of file GlobalFunctions.php.

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

Referenced by ApiBase::debugPrint().

wfBaseConvert ( input,
sourceBase,
destBase,
pad = 1,
lowercase = true 
)

Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to a minimum column width.

Supports base 2 through 36; digit values 10-36 are represented as lowercase letters a-z. Input is case-insensitive.

Parameters:
$input string of digits
$sourceBase int 2-36
$destBase int 2-36
$pad int 1 or greater
$lowercase bool
Returns:
string or false on invalid input

Definition at line 2518 of file GlobalFunctions.php.

References $i, $input, and $n.

Referenced by FileStore::calculateKey(), ApiQueryBlocks::execute(), ApiQueryImageInfo::getInfo(), ForeignAPIFile::getSha1(), Block::normaliseRange(), ApiQueryAllimages::run(), and File::sha1Base36().

wfBaseName ( path,
suffix = '' 
)

Return the final portion of a pathname.

Reimplemented because PHP5's basename() is buggy with multibyte text. http://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 in our Unix paths either.

Parameters:
string $path
string $suffix to remove if present
Returns:
string

Definition at line 2301 of file GlobalFunctions.php.

References $path, and $suffix.

Referenced by Exif::__construct(), ImageBuilder::checkMissingImage(), GlobalTest::testBasename(), wfRelativePath(), and wfStripIllegalFilenameChars().

wfBoolToStr ( value  ) 

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

Parameters:
bool $value
Returns:
string

Definition at line 2872 of file GlobalFunctions.php.

Referenced by UploadForm::mainUploadForm().

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 compa- tibility with legacy functions that accept raw query strings instead of nice arrays. Of course, keys and values are urldecode()d. Don't try passing in- valid query strings, or it will explode.

Parameters:
$query string Query string
Returns:
array Array version of input

Definition at line 1214 of file GlobalFunctions.php.

References $key.

Referenced by Linker::makeBrokenLinkObj(), Linker::makeKnownLinkObj(), and Linker::makeLinkObj().

wfCheckLimits ( deflimit = 50,
optionname = 'rclimit' 
)

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 1547 of file GlobalFunctions.php.

References wfResetOutputBuffers().

Referenced by OutputPage::checkLastModified().

wfClientAcceptsGzip (  ) 

Todo:
document

FIXME: we may want to blacklist some broken browsers

Returns:
bool Whereas client accept gzip compression

Definition at line 1062 of file GlobalFunctions.php.

References $_SERVER, $wgUseGzip, and wfDebug().

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

wfClone ( object  ) 

Wrapper for clone(), for compatibility with PHP4-friendly extensions.

PHP 5 won't let you declare a 'clone' function, even conditionally, so it has to be a wrapper with a different name.

Definition at line 137 of file GlobalFunctions.php.

wfCreateObject ( name,
p 
)

Create an object with a given name and an array of construct parameters.

Parameters:
string $name
array $p parameters

Definition at line 2596 of file GlobalFunctions.php.

References $name.

Referenced by StubObject::_newObject(), and SpecialPage::getPage().

wfDebug ( text,
logonly = false 
)

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 $wgProfileOnly - if set, normal debug messages will not be recorded. $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.

Parameters:
$text String
$logonly Bool: set true to avoid appearing in HTML when $wgDebugComments is set

Definition at line 208 of file GlobalFunctions.php.

References $text, $wgDebugComments, $wgDebugLogFile, $wgDebugLogPrefix, $wgDebugRawPage, $wgOut, $wgProfileOnly, StubObject::isRealObject(), and wfErrorLog().

Referenced by Parser::__construct(), MimeMagic::__construct(), DifferenceEngine::__construct(), DBABagOStuff::__construct(), ApiMain::__construct(), BagOStuff::_debug(), MathRenderer::_getHashPath(), StubUserLang::_newObject(), StubObject::_unstub(), LogPage::actionText(), EmailNotification::actuallyNotifyOnPageChange(), ImageGallery::add(), FileCache::addFiles(), LoginForm::addNewAccountInternal(), LinkBatch::addObj(), LocalFileMoveBatch::addOlds(), DatabaseIbm_db2::addQuotesSmart(), afterContentHook(), FSTransaction::apply(), LoginForm::attemptAutoCreate(), LoginForm::authenticateUserData(), AutoLoader::autoload(), Parser::braceSubstitution(), FileStore::calculateKey(), OutputPage::checkLastModified(), AjaxResponse::checkLastModified(), UploadForm::checkSvgScriptCallback(), LocalRepo::cleanupDeletedBatch(), FileCache::clearFiles(), Revision::compressRevisionText(), Article::confirmDelete(), DjVuImage::convertDumpToXML(), FileStore::copyFile(), RecompressTracked::debug(), BaseDump::debug(), SquidUpdate::debug(), Profiler::debug(), WikiImporter::debug(), DBABagOStuff::delete(), DeleteArchivedFiles(), Block::deleteIfExpired(), User::deleteNewtalk(), MimeMagic::detectMimeType(), UploadForm::detectScript(), UploadForm::detectVirus(), MimeMagic::detectZipType(), WikiDiff3::diff(), Parser::disableCache(), Block::doAutoblock(), Article::doDeleteArticle(), Parser::doDoubleUnderscore(), Article::doEdit(), CBTProcessor::doFunction(), MimeMagic::doGuessMimeType(), WikiImporter::doImport(), ImagePage::doPurge(), DatabaseOracle::doQuery(), Block::doRetroactiveAutoblock(), DjVuHandler::doTransform(), BitmapHandler::doTransform(), LoadBalancer::doWait(), WikiRevision::downloadSource(), EditPage::edit(), Article::editUpdates(), LocalFileRestoreBatch::execute(), ChangesFeed::execute(), ExternalStoreDB::fetchBlob(), Article::fetchContent(), HTMLFileCache::fileCacheName(), WikiDiff3::find_middle_snake(), Parser::findColonNoLinks(), FileCache::findFile(), FileCache::findFiles(), FSRepo::freeTemp(), ParserCache::get(), DBABagOStuff::get(), User::getBlockedStatus(), LoadBalancer::getConnection(), File::getDescriptionText(), WebRequest::getFileName(), DoubleRedirectJob::getFinalDestination(), MediaHandler::getHandler(), DjVuImage::getInfo(), Interwiki::getInterwikiCacheEntry(), Database::getLag(), BacklinkCache::getLinks(), LoadBalancer::getMasterPos(), DjVuHandler::getMetadata(), DjVuHandler::getMetaTree(), DjVuImage::getMultiPageInfo(), DjVuImage::getPageInfo(), EmailUserForm::getPermissionsError(), File::getPropsFromPath(), LoadBalancer::getRandomNonLagged(), DBABagOStuff::getReader(), LoadBalancer::getReaderIndex(), Database::getSlavePos(), DisambiguationsPage::getSQL(), DatabaseIbm_db2::getStatus(), ForeignAPIRepo::getThumbUrl(), ForeignAPIRepo::getThumbUrlFromCache(), Parser::getUserSig(), Parser::getVariableValue(), File::getViewURL(), DBABagOStuff::getWriter(), MimeMagic::guessMimeType(), OutputPage::haveCacheVaryCookies(), MacBinary::hexdump(), SquidUpdate::HTCPPurge(), EditPage::importFormData(), WikiRevision::importLogItem(), WikiRevision::importOldRevision(), WikiRevision::importUpload(), User::inDnsBlacklist(), ChronologyProtector::initLB(), DatabaseIbm_db2::insert(), Block::insert(), ExternalStore::insertToDefault(), EditPage::internalAttemptSave(), UploadForm::internalProcessUpload(), User::isBlocked(), User::isBlockedFrom(), SvgHandler::isEnabled(), DjVuHandler::isEnabled(), FileDependency::isExpired(), Block::isExpired(), HTMLFileCache::isFileCacheGood(), BitmapHandler::isMetadataValid(), Title::isValidMoveTarget(), Block::isWhitelistedFromAutoblocks(), DatabaseIbm_db2::limitResult(), MessageCache::load(), Block::load(), SiteStats::loadAndLazyInit(), ChangesFeed::loadFromCache(), HTMLFileCache::loadFromFileCache(), User::loadFromId(), AjaxResponse::loadFromMemcached(), User::loadFromSession(), MacBinary::loadHeader(), Language::loadLocalisation(), MessageCache::loadMessagesFile(), DatabaseIbm_db2::lock(), Database::lock(), UploadForm::mainUploadForm(), Linker::makeBrokenLink(), Linker::makeExternalImage(), Linker::makeExternalLink(), Linker::makeImageLink2(), Linker::makeKnownLink(), Linker::makeLink(), DatabaseIbm_db2::makeList(), RevisionDeleter::makeOldImagePrivate(), RevisionDeleter::makeOldImagePublic(), Linker::makeStubLink(), FileCache::markNotFound(), Database::masterPosWait(), User::matchEditToken(), Skin::newFromKey(), ImportStreamSource::newFromURL(), DatabaseSqlite::open(), DatabasePostgres::open(), DatabaseOracle::open(), DatabaseMssql::open(), DatabaseIbm_db2::open(), Database::open(), LoadBalancer::openConnection(), LoadBalancer::openForeignConnection(), UploadDumper::outputItem(), SkinTemplate::outputPage(), SearchPostgres::parseQuery(), SearchMySQL::parseQuery(), BacklinkCache::partition(), DiffHistoryBlob::patch(), AjaxDispatcher::performAction(), DatabasePostgres::ping(), DatabaseOracle::ping(), DatabaseMssql::ping(), Database::ping(), User::pingLimiter(), FSRepo::publishBatch(), Database::query(), SvgHandler::rasterize(), TextPassDumper::readDump(), LoadBalancer::reallyOpenConnection(), EnhancedChangesList::recentChangesLine(), LocalFile::recordUpload2(), MathRenderer::render(), Article::replaceSection(), Parser::replaceVariables(), DatabasePostgres::reportQueryError(), DatabaseOracle::reportQueryError(), Database::reportQueryError(), Http::request(), MediaWiki::restInPeace(), LoadBalancer::reuseConnection(), DoubleRedirectJob::run(), ParserCache::save(), HTMLFileCache::saveToFileCache(), MessageCache::saveToLocal(), MessageCache::saveToScript(), UserrightsPage::saveUserGroups(), SearchPostgres::searchQuery(), SearchUpdate::SearchUpdate(), DatabaseIbm_db2::select(), UserMailer::send(), OutputPage::sendCacheControl(), RecentChange::sendToUDP(), UserMailer::sendWithPear(), DBABagOStuff::set(), DatabaseIbm_db2::setFakeMaster(), DatabaseIbm_db2::setFakeSlaveLag(), DatabaseIbm_db2::setTimeout(), ParserTest::setupUploadDir(), ChronologyProtector::shutdown(), ChronologyProtector::shutdownLB(), LoadBalancer::sleep(), User::spreadBlock(), WikiImporter::throwXmlError(), MWTidy::tidy(), File::transform(), Article::tryFileCache(), PageArchive::undelete(), PageArchive::undeleteRevisions(), DatabaseIbm_db2::unlock(), Block::update(), User::updateNewtalk(), Article::updateRestrictions(), OldLocalFile::upgradeRow(), LocalFile::upgradeRow(), Revision::userCan(), LogEventsList::userCan(), OldLocalFile::userCan(), ArchivedFile::userCan(), ChangesList::userCan(), EmailUserForm::validateEmailTarget(), ImageHandler::validateThumbParams(), UploadForm::verify(), UploadForm::verifyExtension(), RawPage::view(), Article::view(), DatabaseIbm_db2::wasDeadlock(), wfAbruptExit(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfDebugLog(), wfDebugMem(), wfDeprecated(), wfDiff(), wfGetCache(), wfGetCachedNotice(), wfGetIP(), wfGetLangObj(), wfMerge(), wfMkdirParents(), wfShellExec(), wfTimestamp(), and WikiXmlError::WikiXmlError().

wfDebugBacktrace (  ) 

Safety wrapper for debug_backtrace().

With Zend Optimizer 3.2.0 loaded, this causes segfaults under somewhat murky circumstances, which may be triggered in part by stub objects or other fancy talkin'.

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

Returns:
array of backtrace information

Definition at line 884 of file GlobalFunctions.php.

References wfDebug().

Referenced by Profiler::getCaller(), wfAbruptExit(), wfBacktrace(), wfDeprecated(), wfGetAllCallers(), and wfGetCaller().

wfDebugDieBacktrace ( msg = ''  ) 

Throw a debugging exception.

This function previously once exited the process, but now throws an exception instead, with similar results.

Parameters:
string $msg Message shown when dieing.

Definition at line 823 of file GlobalFunctions.php.

References $msg.

Referenced by Language::checkTitleEncoding(), and ApiBase::dieDebug().

wfDebugLog ( logGroup,
text,
public = true 
)

wfDebugMem ( exact = false  ) 

Send a line giving PHP memory usage.

Parameters:
$exact Bool : print exact values instead of kilobytes (default: false)

Definition at line 252 of file GlobalFunctions.php.

References wfDebug().

wfDeprecated ( function  ) 

Throws an E_USER_NOTICE saying that $function is deprecated.

Parameters:
string $function
Returns:
null

Definition at line 2953 of file GlobalFunctions.php.

References $file, $msg, $wgDebugLogFile, wfDebug(), and wfDebugBacktrace().

Referenced by LogViewer::__construct(), LogReader::__construct(), Image::__construct(), OutputPage::addPrimaryWikiText(), OutputPage::addSecondaryWikiText(), SiteStats::admins(), MessageCache::disableTransform(), Linker::editSectionLink(), Linker::editSectionLinkForOther(), MessageCache::enableTransform(), OutputPage::errorpage(), OutputPage::fatalError(), OutputPage::fileCopyError(), OutputPage::fileDeleteError(), OutputPage::fileNotFoundError(), OutputPage::fileRenameError(), Article::getDB(), Language::getDefaultUserOptions(), MessageCache::getTransform(), HTMLnamespaceselector(), Image::imageUrl(), Article::insertNewArticle(), User::isBot(), Linker::makeImage(), Linker::makeStubLink(), Linker::makeStubLinkObj(), Image::newFromName(), Image::newFromTitle(), Linker::postParseLinkColour(), OutputPage::reportTime(), User::setLoaded(), Database::setOutputPage(), OutputPage::setParserOptions(), MessageCache::setTransform(), User::SetupSession(), Article::showArticle(), OutputPage::unexpectedValueError(), Article::updateArticle(), wfAttrib(), wfBuildForm(), wfCheck(), wfCheckLabel(), wfCloseElement(), wfElement(), wfElementClean(), wfEncryptPassword(), wfEscapeJsString(), wfGetHTTP(), wfHidden(), wfInput(), wfInputLabel(), wfIsLocalURL(), wfIsWellFormedXml(), wfIsWellFormedXmlFragment(), wfLabel(), wfOpenElement(), wfRadio(), wfRadioLabel(), wfSpan(), and wfSubmitButton().

wfDie ( msg = ''  ) 

wfDiff ( before,
after,
params = '-u' 
)

Returns unified plain-text diff of two texts.

Useful for machine processing of diffs.

Parameters:
$before string The text before the changes.
$after string The text after the changes.
$params string Command-line options for the diff command.
Returns:
string Unified diff of $before and $after

Definition at line 1395 of file GlobalFunctions.php.

References $cmd, $wgDiff, wfDebug(), and wfTempDir().

Referenced by Parser_DiffTest::__call().

wfDoUpdates (  ) 

Do any deferred updates and clear the list TODO: This could be in Wiki.php if that class made any sense at all.

Definition at line 2484 of file GlobalFunctions.php.

References $wgDeferredUpdateList, and $wgPostCommitUpdateList.

Referenced by cleanupArticle(), and Article::doEdit().

wfEmptyMsg ( msg,
wfMsgOut 
)

Since wfMsg() and co suck, they don't return false if the message key they looked up didn't exist but a XHTML string, this function checks for the nonexistance of messages by looking at wfMsg() output.

Parameters:
$msg The message key looked up
$wfMsgOut The output of wfMsg*()
Returns:
bool

Definition at line 2088 of file GlobalFunctions.php.

Referenced by ProtectionForm::buildForm(), buildSidebar(), SpecialContributions::contributionsSub(), UploadForm::curlCopy(), MonoBookTemplate::customBox(), ModernTemplate::customBox(), SpecialTags::doTagRow(), EditPage::edit(), SpecialStatistics::execute(), SpecialListGroupRights::execute(), DeletedContributionsPage::execute(), SpecialContributions::execute(), ApiQueryAllmessages::execute(), SkinMonoBookCBT::fallbackmsg(), LogPage::formatBlockFlag(), SpecialVersion::formatCredits(), SpecialStatistics::formatRow(), Skin::generateUserJs(), NoContentTagToString::getAddedDescription(), TagToString::getAddedDescription(), RawPage::getArticleText(), EditPage::getContent(), Article::getContent(), FileRepo::getDisplayName(), UploadForm::getFilenamePrefixBlacklist(), SpecialContributions::getForm(), SpecialPage::getGroup(), User::getGroupMember(), User::getGroupName(), User::getGroupPage(), SpecialStatistics::getGroupStats(), ProtectionForm::getOptionLabel(), NoContentTagToString::getRemovedDescription(), TagToString::getRemovedDescription(), User::getRightDescription(), DeletedContributionsPage::getSubTitle(), PreferencesForm::mainPrefsForm(), UploadForm::mainUploadForm(), LoginForm::makeLanguageSelector(), Licenses::msg(), SpecialRecentChanges::optionsPanel(), SpecialPage::outputHeader(), Parser::pstPass2(), Article::setOldSubtitle(), SkinMonoBookCBT::sidebar(), Parser::statelessFetchTemplate(), SkinTemplate::tabAction(), ChangeTags::tagDescription(), TagToString::translateArgument(), ImagePage::view(), wfAllMessagesMakePhp(), wfGetCachedNotice(), and wfMsgWeirdKey().

wfEncryptPassword ( userid,
password 
)

Encrypt a username/password.

Parameters:
string $userid ID of the user
string $password Password of the user
Returns:
string Hashed password
Deprecated:
Use User::crypt() or User::oldCrypt() instead

Definition at line 2061 of file GlobalFunctions.php.

References $password, User::oldCrypt(), and wfDeprecated().

wfErrorExit (  ) 

Deprecated:
Please return control the caller or throw an exception

Definition at line 803 of file GlobalFunctions.php.

References wfAbruptExit().

Referenced by SkinMonoBookCBT::compileTemplate(), and SkinMonoBookCBT::getCompiledTemplate().

wfErrorLog ( text,
file 
)

Log to a file without getting "file size exceeded" signals.

Can also log to TCP or UDP with the syntax udp://host:port/prefix. This will send lines to the specified port, prefixed by the specified prefix and a space.

Definition at line 307 of file GlobalFunctions.php.

References $file, $prefix, $size, $text, wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by RecompressTracked::logToFile(), wfDebug(), wfDebugLog(), wfLogDBError(), and wfLogProfilingData().

wfEscapeShellArg (  ) 

Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell, but the escapeshellarg() function puts single quotes in regardless of OS.

Also fixes the locale problems on Linux in PHP 5.2.6+ (bug backported to earlier distro releases of PHP)

Definition at line 1283 of file GlobalFunctions.php.

References $args, wfInitShellLocale(), and wfIsWindows().

Referenced by MimeMagic::detectMimeType(), UploadForm::detectVirus(), DjVuHandler::doTransform(), BitmapHandler::doTransform(), Dump7ZipOutput::Dump7ZipOutput(), DumpPipeOutput::DumpPipeOutput(), DifferenceEngine::generateDiffBody(), SvgHandler::rasterize(), MathRenderer::render(), CheckStorage::restoreText(), DjVuImage::retrieveMetaData(), RecompressTracked::startSlaveProcs(), SevenZipStream::stream_open(), and wfMerge().

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. It currently does not filter out characters which have special meaning only at the start of a line, such as "*".

Parameters:
string $text Text to be escaped

Definition at line 1103 of file GlobalFunctions.php.

References $text.

Referenced by Parser::braceSubstitution(), MergehistoryForm::execute(), CoreParserFunctions::fullpagename(), Parser::getUserSig(), Parser::getVariableValue(), SpecialSearchOld::goResult(), ImagePage::openShowImage(), CoreParserFunctions::pagename(), SpecialSearchOld::setupPage(), UserrightsPage::showEditUserGroupsForm(), SpecialSearch::showResults(), EditPage::spamPage(), CoreParserFunctions::subjectpagename(), and CoreParserFunctions::talkpagename().

wfExpandUrl ( url  ) 

Expand a potentially local URL to a fully-qualified URL.

Assumes $wgServer is correct. :)

Parameters:
string $url, either fully-qualified or a local path + query
Returns:
string Fully-qualified URL

Definition at line 1258 of file GlobalFunctions.php.

References $url, and $wgServer.

Referenced by FileRevertForm::execute(), File::getFullUrl(), ApiQueryImageInfo::getInfo(), User::getTokenUrl(), OutputPage::output(), ChannelFeed::outXmlHeader(), FileDeleteForm::prepareMessage(), and FileRevertForm::showForm().

wfExplodeMarkup ( separator,
text 
)

wfFindFile ( title,
time = false,
flags = 0,
bypass = false 
)

Find a file.

Shortcut for RepoGroup::singleton()->findFile()

Parameters:
mixed $title Title object or string. May be interwiki.
mixed $time Requested time for an archived image, or false for the current version. An image object will be returned which was created at the specified time.
mixed $flags FileRepo::FIND_ flags
boolean $bypass Bypass the file cache even if it could be used
Returns:
File, or false if the file does not exist

Definition at line 2824 of file GlobalFunctions.php.

References $flags, $title, RepoGroup::singleton(), and FileCache::singleton().

Referenced by SearchResult::__construct(), UploadForm::ajaxGetExistsWarning(), ApiDelete::deleteFile(), CoreParserFunctions::filepath(), SearchEngine::getNearMatch(), Image::imageUrl(), Title::isAlwaysKnown(), ImagePage::loadFile(), Linker::makeBrokenImageLinkObj(), Parser::makeImage(), Linker::makeImageLinkObj(), Linker::makeMediaLinkObj(), Linker::makeThumbLink2(), Image::newFromName(), Image::newFromTitle(), UploadDumper::outputItem(), pageTitleLinks(), ImageQueryPage::prepareImage(), SpecialSearchOld::showHit(), SpecialSearch::showHit(), talkLink(), ImageGallery::toHTML(), wfAjaxGetFileUrl(), wfAjaxGetThumbnailUrl(), wfSpecialFileDuplicateSearch(), wfSpecialFilepath(), and XmlDumpWriter::writeUploads().

wfForeignMemcKey ( db,
prefix 
)

Get a cache key for a foreign DB.

Definition at line 2737 of file GlobalFunctions.php.

References $args, $db, $key, and $prefix.

Referenced by ForeignDBFile::getCacheKey(), and UserRightsProxy::invalidateCache().

wfFormatStackFrame ( frame  ) 

Return a string representation of frame.

Definition at line 2719 of file GlobalFunctions.php.

Referenced by wfGetCaller().

wfGenerateToken ( salt = ''  ) 

Generate a random 32-character hexadecimal token.

Parameters:
mixed $salt Some sort of salt, if necessary, to add to random characters before hashing.

Definition at line 3025 of file GlobalFunctions.php.

Referenced by User::crypt().

wfGetAllCallers (  ) 

Return a string consisting all callers in stack, somewhat useful sometimes for profiling specific points.

Definition at line 2714 of file GlobalFunctions.php.

References wfDebugBacktrace().

wfGetCachedNotice ( name  ) 

wfGetCaller ( level = 2  ) 

Definition at line 2703 of file GlobalFunctions.php.

References wfDebugBacktrace(), and wfFormatStackFrame().

Referenced by StubObject::_unstub(), and Parser::parse().

& wfGetDB ( db,
groups = array(),
wiki = false 
)

Definition at line 2791 of file GlobalFunctions.php.

References $db, and wfGetLB().

Referenced by MergeHistoryPager::__construct(), ImageListPager::__construct(), DeletedContribsPager::__construct(), ContribsPager::__construct(), IndexPager::__construct(), MathRenderer::_recall(), OutputPage::addCategoryLinks(), User::addGroup(), LinkCache::addLinkObj(), ChangeTags::addTags(), User::addToDatabase(), Article::addTrackbacks(), WatchedItem::addWatch(), addWiki(), ArticleCounter::ArticleCounter(), Job::batchInsert(), SpecialRecentChanges::buildMainQueryConds(), buildTestDatabase(), SiteStatsUpdate::cacheUpdate(), TitleListDependency::calculateTimestamps(), ChangePassword::ChangePassword(), userOptions::CHANGER(), CheckStorage::check(), checkDupes(), SpecialRecentChanges::checkLastModified(), User::checkNewtalk(), checkOrphans(), checkSeparation(), RecompressTracked::checkTrackingTable(), checkWidows(), cleanupArticle(), User::clearAllNotifications(), User::clearNotification(), WatchlistEditor::clearWatchlist(), CgzCopyTransaction::commit(), Article::commitRollback(), compressOldPages(), compressPage(), compressWithConcat(), convertLinks(), Title::countRevisionsBetween(), WatchlistEditor::countWatchlist(), SearchEngine::create(), User::createNew(), dbsource(), Block::delete(), Article::delete(), DeleteArchivedFiles(), DeleteArchivedRevisions(), deleteDefaultMessages(), deleteLinksFromNonexistent(), User::deleteNewtalk(), DeleteOldRevisions(), DeleteRevisions(), Title::deleteTitleProtection(), Article::deletetrackback(), RecompressTracked::doAllOrphans(), RecompressTracked::doAllPages(), CategoryViewer::doCategoryQuery(), Article::doDeleteArticle(), WatchedItem::doDuplicateEntries(), Article::doEdit(), SpecialExport::doExport(), QueryPage::doFeed(), SpecialRecentchangeslinked::doMainQuery(), SpecialRecentChanges::doMainQuery(), RecompressTracked::doOrphanList(), RecompressTracked::doPage(), Article::doPurge(), QueryPage::doQuery(), LinkBatch::doQuery(), Block::doRetroactiveAutoblock(), MovePageForm::doSubmit(), SiteStatsUpdate::doUpdate(), MediaWiki::doUpdates(), LinkHolderArray::doVariants(), User::edits(), Article::editUpdates(), Article::estimateRevisionCount(), OrphanStats::execute(), UpdateLogging::execute(), SpecialTags::execute(), SpecialStatistics::execute(), ApiUndelete::execute(), ApiFeedWatchlist::execute(), Revision::fetchAllRevisions(), Article::fetchContent(), UploadDumper::fetchLocal(), Revision::fetchRevision(), PageHistory::fetchRevisions(), Parser::fetchScaryTemplateMaybeFromCache(), UploadDumper::fetchUsed(), TitleCleanup::fileExists(), TrackBlobs::findOrphanBlobs(), RecompressTracked::finishIncompleteMoves(), fixDupes(), fixLinksFromArticle(), fixRedirect(), DoubleRedirectJob::fixRedirects(), DoubleRedirectsPage::formatResult(), Article::generateReason(), GenerateSitemap::GenerateSitemap(), EditPage::getBaseRevision(), Title::getBrokenLinksFrom(), Title::getCascadeProtectionSources(), Article::getContributors(), Article::getCount(), UserRightsProxy::getDB(), BacklinkCache::getDB(), Article::getDB(), ApiQuery::getDB(), Block::getDBOptions(), Title::getEarliestRevTime(), DoubleRedirectJob::getFinalDestination(), User::getFirstEditTimestamp(), Title::getFirstRevision(), Article::getHiddenCategories(), DeleteImageCache::getImageCount(), EditPage::getLastDelete(), Article::getLastNAuthors(), PageArchive::getLastRevisionText(), Title::getLatestRevID(), SpecialExport::getLinks(), Title::getLinksTo(), File::getLinksTo(), ForeignDBViaLBRepo::getMasterDB(), FileRepo::getMasterDB(), User::getMaxID(), Category::getMembers(), SpecialStatistics::getMostViewedPages(), ApiQuery::getNamedDB(), Title::getNextRevisionID(), Title::getNotificationTimestamp(), SpecialExport::getPagesFromCategory(), SpecialExport::getPagesFromNamespace(), Title::getParentCategories(), PageArchive::getPreviousRevision(), Title::getPreviousRevisionID(), UsersPager::getQueryInfo(), ImageListPager::getQueryInfo(), Title::getRedirectsHere(), Article::getRedirectTarget(), PageArchive::getRevision(), Parser::getRevisionTimestamp(), ForeignDBViaLBRepo::getSlaveDB(), FileRepo::getSlaveDB(), WithoutInterwikiPage::getSQL(), WantedTemplatesPage::getSQL(), WantedPagesPage::getSQL(), WantedFilesPage::getSQL(), WantedCategoriesPage::getSQL(), UnwatchedpagesPage::getSQL(), UnusedtemplatesPage::getSQL(), UnusedimagesPage::getSQL(), UnusedCategoriesPage::getSQL(), UncategorizedPagesPage::getSQL(), UncategorizedImagesPage::getSQL(), ShortPagesPage::getSQL(), PopularPagesPage::getSQL(), MostrevisionsPage::getSQL(), SpecialMostlinkedtemplates::getSql(), MostlinkedCategoriesPage::getSQL(), MostlinkedPage::getSQL(), MostimagesPage::getSQL(), MostcategoriesPage::getSQL(), MIMEsearchPage::getSQL(), LonelyPagesPage::getSQL(), ListredirectsPage::getSQL(), LinkSearchPage::getSQL(), FileDuplicateSearchPage::getSQL(), FewestrevisionsPage::getSql(), DoubleRedirectsPage::getSQL(), DisambiguationsPage::getSQL(), DeadendPagesPage::getSQL(), BrokenRedirectsPage::getSQL(), AncientPagesPage::getSQL(), Title::getSubpages(), HistoryBlobCurStub::getText(), HistoryBlobStub::getText(), TrackBlobs::getTextClause(), PageArchive::getTextFromRow(), Revision::getTimestampFromId(), Revision::getTitle(), Title::getTitleProtection(), Title::getTouched(), Article::getUsedTemplates(), WatchlistEditor::getWatchlist(), WatchlistEditor::getWatchlistInfo(), BackupReader::handleUpload(), User::idForName(), User::idFromName(), ImagePage::imageLinks(), WikiImporter::importLogItem(), WikiRevision::importLogItem(), WikiRevision::importOldRevision(), CheckStorage::importRevision(), WikiImporter::importRevision(), User::incEditCount(), Article::incViewCount(), Article::info(), Category::initialize(), MediaWiki::initializeArticle(), BackupDumper::initProgress(), TrackBlobs::initTrackingTable(), Job::insert(), Block::insert(), Article::insertNewArticle(), Article::insertRedirect(), HTMLCacheUpdate::invalidate(), User::invalidateCache(), Title::invalidateCache(), User::isActiveEditor(), Title::isDeleted(), PageArchive::isDeleted(), Title::isDeletedQuick(), isInactiveAccount(), Title::isNewPage(), Title::isSingleRevRedirect(), Revision::isUnpatrolled(), Title::isValidMoveTarget(), WatchedItem::isWatched(), SiteStats::jobs(), ImageCleanup::killRow(), LinksUpdate::LinksUpdate(), PageArchive::listAllPages(), ChangeTags::listDefinedTags(), PageArchive::listFiles(), PageArchive::listPagesByPrefix(), PageArchive::listRevisions(), SiteStats::load(), Interwiki::load(), ArchivedFile::load(), SiteStats::loadAndLazyInit(), User::loadFromDatabase(), MessageCache::loadFromDB(), User::loadGroups(), Article::loadLastEdit(), Article::loadPageData(), Title::loadRestrictions(), Title::loadRestrictionsFromRow(), Revision::loadText(), FileStore::lock(), LogImporter::LogImporter(), Profiler::logToDB(), DeleteImageCache::main(), checkUsernames::main(), LinkFilter::makeLike(), makeLink(), Article::markpatrolled(), MergehistoryForm::merge(), EditPage::mergeChangesInto(), Language::minSearchLength(), TitleCleanup::moveIllegalPage(), TitleCleanup::moveInconsistentPage(), Title::moveOverExistingRedirect(), RecompressTracked::moveTextRow(), Title::moveTo(), moveToExternal(), Title::moveToNewTitle(), Title::nameOf(), Revision::newFromConds(), RecentChange::newFromConds(), User::newFromConfirmationCode(), Title::newFromID(), RecentChange::newFromId(), Block::newFromID(), UserArray::newFromIDs(), Title::newFromIDs(), SquidUpdate::newFromLinksTo(), Revision::newFromTitle(), EmailNotification::notifyOnPageChange(), NukeNS(), NukePage(), SiteStats::numberingroup(), SkinMonoBookCBT::numberofwatchingusers(), SkinTemplate::outputPage(), Article::outputWikiText(), Article::pageCountInfo(), SiteStats::pagesInNs(), pageStats(), ImageCleanup::pokeFile(), Job::pop(), Job::pop_type(), populateCategory(), Block::purgeExpired(), Title::purgeExpiredRestrictions(), PurgeRedundantText(), Article::quickEdit(), RecentChange::reallyMarkPatrolled(), reassignEdits(), rebuildRecentChangesTablePass1(), rebuildRecentChangesTablePass2(), rebuildRecentChangesTablePass3(), rebuildRecentChangesTablePass4(), QueryPage::recache(), Category::refreshCounts(), refreshLinks(), User::removeGroup(), WatchlistCleanup::removeWatch(), WatchedItem::removeWatch(), MathRenderer::render(), LinkHolderArray::replaceInternal(), Article::replaceSection(), ImportReporter::reportPage(), resolveStub(), resolveStubs(), CheckStorage::restoreText(), SpecialRevisionDelete::save(), RecentChange::save(), LogPage::saveContent(), User::saveSettings(), RandomPage::selectRandomPageFromDB(), DatabaseTest::setUp(), ParserTest::setupDatabase(), IPBlockForm::setUsernameBitfields(), SpecialAllpages::showChunk(), DifferenceEngine::showDiffPage(), MovePageForm::showForm(), SpecialRevisionDelete::showImages(), WhatLinksHerePage::showIndirectLinks(), IPUnblockForm::showList(), SpecialRevisionDelete::showLogItems(), SpecialPrefixindex::showPrefixChunk(), SpecialRevisionDelete::showRevs(), SpecialAllpages::showToplevel(), SpecialVersion::softwareInformation(), RecompressTracked::syncDBs(), TrackBlobs::trackOrphanText(), TrackBlobs::trackRevisions(), PageArchive::undeleteRevisions(), FileStore::unlock(), WatchlistEditor::unwatchTitles(), SearchOracle::update(), SearchMySQL::update(), SearchIBM_DB2::update(), Block::update(), update_row_exists(), Article::updateArticle(), Article::updateCategoryCounts(), User::updateNewtalk(), Article::updateRestrictions(), updateSearchIndex(), Block::updateTimestamp(), SearchOracle::updateTitle(), SearchMySQL::updateTitle(), SearchIBM_DB2::updateTitle(), Title::updateTitleProtection(), userOptions::USAGER(), UploadForm::userCanReUpload(), EditPage::userWasLastToEdit(), WatchlistEditor::watchTitles(), SpecialRecentChanges::webOutput(), wfAffectedRows(), wfAjaxWatch(), wfAllMessagesMakeHTMLText(), wfDataSeek(), wfFetchObject(), wfFetchRow(), wfFieldExists(), wfFieldName(), wfFreeResult(), wfGetArray(), wfGetSQL(), wfIgnoreSQLErrors(), wfIndexExists(), wfInitStats(), wfInsertArray(), wfInsertId(), wfLastDBquery(), wfLastErrno(), wfLastError(), wfNextSequenceValue(), wfNumFields(), wfNumRows(), wfQuery(), wfSetSQL(), wfSingleQuery(), wfSpecialFileDuplicateSearch(), wfSpecialNewimages(), wfSpecialWatchlist(), wfStrencode(), wfTableName(), wfUpdateArray(), wfUseIndexClause(), User::whoIs(), User::whoIsReal(), and wlCountItems().

wfGetHTTP ( url,
timeout = 'default' 
)

Alias for modularized function.

Deprecated:
Use Http::get() instead

Definition at line 2622 of file GlobalFunctions.php.

References $url, Http::get(), and wfDeprecated().

wfGetLangObj ( langcode = false  ) 

Return a Language object from $langcode.

Parameters:
$langcode Mixed: either:
  • a Language object
  • code of the language to get the message for, if it is a valid code create a language for that language, if it is a string but not a valid code then make a basic language object
  • a boolean: if it's false then use the current users language (as a fallback for the old parameter functionality), or if it is true then use the wikis
Returns:
Language object

Definition at line 425 of file GlobalFunctions.php.

References $wgContLang, $wgLang, Language::factory(), Language::getLanguageNames(), is(), and wfDebug().

Referenced by MessageCache::get(), EditPage::getPreviewText(), wfMsgExt(), and wfMsgGetKey().

wfGetLB ( wiki = false  ) 

Get a load balancer object.

Parameters:
array $groups List of query groups
string $wiki Wiki ID, or false for the current wiki
Returns:
LoadBalancer

Definition at line 2802 of file GlobalFunctions.php.

References wfGetLBFactory().

Referenced by ApiQuerySiteinfo::appendDbReplLagInfo(), MediaWiki::checkMaxLag(), ApiMain::executeAction(), Revision::getTimestampFromId(), lastModified(), Revision::loadText(), Revision::newFromConds(), Revision::newFromTitle(), ParserTest::setupDatabase(), wfAbruptExit(), wfGetDB(), and wfWaitForSlaves().

& wfGetLBFactory (  ) 

& wfGetMimeMagic (  ) 

BC wrapper for MimeMagic::singleton().

Deprecated:

Definition at line 1966 of file GlobalFunctions.php.

References MimeMagic::singleton().

wfGetNamespaceNotice (  ) 

Definition at line 1913 of file GlobalFunctions.php.

References $fname, $key, $wgTitle, wfGetCachedNotice(), wfProfileIn(), and wfProfileOut().

wfGetNull (  ) 

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

/dev/null

Returns:
string

Definition at line 2922 of file GlobalFunctions.php.

References wfIsWindows().

Referenced by Dump7ZipOutput::Dump7ZipOutput(), and MWTidy::execExternalTidy().

wfGetPrecompiledData ( name  ) 

Get an object from the precompiled serialized directory.

Returns:
mixed The variable on success, false on failure

Definition at line 2690 of file GlobalFunctions.php.

References $blob, $file, and $IP.

Referenced by Language::getCaseMaps(), and Language::loadLocalisation().

wfGetSiteNotice (  ) 

wfHostname (  ) 

Fetch server name for use in error reporting etc.

Use real server name if available, so we know which machine in a server farm generated the current page.

Returns:
string

Definition at line 833 of file GlobalFunctions.php.

References $_SERVER.

Referenced by DifferenceEngine::debug(), DjVuHandler::doTransform(), BitmapHandler::doTransform(), Profiler::logToDB(), RecompressTracked::logToFile(), DatabaseMssql::open(), Database::open(), LoadBalancer::openForeignConnection(), SvgHandler::rasterize(), wfDebugLog(), wfReportTime(), and wfThumbError().

wfHttpError ( code,
label,
desc 
)

wfHttpOnlySafe (  ) 

Definition at line 2636 of file GlobalFunctions.php.

References $_SERVER, and $wgHttpOnlyBlacklist.

Referenced by WebResponse::setcookie(), and wfSetupSession().

wfIncrStats ( key  ) 

wfIniGetBool ( setting  ) 

Safety wrapper around ini_get() for boolean settings.

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

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

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

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

I frickin' hate PHP... :P

Parameters:
string $setting
Returns:
bool

Definition at line 2153 of file GlobalFunctions.php.

Referenced by UploadForm::execute(), mw_have_dl(), wfInitShellLocale(), and wfShellExec().

wfInitShellLocale (  ) 

Workaround for http://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale.

Definition at line 2229 of file GlobalFunctions.php.

References $wgShellLocale, and wfIniGetBool().

Referenced by wfEscapeShellArg(), and wfShellExec().

wfIsLocalURL ( url  ) 

Alias for modularized function.

Deprecated:
Use Http::isLocalURL() instead

Definition at line 2631 of file GlobalFunctions.php.

References $url, Http::isLocalURL(), and wfDeprecated().

wfIsWindows (  ) 

wfLoadExtensionMessages ( extensionName,
langcode = false 
)

Load an extension messages file.

Parameters:
string $extensionName Name of extension to load messages from.
string $langcode Language to load messages for, or false for default behvaiour (en, content language and user language).
Since:
r24808 (v1.11) Using this method of loading extension messages will not work on MediaWiki prior to that

Definition at line 2885 of file GlobalFunctions.php.

References $wgContLang, $wgExtensionMessagesFiles, $wgLang, and $wgMessageCache.

Referenced by MessageCache::loadAllMessages().

wfLocalFile ( title  ) 

wfLogDBError ( text  ) 

Log for database errors.

Parameters:
$text String: database error message.

Definition at line 292 of file GlobalFunctions.php.

References $text, $wgDBerrorLog, $wgDBname, and wfErrorLog().

Referenced by DatabaseMssql::open(), Database::open(), Database::query(), LoadBalancer::reportConnectionError(), and Database::reportQueryError().

wfLogProfilingData (  ) 

wfMakeUrlIndex ( url  ) 

Make a URL index, appropriate for the el_index field of externallinks.

Definition at line 2443 of file GlobalFunctions.php.

References $url, and wfParseUrl().

Referenced by LinksUpdate::getExternalInsertions().

wfMaxlagError ( host,
lag,
maxLag 
)

Displays a maxlag error.

Parameters:
string $host Server that lags the most
int $lag Maxlag (actual)
int $maxLag Maxlag (requested)

Definition at line 2935 of file GlobalFunctions.php.

References $maxLag, and $wgShowHostnames.

Referenced by MediaWiki::checkMaxLag().

wfMemcKey (  ) 

wfMerge ( old,
mine,
yours,
&$  result 
)

wfMerge attempts to merge differences between three texts.

Returns true for a clean merge and false for failure or a conflict.

Definition at line 1331 of file GlobalFunctions.php.

References $cmd, $result, $wgDiff3, wfDebug(), wfEscapeShellArg(), and wfTempDir().

Referenced by Article::getUndoText(), and EditPage::mergeChangesInto().

wfMergeErrorArrays (  ) 

Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.

wfMergeErrorArrays( array( array( 'x' ) ), array( array( 'x', '2' ) ), array( array( 'x' ) ), array( array( 'y') ) ); returns: array( array( 'x', '2' ), array( 'x' ), array( 'y' ) )

Definition at line 2391 of file GlobalFunctions.php.

References $args, $out, and $spec.

Referenced by Title::isValidMoveOperation().

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

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

Parameters:
string $dir Full path to directory to create
int $mode Chmod value to use, default is $wgDirectoryMode
string $caller Optional caller param for debugging.
Returns:
bool

Definition at line 1999 of file GlobalFunctions.php.

References $mode, $wgDirectoryMode, and wfDebug().

Referenced by DatabaseSqlite::__construct(), MathRenderer::_recall(), HTMLFileCache::checkCacheDirs(), FileStore::copyFile(), FSRepo::deleteBatch(), SvgHandler::doTransform(), DjVuHandler::doTransform(), BitmapHandler::doTransform(), ForeignAPIRepo::getThumbUrlFromCache(), RevisionDeleter::makeOldImagePublic(), ImageCleanup::pokeFile(), FSRepo::publishBatch(), MathRenderer::render(), MakeMessagesDB::run(), MessageCache::saveToLocal(), MessageCache::saveToScript(), ParserTest::setupUploadDir(), and FSRepo::storeBatch().

wfMsg ( key  ) 

Get a message from anywhere, for the current user language.

Use wfMsgForContent() instead if the message should NOT change depending on the user preferences.

Parameters:
$key String: lookup key for the message, usually defined in languages/Language.php
This function also takes extra optional parameters (not shown in the function definition), which can by used to insert variable text into the predefined message.

Definition at line 466 of file GlobalFunctions.php.

References $args, $key, and wfMsgReal().

Referenced by TransformParameterError::__construct(), ErrorPageError::__construct(), MathRenderer::_error(), LogPage::actionText(), MediaHandler::addMeta(), LoginForm::addNewAccountInternal(), LoginForm::addNewAccountMailPassword(), OutputPage::addReturnTo(), Article::addTrackbacks(), SkinMonoBookCBT::anonlogin(), SkinMonoBookCBT::anontalk(), SpecialRevisionDelete::archivedfileLine(), SpecialResetpass::attemptReset(), RdfMetaData::basics(), PageHistory::beginHistoryList(), ImageHistoryList::beginImageHistoryList(), OutputPage::blockedPage(), SpecialRevisionDelete::buildCheckBoxes(), ProtectionForm::buildCleanupScript(), SkinTemplate::buildContentActionUrls(), ProtectionForm::buildForm(), SkinTemplate::buildNavUrls(), SkinTemplate::buildPersonalUrls(), Linker::buildRollbackLink(), ChangeTags::buildTagFilterSelector(), SpecialRecentChanges::categoryFilterForm(), cleanupArticle(), commentLink(), EmailNotification::composeCommonMailtext(), Article::confirmDelete(), SpecialContributions::contributionsSub(), copyrightLink(), UploadForm::curlCopy(), MonoBookTemplate::customBox(), ModernTemplate::customBox(), Xml::dateMenu(), CoreParserFunctions::defaultsort(), Article::delete(), deleteThisPage(), UploadForm::detectVirus(), LoginForm::displaySuccessfulLogin(), SkinCologneBlue::doAfterContent(), SkinCologneBlue::doBeforeContent(), Article::doDelete(), Linker::doEditSectionLink(), SpecialRecentChanges::doHeader(), SpecialRecentchangeslinked::doMainQuery(), LinkSearchPage::doQuery(), DBUnlockForm::doSubmit(), MovePageForm::doSubmit(), DBLockForm::doSubmit(), EmailUserForm::doSubmit(), SpecialTags::doTagRow(), SvgHandler::doTransform(), DjVuHandler::doTransform(), EnhancedChangesList::downArrow(), editThisPage(), emailUserLink(), PageHistory::endHistoryList(), WatchlistEditor::execute(), WhatLinksHerePage::execute(), UndeleteForm::execute(), SpecialTags::execute(), SpecialResetpass::execute(), SpecialPrefixindex::execute(), PreferencesForm::execute(), SpecialListGroupRights::execute(), FilepathForm::execute(), SpecialExport::execute(), DeletedContributionsPage::execute(), SpecialContributions::execute(), SpecialAllpages::execute(), FileDeleteForm::execute(), ApiQueryAllmessages::execute(), RestrictUserForm::existingRestrictions(), SpecialVersion::extensionCredits(), SkinMonoBookCBT::fallbackmsg(), Article::fetchContent(), Parser::fetchScaryTemplateMaybeFromCache(), OutputPage::fileCopyError(), OutputPage::fileDeleteError(), SpecialRevisionDelete::fileLine(), OutputPage::fileNotFoundError(), OutputPage::fileRenameError(), SpecialNewpages::form(), LogPage::formatBlockFlag(), SpecialVersion::formatCredits(), FeedUtils::formatDiffRow(), UndeleteForm::formatFileRow(), OutputPage::formatPermissionsErrorMessage(), UserRestrictionsPager::formatRestriction(), WantedPagesPage::formatResult(), FewestrevisionsPage::formatResult(), DoubleRedirectsPage::formatResult(), ProtectedTitlesForm::formatRow(), ProtectedPagesForm::formatRow(), IPUnblockForm::formatRow(), Linker::formatTemplates(), Language::formatTimePeriod(), ImageListPager::formatValue(), SpecialSearch::formHeader(), Credits::getAuthor(), User::getBlockedStatus(), ProtectedPagesForm::getCascadeCheck(), EditPage::getCheckboxes(), Credits::getContributors(), SpecialPage::getDescription(), ImageHandler::getDimensionsString(), FileRepo::getDisplayName(), EditPage::getEditButtons(), EditPage::getEditToolbar(), ProtectedPagesForm::getExpiryCheck(), SpecialRecentchangeslinked::getExtraOptions(), ImageListPager::getFieldNames(), WhatLinksHerePage::getFilterPanel(), ImageListPager::getForm(), DeletedContributionsPage::getForm(), SpecialContributions::getForm(), FormatExif::getFormattedData(), SpecialPage::getGroup(), User::getGroupMember(), User::getGroupName(), SpecialStatistics::getGroupStats(), OutputPage::getHeadLinks(), SpecialListUserRestrictionsForm::getHTML(), CategoryViewer::getImageSection(), UploadForm::getInitialPageText(), ProtectedTitlesForm::getLevelMenu(), ProtectedPagesForm::getLevelMenu(), ProtectedTitlesForm::getNamespaceMenu(), ProtectedPagesForm::getNamespaceMenu(), ProtectionForm::getOptionLabel(), WithoutInterwikiPage::getPageHeader(), UsersPager::getPageHeader(), CategoryViewer::getPagesSection(), MWException::getPageTitle(), EditPage::getPreviewText(), User::getRightDescription(), ProtectedPagesForm::getSizeLimit(), TablePager::getStartBody(), CategoryPager::getStartForm(), CategoryViewer::getSubcategorySection(), DeletedContributionsPage::getSubTitle(), DBQueryError::getText(), LogEventsList::getTitleInput(), LogEventsList::getTitlePattern(), ProtectedPagesForm::getTypeMenu(), getUndeleteLink(), LogEventsList::getUserInput(), Title::getUserPermissionsErrors(), Title::getUserPermissionsErrorsInternal(), UserrightsPage::groupCheckboxes(), OutputPage::headElement(), PageHistory::history(), PageHistory::historyLine(), historyLink(), ImagePage::imageDupes(), ImageHistoryList::imageHistoryLine(), Article::info(), ChangesList::insertMove(), Parser::interwikiTransclude(), IPBlockForm::IPBlockForm(), Xml::languageSelector(), lastModified(), Linker::linkAttribs(), DifferenceEngine::loadRevisionData(), SkinMonoBookCBT::login(), OutputPage::loginToUse(), LogPage::logName(), logoText(), SkinMonoBookCBT::logout(), Parser::magicLinkCallback(), LoginForm::mailPassword(), LoginForm::mailPasswordInternal(), LoginForm::mainLoginForm(), mainPageLink(), PreferencesForm::mainPrefsForm(), UploadForm::mainUploadForm(), PatrolLog::makeActionText(), SpecialBookSources::makeForm(), Skin::makeGlobalVariablesScript(), ImagePage::makeMetadataTable(), SpecialSearch::makeSearchLink(), Linker::makeThumbLink2(), Article::markpatrolled(), SpecialVersion::MediaWikiCredits(), SkinCologneBlue::menuHead(), Xml::monthSelector(), moveThisPage(), SkinMonoBookCBT::msg(), Licenses::msg(), FormatExif::msg(), SkinMonoBookCBT::mycontris(), SkinMonoBookCBT::mytalk(), nameAndLogin(), SpecialRecentChanges::namespaceFilterForm(), SpecialAllpages::namespaceForm(), SpecialPrefixindex::namespacePrefixForm(), RestrictUserForm::namespaceRestrictionForm(), SearchEngine::namespacesAsText(), PreferencesForm::namespacesCheckboxes(), Xml::namespaceSelector(), SpecialSearch::namespaceTables(), SkinMonoBookCBT::newtalk(), EditPage::noCreatePermission(), EditPage::noSuchSectionPage(), SkinMonoBookCBT::numberofwatchingusers(), LoginForm::onCookieRedirectCheck(), ImagePage::openShowImage(), SpecialRecentChanges::optionsPanel(), otherLanguages(), OutputPage::output(), SkinTemplate::outputPage(), RestrictUserForm::pageRestrictionForm(), pageTitleLinks(), MediaWiki::performAction(), OutputPage::permissionRequired(), RdfMetaData::person(), SpecialSearchOld::powerSearchBox(), SpecialSearch::powerSearchBox(), SkinMonoBookCBT::preferences(), SpecialResetpass::pretty(), printableLink(), ImagePage::printSharedImageText(), printSource(), LoginForm::processLogin(), protectThisPage(), SkinStandard::quickBar(), SkinCologneBlue::quickBar(), OutputPage::rateLimited(), OutputPage::readOnlyPage(), EnhancedChangesList::recentChangesBlockGroup(), EnhancedChangesList::recentChangesLine(), Article::rollback(), ProtectionForm::save(), PreferencesForm::savePreferences(), SkinCologneBlue::searchForm(), IPUnblockForm::searchForm(), searchForm(), RestrictUserForm::selectUserForm(), User::sendConfirmationMail(), FileRevertForm::setHeaders(), FileDeleteForm::setHeaders(), EditPage::setHeaders(), Article::setOldSubtitle(), OutputPage::setPageTitle(), User::setPassword(), SpecialRecentchangeslinked::setTopText(), RdfMetaData::setup(), SpecialSearchOld::setupPage(), SpecialSearch::setupPage(), SpecialSearchOld::shortDialog(), SpecialSearch::shortDialog(), ProtectionForm::show(), DifferenceEngine::showDiffPage(), EditPage::showEditForm(), UserrightsPage::showEditUserGroupsForm(), UploadForm::showError(), ImagePage::showError(), OutputPage::showErrorPage(), OutputPage::showFatalError(), UndeleteForm::showFileConfirmationForm(), OutputPage::showFileCopyError(), OutputPage::showFileDeleteError(), OutputPage::showFileNotFoundError(), OutputPage::showFileRenameError(), DifferenceEngine::showFirstRevision(), DBUnlockForm::showForm(), SpecialResetpass::showForm(), MovePageForm::showForm(), DBLockForm::showForm(), IPUnblockForm::showForm(), SpecialImport::showForm(), EmailUserForm::showForm(), IPBlockForm::showForm(), FileRevertForm::showForm(), FileDeleteForm::showForm(), UndeleteForm::showHistory(), MergehistoryForm::showHistory(), SpecialSearchOld::showHit(), SpecialSearch::showHit(), SpecialRevisionDelete::showImages(), SpecialSearchOld::showInterwiki(), SpecialSearch::showInterwiki(), SpecialSearchOld::showInterwikiHit(), SpecialSearch::showInterwikiHit(), IPUnblockForm::showList(), SpecialRevisionDelete::showLogItems(), MergehistoryForm::showMergeForm(), WatchlistEditor::showNormalForm(), ProtectedTitlesForm::showOptions(), ProtectedPagesForm::showOptions(), LogEventsList::showOptions(), Credits::showPage(), OutputPage::showPermissionsErrorPage(), SpecialPrefixindex::showPrefixChunk(), WatchlistEditor::showRawForm(), EmailConfirmation::showRequestForm(), SpecialSearchOld::showResults(), SpecialSearch::showResults(), UndeleteForm::showRevision(), SpecialRevisionDelete::showRevs(), UndeleteForm::showSearchForm(), DBUnlockForm::showSuccess(), DBLockForm::showSuccess(), EmailUserForm::showSuccess(), IPBlockForm::showSuccess(), OutputPage::showUnexpectedValueError(), EnhancedChangesList::sideArrow(), SkinMonoBookCBT::sidebar(), SpecialVersion::softwareInformation(), EditPage::spamPage(), Linker::specialLink(), specialPagesList(), SpecialRevisionDelete::success(), UserrightsPage::switchForm(), SkinCologneBlue::sysLinks(), SkinTemplate::tabAction(), CoreParserFunctions::tagObj(), talkLink(), Linker::tocList(), trackbackLink(), MediaWiki_I18N::translate(), SpecialListUserRestrictionsForm::typeSelector(), UndeleteForm::undelete(), OutputPage::unexpectedValueError(), Article::unwatch(), ImagePage::uploadLinksBox(), UploadForm::uploadWarning(), LoginForm::userBlockedMessage(), userContribsLink(), EditPage::userNotLoggedInPage(), LoginForm::userNotPrivilegedMessage(), OutputPage::versionRequired(), ImagePage::view(), SkinMonoBookCBT::viewcount(), Article::watch(), SkinMonoBookCBT::watchlist(), watchPageLinksLink(), watchThisPage(), wfAllMessagesMakeHTMLText(), wfSpecialAllmessages(), wfSpecialBlockme(), wfSpecialEmailuser(), wfSpecialFileDuplicateSearch(), wfSpecialIpblocklist(), wfSpecialLinkSearch(), wfSpecialMIMEsearch(), wfSpecialNewimages(), wfSpecialWatchlist(), wfThumbMain(), wfViewPrevNext(), SpecialVersion::wgHooks(), whatLinksHere(), and WhatLinksHerePage::whatlinkshereForm().

wfMsgExt ( key,
options 
)

Returns message in the requested format.

Parameters:
string $key Key of the message
array $options Processing rules. Can take the following options: parse: parses wikitext to html parseinline: parses wikitext to html and removes the surrounding p's added by parser or tidy escape: filters message through htmlspecialchars escapenoentities: same, but allows entity references like   through replaceafter: parameters are substituted after parsing or escaping parsemag: transform the message using magic phrases content: fetch message for content language instead of interface Also can accept a single associative argument, of the form 'language' => 'xx': language: Language object or language code to fetch message for (overriden by content), its behaviour with parser, parseinline and parsemag is undefined. Behavior for conflicting options (e.g., parse+parseinline) is undefined.

Definition at line 700 of file GlobalFunctions.php.

References $args, $key, $options, $wgMessageCache, $wgOut, Sanitizer::escapeHtmlAllowEntities(), wfGetLangObj(), wfMsgGetKey(), and wfMsgReplaceArgs().

Referenced by DeletedContribsPager::__construct(), ContribsPager::__construct(), AnchorToString::addAttributes(), TagToString::addAttributes(), LoginForm::addNewAccountInternal(), OutputPage::addWikiMsgArray(), SpecialRevisionDelete::archivedfileLine(), PageHistory::beginHistoryList(), bottomLinks(), SkinTemplate::buildContentActionUrls(), buildSidebar(), ChangeTags::buildTagFilterSelector(), Language::commaList(), Article::confirmDelete(), Article::delete(), Article::doDelete(), MovePageForm::doSubmit(), EmailUserForm::doSubmit(), SpecialTags::doTagRow(), WatchlistEditor::execute(), SpecialTags::execute(), SpecialStatistics::execute(), MergehistoryForm::execute(), SpecialExport::execute(), DeletedContributionsPage::execute(), SpecialContributions::execute(), FileRevertForm::execute(), extensionTabLinks(), SpecialNewpages::feed(), SpecialContributions::feed(), QueryPage::feedDesc(), Article::fetchContent(), SpecialRevisionDelete::fileLine(), footerLink(), Linker::formatAutocommentsCallback(), Linker::formatHiddenCategories(), SpecialListGroupRights::formatPermissions(), WantedCategoriesPage::formatResult(), ShortPagesPage::formatResult(), PopularPagesPage::formatResult(), MostrevisionsPage::formatResult(), MostlinkedCategoriesPage::formatResult(), MostlinkedPage::formatResult(), MostcategoriesPage::formatResult(), MIMEsearchPage::formatResult(), FewestrevisionsPage::formatResult(), Linker::formatRevisionSize(), SpecialStatistics::formatRow(), SpecialNewpages::formatRow(), UsersPager::formatRow(), CategoryPager::formatRow(), Linker::formatTemplates(), NoContentTagToString::getAddedDescription(), TagToString::getAddedDescription(), getCategoryLinks(), MostimagesPage::getCellHtml(), EditPage::getCheckboxes(), Article::getContent(), IPBlockForm::getContribsLink(), Credits::getContributors(), CategoryViewer::getCountMessage(), ImageHandler::getDimensionsString(), UploadForm::getDupeWarning(), SpecialStatistics::getEditStats(), UploadForm::getExistsWarning(), DeletedContributionsPage::getForm(), SpecialContributions::getForm(), MediaHandler::getGeneralLongDesc(), MediaHandler::getGeneralShortDesc(), CategoryViewer::getHTML(), RevisionDeleter::getLogMessage(), SvgHandler::getLongDesc(), ImageHandler::getLongDesc(), MediaHandler::getLongDesc(), Language::getMessageFromDB(), SpecialStatistics::getMostViewedPages(), DifferenceEngine::getMultiNotice(), DeletedContribsPager::getNavigationBar(), ReverseChronologicalPager::getNavigationBar(), AlphabeticPager::getNavigationBar(), UnusedtemplatesPage::getPageHeader(), UnusedimagesPage::getPageHeader(), UnusedCategoriesPage::getPageHeader(), LonelyPagesPage::getPageHeader(), DoubleRedirectsPage::getPageHeader(), DisambiguationsPage::getPageHeader(), DeadendPagesPage::getPageHeader(), BrokenRedirectsPage::getPageHeader(), SpecialStatistics::getPageStats(), WhatLinksHerePage::getPrevNext(), NoContentTagToString::getRemovedDescription(), TagToString::getRemovedDescription(), ImageHandler::getShortDesc(), MediaHandler::getShortDesc(), getUndeleteLink(), Parser::getUserSig(), SpecialStatistics::getUserStats(), SpecialStatistics::getViewsStats(), SpecialSearchOld::goResult(), Article::info(), UploadForm::internalProcessUpload(), Parser::limitationWarn(), WhatLinksHerePage::listItem(), DifferenceEngine::localiseLineNumbersCb(), LogPage::logHeader(), LoginForm::mailPassword(), LoginForm::mailPasswordInternal(), PreferencesForm::mainPrefsForm(), UploadForm::mainUploadForm(), WantedTemplatesPage::makeWlhLink(), WantedPagesPage::makeWlhLink(), WantedFilesPage::makeWlhLink(), SpecialMostlinkedtemplates::makeWlhLink(), MergehistoryForm::merge(), Title::moveToNewTitle(), RestrictUserForm::namespaceRestrictionForm(), ChangesList::numberofWatchingusers(), LoginForm::onCookieRedirectCheck(), ImagePage::openShowImage(), SpecialRecentChanges::optionsPanel(), otherLanguages(), SkinTemplate::outputPage(), pageStats(), pageSubtitle(), CategoryViewer::pagingLinks(), RdfMetaData::person(), Language::pipeList(), SpecialSearchOld::powerSearchBox(), SpecialSearch::powerSearchBox(), MergehistoryForm::preCacheMessages(), PageHistory::preCacheMessages(), LogEventsList::preCacheMessages(), ChangesList::preCacheMessages(), FileDeleteForm::prepareMessage(), ImagePage::printSharedImageText(), UploadForm::processUpload(), Article::purge(), EnhancedChangesList::recentChangesBlockGroup(), OldChangesList::recentChangesLine(), ImportReporter::reportPage(), Article::rollback(), PreferencesForm::savePreferences(), Language::semicolonList(), Article::setOldSubtitle(), User::setPassword(), SpecialSearch::shortDialog(), ChangesList::showCharacterDifference(), SpecialAllpages::showChunk(), EditPage::showDiff(), DifferenceEngine::showDiffPage(), EditPage::showEditForm(), UserrightsPage::showEditUserGroupsForm(), DifferenceEngine::showFirstRevision(), SpecialResetpass::showForm(), MovePageForm::showForm(), SpecialImport::showForm(), EmailUserForm::showForm(), FileRevertForm::showForm(), MergehistoryForm::showHistory(), SpecialSearchOld::showHit(), SpecialSearch::showHit(), WatchlistEditor::showItemCount(), OutputPage::showLagWarning(), UndeleteForm::showList(), WatchlistEditor::showNormalForm(), SpecialPrefixindex::showPrefixChunk(), WatchlistEditor::showRawForm(), SpecialSearchOld::showResults(), SpecialSearch::showResults(), IPBlockForm::showSuccess(), subPageSubtitle(), ChangeTags::tagDescription(), LoginForm::throttleHit(), ImageGallery::toHTML(), topLinks(), TagToString::translateArgument(), Language::truncate(), PageArchive::undelete(), ImagePage::uploadLinksBox(), Credits::userLink(), Article::view(), wfNumLink(), wfShowingResults(), wfShowingResultsNum(), wfSpecialCategories(), wfSpecialFileDuplicateSearch(), wfSpecialNewimages(), wfSpecialRemoveRestrictions(), wfSpecialUserlogout(), wfSpecialWatchlist(), wfViewPrevNext(), wlCutoffLinks(), and OutputPage::wrapWikiMsg().

wfMsgForContent ( key  ) 

Get a message from anywhere, for the current global language set with $wgLanguageCode.

Use this if the message should NOT change dependent on the language set in the user's preferences. This is the case for most text written into logs, as well as link targets (such as the name of the copyright policy page). Link titles, on the other hand, should be shown in the UI language.

Note that MediaWiki allows users to change the user interface language in their preferences, but a single installation typically only contains content in one language.

Be wary of this distinction: If you use wfMsg() where you should use wfMsgForContent(), a user of the software may have to customize over 70 messages in order to, e.g., fix a link in every possible language.

Parameters:
$key String: lookup key for the message, usually defined in languages/Language.php

Definition at line 503 of file GlobalFunctions.php.

References $args, $key, $wgForceUIMsgAsContentMsg, and wfMsgReal().

Referenced by Licenses::__construct(), LogPage::actionText(), User::addNewUserLogEntry(), ApiQuerySiteinfo::appendGeneralInfo(), Parser::braceSubstitution(), ProtectionForm::buildForm(), buildSidebar(), Article::commitRollback(), EmailNotification::composeCommonMailtext(), Article::confirmDelete(), copyrightLink(), Article::delete(), Block::doAutoblock(), FileDeleteForm::doDelete(), Parser::doDoubleUnderscore(), MovePageForm::doSubmit(), EditPage::edit(), SpecialListGroupRights::execute(), FileDeleteForm::execute(), ApiFeedWatchlist::execute(), ApiEditPage::execute(), PageHistory::feed(), PageHistory::feedEmpty(), PageHistory::feedItem(), SpecialNewpages::feedItemDesc(), SpecialContributions::feedItemDesc(), footerLink(), Linker::formatAutocommentsCallback(), LogPage::formatBlockFlag(), FeedUtils::formatDiffRow(), Article::generateReason(), Skin::generateUserJs(), Article::getAutosummary(), getCategoryLinks(), RevisionDeleter::getChanges(), EditPage::getContent(), getCopyright(), SpecialRecentchangeslinked::getFeedObject(), SpecialRecentChanges::getFeedObject(), UploadForm::getFilenamePrefixBlacklist(), User::getGroupPage(), SpecialStatistics::getGroupStats(), UploadForm::getInitialPageText(), RevisionDeleter::getLogMessage(), LogPage::getRcComment(), DisambiguationsPage::getSQL(), DoubleRedirectJob::getUser(), Skin::initPage(), Article::insertNewArticle(), EditPage::internalAttemptSave(), User::isUsableName(), Parser::limitationWarn(), LogEventsList::logLine(), PatrolLog::makeActionText(), UserrightsPage::makeGroupNameList(), makeI18nUrl(), LoginForm::makeLanguageSelector(), Parser::maybeMakeExternalImage(), MergehistoryForm::merge(), Title::moveOverExistingRedirect(), Title::moveTo(), Title::moveToNewTitle(), nameAndLogin(), Title::newMainPage(), Parser::pstPass2(), SkinCologneBlue::quickBar(), Parser::replaceInternalLinks2(), SearchEngine::replacePrefixes(), Article::replaceSection(), ImportReporter::reportPage(), DoubleRedirectJob::run(), ProtectionForm::save(), EmailNotification::sendImpersonal(), EditPage::showEditForm(), FileRevertForm::showForm(), FileDeleteForm::showForm(), SpecialSearchOld::showHit(), SpecialSearch::showHit(), SpecialBookSources::showList(), SkinMonoBookCBT::sidebar(), CoreParserFunctions::special(), SkinCologneBlue::sysLinks(), Article::updateRestrictions(), Title::updateTitleProtection(), SkinMonoBookCBT::usehistorycopyright(), Article::view(), and BitmapHandler::visibleMetadataFields().

wfMsgForContentNoTrans ( key  ) 

wfMsgGetKey ( key,
useDB,
langCode = false,
transform = true 
)

Fetch a message string value, but don't replace any keys yet.

Parameters:
string $key
bool $useDB
string $langcode Code of the language to get the message for, or behaves as a content language switch if it is a boolean.
Returns:
string
Access:
private

Definition at line 591 of file GlobalFunctions.php.

References $key, $wgContLang, $wgMessageCache, wfGetLangObj(), and wfRunHooks().

Referenced by MediaTransformError::__construct(), EditPage::getContent(), Article::getContent(), CoreParserFunctions::intFunction(), wfMsgExt(), wfMsgHtml(), wfMsgReal(), wfMsgWeirdKey(), and wfMsgWikiHtml().

wfMsgHtml ( key  ) 

Return an HTML-escaped version of a message.

Parameter replacements, if any, are done *after* the HTML-escaping, so parameters may contain HTML (eg links or form controls). Be sure to pre-escape them if you really do want plaintext, or just wrap the whole thing in htmlspecialchars().

Parameters:
string $key
string ... parameters
Returns:
string

Definition at line 658 of file GlobalFunctions.php.

References $args, $key, wfMsgGetKey(), and wfMsgReplaceArgs().

Referenced by LoginForm::addNewAccount(), SpecialRevisionDelete::archivedfileLine(), ImageHistoryList::beginImageHistoryList(), Linker::blockLink(), ProtectionForm::buildForm(), WatchlistEditor::buildRemoveLine(), Linker::buildRollbackLink(), WatchlistEditor::buildTools(), CategoryViewer::columnList(), Article::confirmDelete(), SpecialContributions::contributionsSub(), UndeleteForm::diffHeader(), Linker::doEditSectionLink(), WikiImporter::doImport(), QueryPage::doQuery(), MovePageForm::doSubmit(), UndeleteForm::execute(), SpecialRevisionDelete::execute(), MergehistoryForm::execute(), SpecialListGroupRights::execute(), SpecialContributions::execute(), EmailConfirmation::execute(), SpecialRevisionDelete::fileComment(), SpecialRevisionDelete::fileLine(), SpecialRevisionDelete::fileUserTools(), SpecialNewpages::filterLinks(), FeedUtils::formatDiff(), Block::formatExpiry(), UndeleteForm::formatFileRow(), UserRestrictionsPager::formatRestriction(), UnwatchedpagesPage::formatResult(), UnusedtemplatesPage::formatResult(), ShortPagesPage::formatResult(), MIMEsearchPage::formatResult(), LinkSearchPage::formatResult(), DisambiguationsPage::formatResult(), BrokenRedirectsPage::formatResult(), UndeleteForm::formatRevisionRow(), ProtectedTitlesForm::formatRow(), ProtectedPagesForm::formatRow(), SpecialNewpages::formatRow(), UsersPager::formatRow(), IPUnblockForm::formatRow(), DeletedContribsPager::formatRow(), ContribsPager::formatRow(), ChangesFeed::generateFeed(), IPBlockForm::getBlockListLink(), IPBlockForm::getConvenienceLinks(), TablePager::getEmptyBody(), UploadForm::getExistsWarning(), UndeleteForm::getFileComment(), UndeleteForm::getFileUser(), LogEventsList::getFilterLinks(), WhatLinksHerePage::getFilterPanel(), ImageListPager::getForm(), SpecialStatistics::getGroupStats(), SpecialListUserRestrictionsForm::getHTML(), EditPage::getLastDelete(), TablePager::getLimitForm(), WikiXmlError::getMessage(), WatchlistEditor::getNamespaceHeading(), DeletedContribsPager::getNavigationBar(), TablePager::getNavigationBar(), ReverseChronologicalPager::getNavigationBar(), AlphabeticPager::getNavigationBar(), WhatLinksHerePage::getPrevNext(), ImageHandler::getShortDesc(), DeletedContributionsPage::getSubTitle(), IPBlockForm::getUnblockLink(), UserrightsPage::groupCheckboxes(), PageHistory::history(), SpecialRevisionDelete::historyLine(), PageHistory::historyLine(), ImageHistoryList::imageHistoryLine(), Article::info(), ChangesList::insertAction(), ChangesList::insertComment(), ChangesList::insertUserRelatedLinks(), UploadForm::internalProcessUpload(), DifferenceEngine::loadRevisionData(), OutputPage::loginToUse(), SpecialRevisionDelete::logLine(), LogEventsList::logLine(), LoginForm::mainLoginForm(), PreferencesForm::mainPrefsForm(), UploadForm::mainUploadForm(), PatrolLog::makeActionText(), SpecialBookSources::makeForm(), LoginForm::makeLanguageSelector(), SkinMonoBookCBT::newtalk(), ImagePage::openShowImage(), SpecialRecentChanges::optionsPanel(), Credits::othersLink(), SkinTemplate::outputPage(), pageTitleLinks(), printableLink(), UploadForm::processUpload(), EnhancedChangesList::recentChangesBlockGroup(), EnhancedChangesList::recentChangesBlockLine(), EnhancedChangesList::recentChangesLine(), OldChangesList::recentChangesLine(), DifferenceEngine::renderHtmlDiff(), DifferenceEngine::renderNewRevision(), ImportReporter::reportPage(), Linker::revComment(), Linker::revUserLink(), Linker::revUserTools(), IPUnblockForm::searchForm(), Article::setOldSubtitle(), ProtectionForm::show(), SpecialAllpages::showChunk(), EditPage::showDeletionLog(), Article::showDeletionLog(), DifferenceEngine::showDiffPage(), UserrightsPage::showEditUserGroupsForm(), DifferenceEngine::showFirstRevision(), MovePageForm::showForm(), IPUnblockForm::showForm(), IPBlockForm::showForm(), FileRevertForm::showForm(), FileDeleteForm::showForm(), UndeleteForm::showHistory(), MergehistoryForm::showHistory(), SpecialAllpages::showline(), ProtectedTitlesForm::showList(), ProtectedPagesForm::showList(), IPBlockForm::showLogFragment(), WatchlistEditor::showNormalForm(), SpecialPrefixindex::showPrefixChunk(), WatchlistEditor::showRawForm(), UndeleteForm::showRevision(), WatchlistEditor::showTitles(), ImagePage::showTOC(), SpecialAllpages::showToplevel(), Linker::tocList(), ImageGallery::toHTML(), SkinNostalgia::topLinks(), UndeleteForm::undelete(), UploadForm::uploadError(), ImagePage::uploadLinksBox(), UploadForm::uploadWarning(), EditPage::userNotLoggedInPage(), Linker::userTalkLink(), Linker::userToolLinks(), Article::view(), Article::viewRedirect(), wfAllMessagesMakeHTMLText(), wfSpecialFileDuplicateSearch(), wfSpecialNewimages(), wfSpecialRemoveRestrictions(), wfSpecialRestrictUser(), wfSpecialWatchlist(), wfThumbMain(), wfViewPrevNext(), and wlDaysLink().

wfMsgNoDB ( key  ) 

Get a message from the language file, for the UI elements.

Definition at line 531 of file GlobalFunctions.php.

References $args, $key, and wfMsgReal().

Referenced by DBQueryError::getHTML(), and wfQuery().

wfMsgNoDBForContent ( key  ) 

Get a message from the language file, for the content.

Definition at line 540 of file GlobalFunctions.php.

References $args, $key, $wgForceUIMsgAsContentMsg, and wfMsgReal().

Referenced by LoadBalancer::getReaderIndex().

wfMsgNoTrans ( key  ) 

wfMsgReal ( key,
args,
useDB = true,
forContent = false,
transform = true 
)

Really get a message.

Parameters:
$key String: key to get.
$args 
$useDB Boolean
$transform Boolean: Whether or not to transform the message.
$forContent Boolean
Returns:
String: the requested message.

Definition at line 561 of file GlobalFunctions.php.

References $args, $key, wfMsgGetKey(), wfMsgReplaceArgs(), wfProfileIn(), and wfProfileOut().

Referenced by MediaTransformError::__construct(), LogPage::actionText(), IPUnblockForm::doSubmit(), Status::getItemXML(), Status::getWikiText(), MWException::msg(), IPBlockForm::showForm(), wfMsg(), wfMsgForContent(), wfMsgForContentNoTrans(), wfMsgNoDB(), wfMsgNoDBForContent(), wfMsgNoTrans(), wfSpecialAllmessages(), and WikiErrorMsg::WikiErrorMsg().

wfMsgReplaceArgs ( message,
args 
)

Replace message parameter keys on the given formatted output.

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

Definition at line 627 of file GlobalFunctions.php.

References $args, and $n.

Referenced by MediaTransformError::__construct(), Article::commitRollback(), Block::formatExpiry(), IPUnblockForm::formatRow(), CoreParserFunctions::intFunction(), ApiMain::makeHelpMsg(), MWException::msg(), ApiBase::parseMsg(), wfMsgExt(), wfMsgHtml(), wfMsgReal(), and wfMsgWikiHtml().

wfMsgWeirdKey ( key  ) 

This function provides the message source for messages to be edited which are *not* stored in the database.

Parameters:
$key String:

Definition at line 573 of file GlobalFunctions.php.

References $key, $source, wfEmptyMsg(), and wfMsgGetKey().

Referenced by addWiki(), Article::info(), and Title::isAlwaysKnown().

wfMsgWikiHtml ( key  ) 

Return an HTML version of message Parameter replacements, if any, are done *after* parsing the wiki-text message, so parameters may contain HTML (eg links or form controls).

Be sure to pre-escape them if you really do want plaintext, or just wrap the whole thing in htmlspecialchars().

Parameters:
string $key
string ... parameters
Returns:
string

Definition at line 675 of file GlobalFunctions.php.

References $args, $key, $wgOut, wfMsgGetKey(), and wfMsgReplaceArgs().

Referenced by LoginForm::addNewAccount(), EmailConfirmation::execute(), UploadForm::getExistsWarning(), OutputPage::loginToUse(), LoginForm::mailPassword(), UploadForm::mainUploadForm(), ImagePage::openShowImage(), ImagePage::printSharedImageText(), LoginForm::processLogin(), UploadForm::processUpload(), SpecialAllpages::showChunk(), EditPage::showEditForm(), UndeleteForm::showHistory(), SpecialPrefixindex::showPrefixChunk(), UndeleteForm::undelete(), EditPage::userNotLoggedInPage(), and wfSpecialWatchlist().

wfNegotiateType ( cprefs,
sprefs 
)

Returns the 'best' match between a client's requested internet media types and the server's list of available types.

Each list should be an associative array of type to preference (preference is a float between 0.0 and 1.0). Wildcards in the types are acceptable.

Parameters:
array $cprefs Client's acceptable type list
array $sprefs Server's offered types
Returns:
string
Todo:
FIXME: doesn't handle params like 'text/plain; charset=UTF-8' XXX: generalize to negotiate other stuff

Definition at line 1619 of file GlobalFunctions.php.

References $type, and mimeTypeMatch().

Referenced by RdfMetaData::setup(), and GlobalTest::testNegotiateType().

wfNumLink ( offset,
limit,
title,
query = '' 
)

Generate links for (20|50|100.

..) items-per-page links

Parameters:
$offset string
$limit int
$title Title
$query string, optional URL query parameter string

Definition at line 1042 of file GlobalFunctions.php.

References $s, $title, $wgLang, and wfMsgExt().

Referenced by wfViewPrevNext().

wfOut ( s  ) 

Output some plain text in command-line mode or in the installer (updaters.inc).

Do not use it in any other context, its behaviour is subject to change.

Definition at line 3011 of file GlobalFunctions.php.

References $s, and $wgCommandLineMode.

Referenced by add_field(), add_index(), add_table(), check_bin(), UserDupes::checkDupes(), convertLinks(), createTempTable(), do_active_users_init(), do_all_updates(), do_archive_user_index(), do_backlinking_indices_update(), do_category_population(), do_categorylinks_indices_update(), do_copy_newtalk_to_watchlist(), do_drop_img_type(), do_filearchive_indices_update(), do_image_index_update(), do_image_name_unique_update(), do_image_user_index(), do_index_update(), do_interwiki_update(), do_inverse_timestamp(), do_logging_timestamp_index(), do_namespace_size_on(), do_old_links_update(), do_oldimage_user_index(), do_page_random_update(), do_pagelinks_namespace(), do_pagelinks_update(), do_populate_parent_id(), do_postgres_updates(), do_rc_indices_update(), do_restrictions_update(), do_schema_restructuring(), do_stats_init(), do_templatelinks_update(), do_text_id(), do_unique_pl_tl_il(), do_user_groups_reformat(), do_user_groups_update(), do_user_unique_update(), do_user_update(), do_watchlist_null(), do_watchlist_update(), UserDupes::examine(), fix_ancient_imagelinks(), UserDupes::hasUniqueIndex(), index_has_field(), maybe_do_profiling_memory_update(), populate_rev_parent_id(), populateCategory(), purge_cache(), UserDupes::reassignEditsOn(), rename_table(), sqlite_initial_indexes(), UserDupes::trimAccount(), and wfInitStats().

wfParseUrl ( url  ) 

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

Differences:

1) Does not raise warnings on bad URLs (just returns false) 2) Handles protocols that don't use :// (e.g., mailto: and news:) correctly 3) Adds a "delimiter" element to the array, either '://' or ':' (see (2))

Parameters:
string $url A URL to parse
Returns:
array Bits of the URL in an associative array, per PHP docs

Definition at line 2413 of file GlobalFunctions.php.

References $url, $wgUrlProtocols, wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by Parser::getExternalLinkAttribs(), and wfMakeUrlIndex().

wfPercent ( nr,
acc = 2,
round = true 
)

Parameters:
mixed $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
Returns:
float

Definition at line 2048 of file GlobalFunctions.php.

Referenced by profile_point::display(), DeleteImageCache::main(), and TestRecorder::reportPercentage().

wfPurgeSquidServers ( urlArr  ) 

This is obsolete, use SquidUpdate::purge().

Deprecated:

Definition at line 1271 of file GlobalFunctions.php.

References SquidUpdate::purge().

wfQueriesMustScale (  ) 

Should low-performance queries be disabled?

Returns:
bool

Definition at line 2845 of file GlobalFunctions.php.

References $wgMiserMode, SiteStats::edits(), SiteStats::pages(), and SiteStats::users().

wfQuotedPrintable ( string,
charset = '' 
)

Todo:
document

Definition at line 1114 of file GlobalFunctions.php.

References $out, and $wgInputEncoding.

Referenced by UserMailer::send(), GlobalTest::testQuotedPrintable(), and MailAddress::toString().

wfRandom (  ) 

Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any realistic number of articles.

Returns:
string

Definition at line 156 of file GlobalFunctions.php.

Referenced by RandomPage::getRandomTitle(), Article::insertOn(), ApiQueryRandom::run(), and GlobalTest::testRandom().

wfReadOnly (  ) 

wfReadOnlyReason (  ) 

Definition at line 406 of file GlobalFunctions.php.

References $wgReadOnly, and wfReadOnly().

Referenced by OutputPage::readOnlyPage(), and EditPage::showEditForm().

wfRegexReplacement ( string  ) 

wfRelativePath ( path,
from 
)

Generate a relative path name to the given file.

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

Parameters:
string $path Absolute destination path including target filename
string $from Absolute source path, directory only
Returns:
string

Definition at line 2322 of file GlobalFunctions.php.

References $path, and wfBaseName().

Referenced by UploadDumper::outputItem(), and ParserTest::runFile().

wfReportTime (  ) 

Returns a HTML comment with the elapsed time since request.

This method has no side effects.

Returns:
string

Definition at line 860 of file GlobalFunctions.php.

References $wgRequestTime, $wgShowHostnames, wfHostname(), and wfTime().

Referenced by ApiMain::executeActionWithErrorHandling(), SkinTemplate::outputPage(), Skin::outputPage(), and OutputPage::reportTime().

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.

Parameters:
bool $resetGzipEncoding

Definition at line 1503 of file GlobalFunctions.php.

References $status, and $wgDisableOutputCompression.

Referenced by SpecialExport::execute(), wfClearOutputBuffers(), and wfStreamFile().

wfRestoreWarnings (  ) 

wfScript ( script = 'index'  ) 

Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptExtension etc.

Parameters:
string $script Script filename, sans extension
Returns:
string

Definition at line 2860 of file GlobalFunctions.php.

References $wgScriptExtension, and $wgScriptPath.

Referenced by Skin::initPage(), and ApiFormatBase::initPrinter().

wfSeedRandom (  ) 

Seed Mersenne Twister No-op for compatibility; only necessary in PHP < 4.2.0.

Definition at line 145 of file GlobalFunctions.php.

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

As for wfSetVar except setting a bit.

Definition at line 1156 of file GlobalFunctions.php.

References $dest.

Referenced by Database::bufferResults(), Database::debug(), and Database::ignoreErrors().

wfSetupSession (  ) 

wfSetVar ( &$  dest,
source 
)

wfShellExec ( cmd,
&$  retval = null 
)

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

Parameters:
$cmd Command line, properly escaped for shell.
&$retval optional, will receive the program's exit code. (non-zero is usually failure)
Returns:
collected stdout as a string (trailing newlines stripped)

Definition at line 2170 of file GlobalFunctions.php.

References $cmd, $IP, $output, $script, $wgMaxShellFileSize, $wgMaxShellMemory, $wgMaxShellTime, wfDebug(), wfDebugLog(), wfIniGetBool(), and wfInitShellLocale().

Referenced by DjVuHandler::doTransform(), BitmapHandler::doTransform(), InstallerResource::extract(), SVNInstallerResource::fetch(), DifferenceEngine::generateDiffBody(), SVNInstallerRepository::printListing(), SvgHandler::rasterize(), and DjVuImage::retrieveMetaData().

wfShowingResults ( offset,
limit 
)

wfShowingResultsNum ( offset,
limit,
num 
)

Todo:
document

Definition at line 969 of file GlobalFunctions.php.

References $offset, $wgLang, and wfMsgExt().

Referenced by SpecialSearchOld::showResults(), and SpecialSearch::showResults().

wfSpecialList ( page,
details 
)

wfSplitWikiID ( wiki  ) 

Split a wiki ID into DB name and table prefix.

Definition at line 2767 of file GlobalFunctions.php.

Referenced by ForeignDBViaLBRepo::__construct(), LBFactory_Multi::getDBNameAndPrefix(), and LoadBalancer::openForeignConnection().

wfStripIllegalFilenameChars ( name  ) 

Replace all invalid characters with -.

Parameters:
mixed $title Filename to process

Definition at line 3035 of file GlobalFunctions.php.

References $name, Title::legalChars(), and wfBaseName().

Referenced by UploadForm::internalProcessUpload(), and Title::isValidMoveOperation().

wfSuppressWarnings ( end = false  ) 

wfTempDir (  ) 

Tries to get the system directory for temporary files.

The TMPDIR, TMP, and TEMP environment variables are checked in sequence, and if none are set /tmp is returned as the generic Unix default.

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

Returns:
string

Definition at line 1980 of file GlobalFunctions.php.

Referenced by WikiRevision::downloadSource(), WebInstallerResource::fetch(), ParserTest::quickDiff(), GlobalTest::setUp(), ParserTest::setupUploadDir(), wfDiff(), and wfMerge().

wfTime (  ) 

wfTimestamp ( outputtype = TS_UNIX,
ts = 0 
)

Parameters:
mixed $outputtype A timestamp in one of the supported formats, the function will autodetect which format is supplied and act accordingly.
Returns:
string Time in the format specified in $outputtype

Definition at line 1763 of file GlobalFunctions.php.

References $ts, and wfDebug().

Referenced by Block::__construct(), ApiQueryLogEvents::addLogParams(), OutputPage::blockedPage(), SpecialRecentChanges::buildMainQueryConds(), OutputPage::checkLastModified(), AjaxResponse::checkLastModified(), User::checkTemporaryPassword(), Article::commitRollback(), User::confirmationToken(), ApiQueryContributions::continueStr(), Article::createUpdates(), DifferenceEngine::debug(), Block::decodeExpiry(), LocalFile::decodeRow(), UndeleteForm::diffHeader(), do_schema_restructuring(), SpecialExport::execute(), LocalFileRestoreBatch::execute(), ApiUndelete::execute(), ApiQueryContributions::execute(), ApiQueryRecentChanges::execute(), ApiQueryLogEvents::execute(), ApiQueryImageInfo::execute(), ApiQueryDeletedrevs::execute(), ApiQueryBlocks::execute(), ApiQueryAllUsers::execute(), ApiProtect::execute(), ApiFeedWatchlist::execute(), ApiEditPage::execute(), ApiBlock::execute(), ApiMain::executeActionWithErrorHandling(), ApiQueryInfo::extractPageInfo(), ApiQueryWatchlist::extractRowInfo(), ApiQueryContributions::extractRowInfo(), ApiQueryRevisions::extractRowInfo(), ApiQueryRecentChanges::extractRowInfo(), ApiQueryLogEvents::extractRowInfo(), PageHistory::feedEmpty(), Article::fetchContent(), HTMLFileCache::fileCacheTime(), LogImporter::fixDate(), FeedUtils::formatDiff(), UndeleteForm::formatFileRow(), AncientPagesPage::formatResult(), UndeleteForm::formatRevisionRow(), MergehistoryForm::formatRevisionRow(), UsersPager::formatRow(), ContribsPager::formatRow(), AtomFeed::formatTime(), RSSFeed::formatTime(), GenerateSitemap::generateLimit(), GenerateSitemap::GenerateSitemap(), SqlBagOStuff::get(), RawPage::getArticleText(), Block::getAutoblockExpiry(), ApiQueryUserInfo::getCurrentUserInfo(), ProtectionForm::getExpiry(), User::getFirstEditTimestamp(), FormatExif::getFormattedData(), ApiQueryImageInfo::getInfo(), ApiBase::getParameterFromSettings(), PageArchive::getPreviousRevision(), Parser::getRevisionTimestamp(), Revision::getTimestamp(), ForeignAPIFile::getTimestamp(), File::getTimestamp(), ArchivedFile::getTimestamp(), Article::getTimestamp(), Revision::getTimestampFromId(), Title::getUserPermissionsErrors(), Parser::getVariableValue(), ImageHistoryList::imageHistoryLine(), Block::initFromRow(), User::isEmailConfirmationPending(), User::isPasswordReminderThrottled(), User::loadDefaults(), ChangesFeed::loadFromCache(), RecentChange::loadFromCurRow(), User::loadFromRow(), RecentChange::loadFromRow(), Article::loadPageData(), LogEventsList::logLine(), GenerateSitemap::main(), MergehistoryForm::merge(), User::newTouchedTimestamp(), OutputPage::output(), ExtensionInstaller::patchLocalSettings(), User::pingLimiter(), ApiQueryContributions::prepareQuery(), ImageBuilder::progress(), TableCleanup::progress(), Parser::pstPass2(), LocalFile::recordUpload2(), Revision::Revision(), PageHistory::revLink(), ApiQueryWatchlistRaw::run(), ApiQueryWatchlist::run(), ApiQueryProtectedTitles::run(), ApiQueryDuplicateFiles::run(), ApiQueryCategoryMembers::run(), ApiQueryCategories::run(), runJobsLog(), ChangesFeed::saveToCache(), RevisionDeleter::setArchiveVisibility(), WikiRevision::setTimestamp(), TextPassDumper::showReport(), BackupDumper::showReport(), SpecialRevisionDelete::showRevs(), Language::sprintfDate(), UpdateLogging::sync(), GlobalTest::testTimestamp(), Language::timeanddate(), DatabasePostgres::timestamp(), DatabaseOracle::timestamp(), DatabaseMssql::timestamp(), DatabaseIbm_db2::timestamp(), Database::timestamp(), UndeleteForm::UndeleteForm(), Article::updateIfNewerOn(), Block::updateTimestamp(), EditPage::wasDeletedSinceLastEdit(), wfDebugLog(), wfSpecialNewimages(), wfTimestampNow(), wfTimestampOrNull(), and XmlDumpWriter::writeTimestamp().

wfTimestampNow (  ) 

wfTimestampOrNull ( outputtype = TS_UNIX,
ts = null 
)

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

For dealing with nullable timestamp columns in the database.

Parameters:
int $outputtype
string $ts
Returns:
string

Definition at line 1832 of file GlobalFunctions.php.

References $ts, and wfTimestamp().

Referenced by Autopromote::checkCondition(), ApiQueryUsers::execute(), Title::getEarliestRevTime(), and User::loadFromRow().

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:

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

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:

;:$!*(),/

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

Parameters:
$s String:
Returns:
string

Definition at line 184 of file GlobalFunctions.php.

References $s.

Referenced by FileRepo::getDescriptionRenderUrl(), FileRepo::getDescriptionUrl(), Title::getFullURL(), Title::getLocalURL(), Title::getPrefixedURL(), Title::getSubpageUrlForm(), Parser::getVariableValue(), LoginForm::mainLoginForm(), Title::makeTitle(), CoreParserFunctions::namespacee(), SkinStandard::quickBar(), Title::secureAndSplit(), CoreParserFunctions::subjectspacee(), CoreParserFunctions::talkspacee(), GlobalTest::testUrlencode(), and wfSpecialEmailuser().

wfUrlProtocols (  ) 

wfUseMW ( req_ver  ) 

This function works like "use VERSION" in Perl except it checks the version of MediaWiki, the program will die with a backtrace if the current version of MediaWiki is less than the version provided.

This is useful for extensions which due to their nature are not kept in sync with releases

See also:
perldoc -f use
Parameters:
mixed $version The version to check, can be a string, an integer, or a float

Definition at line 2275 of file GlobalFunctions.php.

References $wgVersion.

wfUsePHP ( req_ver  ) 

This function works like "use VERSION" in Perl, the program will die with a backtrace if the current version of PHP is less than the version provided.

This is useful for extensions which due to their nature are not kept in sync with releases, and might depend on other versions of PHP than the main code

Note: PHP might die due to parsing errors in some cases before it ever manages to call this function, such is life

See also:
perldoc -f use
Parameters:
mixed $version The version to check, can be a string, an integer, or a float

Definition at line 2255 of file GlobalFunctions.php.

wfVarDump ( var  ) 

A wrapper around the PHP function var_export().

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

Parameters:
$var A PHP variable to dump.

Definition at line 1455 of file GlobalFunctions.php.

References $s, $wgOut, and print.

wfViewPrevNext ( offset,
limit,
link,
query = '',
atend = false 
)

Generate (prev x| next x) (20|50|100.

..) type links for paging

Parameters:
$offset string
$limit int
$link string
$query string, optional URL query parameter string
$atend bool, optional param for specified if this is the last page

Definition at line 983 of file GlobalFunctions.php.

References $offset, $title, $wgLang, Title::newFromText(), wfMsg(), wfMsgExt(), wfMsgHtml(), and wfNumLink().

Referenced by QueryPage::doQuery(), SpecialSearchOld::showResults(), and SpecialSearch::showResults().

wfWaitForSlaves ( maxLag  ) 

Sleep until the worst slave's replication lag is less than or equal to $maxLag, in seconds.

Use this when updating very large numbers of rows, as in maintenance scripts, to avoid causing too much lag. Of course, this is a no-op if there are no slaves.

Every time the function has to wait for a slave, it will print a message to that effect (and then sleep for a little while), so it's probably not best to use this outside maintenance scripts in its present form.

Parameters:
int $maxLag
Returns:
null

Definition at line 2991 of file GlobalFunctions.php.

References $lb, $maxLag, $name, print, and wfGetLB().

Referenced by compressWithConcat(), deleteDefaultMessages(), deleteLinksFromNonexistent(), do_restrictions_update(), do_templatelinks_update(), IPBlockForm::doMassUserBlock(), RecompressTracked::executeChild(), migrate_page_restrictions(), moveToExternal(), populate_rev_parent_id(), populateCategory(), refreshLinks(), RecompressTracked::report(), resolveStubs(), BackupReader::showReport(), UpdateLogging::sync(), TrackBlobs::trackOrphanText(), TrackBlobs::trackRevisions(), and wfGearmanMonitor().

wfWikiID ( db = null  ) 


Variable Documentation

if(!defined( 'MEDIAWIKI'))

Global functions used everywhere.

Definition at line 3 of file GlobalFunctions.php.


Generated on Sat Sep 5 02:08:07 2009 for MediaWiki by  doxygen 1.5.9