Awight has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/342548 )

Change subject: Correct parameters to wfMessage
......................................................................

Correct parameters to wfMessage

FIXME: Wrap a more sane API than wfMessage.  Use the message class directly,
and pass params without c_u_f_a, maybe via the functional interface.

Change-Id: I43808d60c2763804823d0c7ad735c50edada9851
---
M gateway_common/MessageUtils.php
M gateway_common/WmfFramework.mediawiki.php
2 files changed, 11 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/48/342548/1

diff --git a/gateway_common/MessageUtils.php b/gateway_common/MessageUtils.php
index e05cfdb..2ce5025 100644
--- a/gateway_common/MessageUtils.php
+++ b/gateway_common/MessageUtils.php
@@ -27,19 +27,24 @@
                # look for the first message that exists
                foreach ( $msg_keys as $m ){
                        if ( WmfFramework::messageExists( $m, $language ) ){
-                               return WmfFramework::formatMessage( $m, $params 
);
+                               // FIXME: Just use a sane function signature.
+                               $varargs = array_merge( array( $m ), $params );
+                               return call_user_func_array( 
'WmfFramework::formatMessage', $varargs );
                        }
                }
 
                # we found nothing in the requested language, return the first 
fallback message that exists
+               # FIXME: How is this different than the above loop?
                foreach ( $msg_keys as $m ){
                        if ( WmfFramework::messageExists( $m, $language ) ){
-                               return WmfFramework::formatMessage( $m, $params 
);
+                               $varargs = array_merge( array( $m ), $params );
+                               return call_user_func_array( 
'WmfFramework::formatMessage', $varargs );
                        }
                }
 
                # somehow we still don't have a message, return a default error 
message
-               return WmfFramework::formatMessage( $msg_keys[0], $params );
+               $varargs = array_merge( array( $msg_keys[0] ), $params );
+               return call_user_func_array( 'WmfFramework::formatMessage', 
$varargs );
        }
 
        /**
diff --git a/gateway_common/WmfFramework.mediawiki.php 
b/gateway_common/WmfFramework.mediawiki.php
index 37ecf9b..9c03541 100644
--- a/gateway_common/WmfFramework.mediawiki.php
+++ b/gateway_common/WmfFramework.mediawiki.php
@@ -31,8 +31,9 @@
                return wfHostname();
        }
 
-       static function formatMessage( $message_identifier /*, ... */ ) {
-               return call_user_func_array( 'wfMessage', func_get_args() 
)->text();
+       static function formatMessage( /* $message_identifier, ... */ ) {
+               $args = func_get_args();
+               return call_user_func_array( 'wfMessage', $args )->text();
        }
 
        static function getLanguageCode() {

-- 
To view, visit https://gerrit.wikimedia.org/r/342548
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43808d60c2763804823d0c7ad735c50edada9851
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to