* Move $var ? true : false check to boolval function
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Wed, 14 May 2008 19:12:00 +0000 (19:12 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Wed, 14 May 2008 19:12:00 +0000 (19:12 +0000)
* Introduce $wgLogActionsHandlers

includes/Autopromote.php
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/LogPage.php

index b166aa7..2a159fe 100644 (file)
@@ -87,7 +87,7 @@ class Autopromote {
                                if( User::isValidEmailAddr( $user->getEmail() ) ) {
                                        global $wgEmailAuthentication;
                                        if( $wgEmailAuthentication ) {
-                                               return $user->getEmailAuthenticationTimestamp() ? true : false;
+                                               return boolval( $user->getEmailAuthenticationTimestamp() );
                                        } else {
                                                return true;
                                        }
index ff7803f..1fa3104 100644 (file)
@@ -2591,6 +2591,12 @@ $wgLogActions = array(
        'suppress/block'        => 'blocklogentry',
 );
 
+/**
+ * The same as above, but here values are names of functions,
+ * not messages
+ */
+$wgLogActionsHandlers = array();
+
 /**
  * List of special pages, followed by what subtitle they should go under
  * at Special:SpecialPages
index 9d3a17c..5ee4cf0 100644 (file)
@@ -2597,8 +2597,12 @@ function wfWaitForSlaves( $maxLag ) {
 /** Generate a random 32-character hexadecimal token.
  * @param mixed $salt Some sort of salt, if necessary, to add to random characters before hashing.
  */
- function wfGenerateToken( $salt = '' ) {
+function wfGenerateToken( $salt = '' ) {
        $salt = serialize($salt);
 
        return md5( mt_rand( 0, 0x7fffffff ) . $salt );
 }
+
+function boolval( $val ) {
+       return $val ? true : false;
+}
index 38064e6..1d82fd9 100644 (file)
@@ -223,8 +223,14 @@ class LogPage {
                                }
                        }
                } else {
-                       wfDebug( "LogPage::actionText - unknown action $key\n" );
-                       $rv = "$action";
+                       global $wgLogActionsHandlers;
+                       if( isset( $wgLogActionsHandlers[$key] ) ) {
+                               $args = func_get_args();
+                               $rv = call_user_func_array( $wgLogActionsHandlers[$key], $args );
+                       } else {
+                               wfDebug( "LogPage::actionText - unknown action $key\n" );
+                               $rv = "$action";
+                       }
                }
                if( $filterWikilinks ) {
                        $rv = str_replace( "[[", "", $rv );