MediaWiki r37292 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r37291‎ | r37292 (on ViewVC)‎ | r37293 >
Date:22:37, 7 July 2008
Author:skizzerz
Status:old
Tags:
Comment:
* Add new hook NormalizeMessageKey to allow extensions to change what system message is being shown before any queries are made
Modified paths:

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt	(revision 37291)
+++ trunk/phase3/docs/hooks.txt	(revision 37292)
@@ -862,6 +862,14 @@
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
 
+'NormalizeMessageKey': Called before the software gets the text of a message
+  (stuff in the MediaWiki: namespace), useful for changing WHAT message gets displayed
+&$key: the message being looked up. Change this to something else to change what message gets displayed (string)
+&$useDB: whether or not to look up the message in the database (bool)
+&$langCode: the language code to get the message for (string) - or -
+  whether to use the content language (true) or site language (false) (bool)
+&$transform: whether or not to expand variables and templates in the message (bool)
+
 'OpenSearchUrls': Called when constructing the OpenSearch description XML.
 Hooks can alter or append to the array of URLs for search & suggestion formats.
 &$urls: array of associative arrays with Url element attributes
Index: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php	(revision 37291)
+++ trunk/phase3/includes/GlobalFunctions.php	(revision 37292)
@@ -460,6 +460,8 @@
 function wfMsgGetKey( $key, $useDB, $langCode = false, $transform = true ) {
 	global $wgParser, $wgContLang, $wgMessageCache, $wgLang;
 
+	wfRunHooks('NormalizeMessageKey', array(&$key, &$useDB, &$langCode, &$transform));
+	
 	# If $wgMessageCache isn't initialised yet, try to return something sensible.
 	if( is_object( $wgMessageCache ) ) {
 		$message = $wgMessageCache->get( $key, $useDB, $langCode );
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 37291)
+++ trunk/phase3/RELEASE-NOTES	(revision 37292)
@@ -182,8 +182,9 @@
 * Allow the search box, toolbox and languages box in the Monobook sidebar to be
   moved around arbitrarily using special sections in [[MediaWiki:Sidebar]]: 
   SEARCH, TOOLBOX and LANGUAGES
-
-
+* Add a new hook NormalizeMessageKey to allow extensions to replace messages before
+  the database is potentially queried
+ 
 === Bug fixes in 1.13 ===
 
 * (bug 10677) Add link to the file description page on the shared repository

Status & tagging log

  • 15:28, 12 September 2011 Meno25 (Talk | contribs) changed the status of r37292 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox