Index: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt (revision 14372)
+++ trunk/phase3/docs/hooks.txt (revision 14373)
@@ -346,15 +346,18 @@
$url: string value as output (out parameter, can modify)
$query: query options passed to Title::getFullURL()
-'LogPageValidTypes': action being logged.
-$type: array of strings
+'LogPageValidTypes': action being logged. DEPRECATED: Use $wgLogTypes
+&$type: array of strings
-'LogPageLogName': name of the logging page(s).
-$typeText: array of strings
+'LogPageLogName': name of the logging page(s). DEPRECATED: Use $wgLogNames
+&$typeText: array of strings
-'LogPageLogHeader': strings used by wfMsg as a header.
-$headerText: array of strings
+'LogPageLogHeader': strings used by wfMsg as a header. DEPRECATED: Use $wgLogHeaders
+&$headerText: array of strings
+'LogPageActionText': strings used by wfMsg as a header. DEPRECATED: Use $wgLogActions
+&$actionText: array of strings
+
'MarkPatrolled': before an edit is marked patrolled
$rcid: ID of the revision to be marked patrolled
$user: the user (object) marking the revision as patrolled
Index: trunk/phase3/includes/Setup.php
===================================================================
--- trunk/phase3/includes/Setup.php (revision 14372)
+++ trunk/phase3/includes/Setup.php (revision 14373)
@@ -320,6 +320,13 @@
call_user_func( $func );
}
+// For compatibility
+wfRunHooks( 'LogPageValidTypes', array( &$wgLogTypes ) );
+wfRunHooks( 'LogPageLogName', array( &$wgLogNames ) );
+wfRunHooks( 'LogPageLogHeader', array( &$wgLogHeaders ) );
+wfRunHooks( 'LogPageActionText', array( &$wgLogActions ) );
+
+
wfDebug( "\n" );
$wgFullyInitialised = true;
wfProfileOut( $fname.'-extensions' );
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php (revision 14372)
+++ trunk/phase3/includes/DefaultSettings.php (revision 14373)
@@ -1712,6 +1712,70 @@
$wgHooks = array();
/**
+ * The logging system has two levels: an event type, which describes the
+ * general category and can be viewed as a named subset of all logs; and
+ * an action, which is a specific kind of event that can exist in that
+ * log type.
+ */
+$wgLogTypes = array( '', 'block', 'protect', 'rights', 'delete', 'upload', 'move' );
+
+/**
+ * Lists the message key string for each log type. The localized messages
+ * will be listed in the user interface.
+ *
+ * Extensions with custom log types may add to this array.
+ */
+$wgLogNames = array(
+ '' => 'log',
+ 'block' => 'blocklogpage',
+ 'protect' => 'protectlogpage',
+ 'rights' => 'rightslog',
+ 'delete' => 'dellogpage',
+ 'upload' => 'uploadlogpage',
+ 'move' => 'movelogpage' );
+
+/**
+ * Lists the message key string for descriptive text to be shown at the
+ * top of each log type.
+ *
+ * Extensions with custom log types may add to this array.
+ */
+$wgLogHeaders = array(
+ '' => 'alllogstext',
+ 'block' => 'blocklogtext',
+ 'protect' => 'protectlogtext',
+ 'rights' => 'rightslogtext',
+ 'delete' => 'dellogpagetext',
+ 'upload' => 'uploadlogpagetext',
+ 'move' => 'movelogpagetext' );
+
+/**
+ * Lists the message key string for formatting individual events of each
+ * type and action when listed in the logs.
+ *
+ * Extensions with custom log types may add to this array.
+ */
+$wgLogActions = array(
+ 'block/block' => 'blocklogentry',
+ 'block/unblock' => 'unblocklogentry',
+ 'protect/protect' => 'protectedarticle',
+ 'protect/unprotect' => 'unprotectedarticle',
+
+ // TODO: This whole section should be moved to extensions/Makesysop/SpecialMakesysop.php
+ 'rights/rights' => 'rightslogentry',
+ 'rights/addgroup' => 'addgrouplogentry',
+ 'rights/rngroup' => 'renamegrouplogentry',
+ 'rights/chgroup' => 'changegrouplogentry',
+
+ 'delete/delete' => 'deletedarticle',
+ 'delete/restore' => 'undeletedarticle',
+ 'delete/revision' => 'revdelete-logentry',
+ 'upload/upload' => 'uploadedimage',
+ 'upload/revert' => 'uploadedimage',
+ 'move/move' => '1movedto2',
+ 'move/move_redir' => '1movedto2_redir' );
+
+/**
* Experimental preview feature to fetch rendered text
* over an XMLHttpRequest from JavaScript instead of
* forcing a submit and reload of the whole page.
Index: trunk/phase3/includes/LogPage.php
===================================================================
--- trunk/phase3/includes/LogPage.php (revision 14372)
+++ trunk/phase3/includes/LogPage.php (revision 14373)
@@ -94,9 +94,8 @@
* @static
*/
function validTypes() {
- static $types = array( '', 'block', 'protect', 'rights', 'delete', 'upload', 'move' );
- wfRunHooks( 'LogPageValidTypes', array( &$types ) );
- return $types;
+ global $wgLogTypes;
+ return $wgLogTypes;
}
/**
@@ -110,19 +109,10 @@
* @static
*/
function logName( $type ) {
- static $typeText = array(
- '' => 'log',
- 'block' => 'blocklogpage',
- 'protect' => 'protectlogpage',
- 'rights' => 'rightslog',
- 'delete' => 'dellogpage',
- 'upload' => 'uploadlogpage',
- 'move' => 'movelogpage'
- );
- wfRunHooks( 'LogPageLogName', array( &$typeText ) );
+ global $wgLogNames;
- if( isset( $typeText[$type] ) ) {
- return str_replace( '_', ' ', wfMsg( $typeText[$type] ) );
+ if( isset( $wgLogNames[$type] ) ) {
+ return str_replace( '_', ' ', wfMsg( $wgLogNames[$type] ) );
} else {
// Bogus log types? Perhaps an extension was removed.
return $type;
@@ -130,54 +120,24 @@
}
/**
+ * @fixme: handle missing log types
* @static
*/
function logHeader( $type ) {
- static $headerText = array(
- '' => 'alllogstext',
- 'block' => 'blocklogtext',
- 'protect' => 'protectlogtext',
- 'rights' => 'rightslogtext',
- 'delete' => 'dellogpagetext',
- 'upload' => 'uploadlogpagetext',
- 'move' => 'movelogpagetext'
- );
- wfRunHooks( 'LogPageLogHeader', array( &$headerText ) );
-
- return wfMsg( $headerText[$type] );
+ global $wgLogHeaders;
+ return wfMsg( $wgLogHeaders[$type] );
}
/**
* @static
*/
function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
- global $wgLang, $wgContLang;
- static $actions = array(
- 'block/block' => 'blocklogentry',
- 'block/unblock' => 'unblocklogentry',
- 'protect/protect' => 'protectedarticle',
- 'protect/unprotect' => 'unprotectedarticle',
+ global $wgLang, $wgContLang, $wgLogActions;
- // TODO: This whole section should be moved to extensions/Makesysop/SpecialMakesysop.php
- 'rights/rights' => 'rightslogentry',
- 'rights/addgroup' => 'addgrouplogentry',
- 'rights/rngroup' => 'renamegrouplogentry',
- 'rights/chgroup' => 'changegrouplogentry',
-
- 'delete/delete' => 'deletedarticle',
- 'delete/restore' => 'undeletedarticle',
- 'delete/revision' => 'revdelete-logentry',
- 'upload/upload' => 'uploadedimage',
- 'upload/revert' => 'uploadedimage',
- 'move/move' => '1movedto2',
- 'move/move_redir' => '1movedto2_redir'
- );
- wfRunHooks( 'LogPageActionText', array( &$actions ) );
-
$key = "$type/$action";
- if( isset( $actions[$key] ) ) {
+ if( isset( $wgLogActions[$key] ) ) {
if( is_null( $title ) ) {
- $rv=wfMsg( $actions[$key] );
+ $rv=wfMsg( $wgLogActions[$key] );
} else {
if( $skin ) {
@@ -209,16 +169,16 @@
}
if( count( $params ) == 0 ) {
if ( $skin ) {
- $rv = wfMsg( $actions[$key], $titleLink );
+ $rv = wfMsg( $wgLogActions[$key], $titleLink );
} else {
- $rv = wfMsgForContent( $actions[$key], $titleLink );
+ $rv = wfMsgForContent( $wgLogActions[$key], $titleLink );
}
} else {
array_unshift( $params, $titleLink );
if ( $translate && $key == 'block/block' ) {
$params[1] = $wgLang->translateBlockExpiry($params[1]);
}
- $rv = wfMsgReal( $actions[$key], $params, true, !$skin );
+ $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin );
}
}
} else {
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES (revision 14372)
+++ trunk/phase3/RELEASE-NOTES (revision 14373)
@@ -328,6 +328,10 @@
* (bug 6061) Improper escaping in some html forms
* (bug 6065) Remove underscore when using NAMESPACE and TALKSPACE magics.
* (bug 6074) Correct squid purging of offsite upload URLs
+* To simplify the lives of extension developers, the logging type arrays
+ can now be appended to directly by an extension setup function. It is
+ no longer necessary to write four separate functions just to add a
+ custom log type.
== Compatibility ==