Manual:GlobalFunctions.php

From MediaWiki.org
Jump to: navigation, search

GlobalFunctions.php is a file that contains global functions, including such important functions as wfMsgExt, which is used for internationalisation.

Functions[edit | edit source]

wfRunHooks() example usage[edit | edit source]

wfRunHooks() example usage, from WikiPage:doEditContent():

$hook_args = array( &$this, &$user, $content, $summary,
	$flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId );
ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $hook_args );
wfRunHooks( 'PageContentSaveComplete', $hook_args );

wfRandom()[edit | edit source]

wfRandom() is used to populate page.page_random.

wfBaseConvert()[edit | edit source]

The function used to generate the base-36 SHA-1 text content hash in revision.rev_sha1 is wfBaseConvert( sha1( $text ), 16, 36, 31 ). API modules like ApiQueryRevisions use wfBaseConvert( $revision->getSha1(), 36, 16, 40 ).

See also[edit | edit source]

Language: English  • Deutsch • português do Brasil