Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/184022
Change subject: MWException -> Exception
......................................................................
MWException -> Exception
Change-Id: I7156e44d0edaf638adf83b31e8bb92a17e39483e
---
M activemq_stomp/Stomp/Exception.php
M activemq_stomp/Stomp/Message.php
M activemq_stomp/Stomp/Message/Bytes.php
M activemq_stomp/Stomp/Message/Map.php
M extras/custom_filters/custom_filters.body.php
M extras/custom_filters/filters/functions/functions.body.php
M extras/custom_filters/filters/minfraud/minfraud.body.php
M gateway_common/DataValidator.php
M gateway_common/EncodingMangler.php
M gateway_common/GatewayPage.php
M gateway_common/MWException.drupal.php
M gateway_common/gateway.adapter.php
M gateway_forms/RapidHtml.php
M globalcollect_gateway/globalcollect.adapter.php
M globalcollect_gateway/globalcollect_resultswitcher.body.php
M special/GatewayFormChooser.php
M tests/DonationInterfaceTestCase.php
M worldpay_gateway/worldpay.adapter.php
M worldpay_gateway/worldpay_gateway.alias.php
19 files changed, 53 insertions(+), 53 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/22/184022/1
diff --git a/activemq_stomp/Stomp/Exception.php
b/activemq_stomp/Stomp/Exception.php
index 72f684e..0960756 100644
--- a/activemq_stomp/Stomp/Exception.php
+++ b/activemq_stomp/Stomp/Exception.php
@@ -56,4 +56,4 @@
}
}
-?>
\ No newline at end of file
+?>
diff --git a/activemq_stomp/Stomp/Message.php b/activemq_stomp/Stomp/Message.php
index 0dc4678..5686b8a 100644
--- a/activemq_stomp/Stomp/Message.php
+++ b/activemq_stomp/Stomp/Message.php
@@ -34,4 +34,4 @@
$this->_init( "SEND", $headers, $body );
}
}
-?>
\ No newline at end of file
+?>
diff --git a/activemq_stomp/Stomp/Message/Bytes.php
b/activemq_stomp/Stomp/Message/Bytes.php
index 7ec8c16..f580a78 100644
--- a/activemq_stomp/Stomp/Message/Bytes.php
+++ b/activemq_stomp/Stomp/Message/Bytes.php
@@ -44,4 +44,4 @@
$this->headers['content-length'] = count( $body );
}
}
-?>
\ No newline at end of file
+?>
diff --git a/activemq_stomp/Stomp/Message/Map.php
b/activemq_stomp/Stomp/Message/Map.php
index 9d7d4b2..dd61e6d 100644
--- a/activemq_stomp/Stomp/Message/Map.php
+++ b/activemq_stomp/Stomp/Message/Map.php
@@ -52,4 +52,4 @@
}
}
}
-?>
\ No newline at end of file
+?>
diff --git a/extras/custom_filters/custom_filters.body.php
b/extras/custom_filters/custom_filters.body.php
index e17ef5c..b26a694 100644
--- a/extras/custom_filters/custom_filters.body.php
+++ b/extras/custom_filters/custom_filters.body.php
@@ -55,7 +55,7 @@
public function addRiskScore( $score, $source ){
if ( !is_numeric( $score ) ){
- throw new MWException(__FUNCTION__ . " Cannot add
$score to risk score (not numeric). Source: $source" );
+ throw new Exception(__FUNCTION__ . " Cannot add $score
to risk score (not numeric). Source: $source" );
}
if ( !is_array( $this->risk_score ) ){
if ( is_numeric( $this->risk_score ) ){
@@ -86,7 +86,7 @@
return $total;
} else {
- throw new MWException( __FUNCTION__ . " risk_score is
neither numeric, nor an array." . print_r( $this->risk_score, true ) );
+ throw new Exception( __FUNCTION__ . " risk_score is
neither numeric, nor an array." . print_r( $this->risk_score, true ) );
}
}
diff --git a/extras/custom_filters/filters/functions/functions.body.php
b/extras/custom_filters/filters/functions/functions.body.php
index 8855280..7a621bd 100644
--- a/extras/custom_filters/filters/functions/functions.body.php
+++ b/extras/custom_filters/filters/functions/functions.body.php
@@ -34,7 +34,7 @@
$score = $score * $risk_score_modifier
/ 100;
} else {
// error_log("Function Filter:
$function_name returned $score");
- throw new MWException( "Filter
functions are returning somekinda nonsense." );
+ throw new Exception( "Filter functions
are returning somekinda nonsense." );
}
$this->cfo->addRiskScore( $score,
$function_name );
diff --git a/extras/custom_filters/filters/minfraud/minfraud.body.php
b/extras/custom_filters/filters/minfraud/minfraud.body.php
index 1100bfa..1770eaf 100644
--- a/extras/custom_filters/filters/minfraud/minfraud.body.php
+++ b/extras/custom_filters/filters/minfraud/minfraud.body.php
@@ -83,7 +83,7 @@
* @param GatewayAdapter $gateway_adapter Gateway adapter instance
* @param GatewayAdapter $custom_filter_object Gateway adapter
instance
* @param string $license_key The license key. May
also be set in $wgMinFraudLicenseKey
- * @throws MWException
+ * @throws Exception
*/
public function __construct( &$gateway_adapter, &$custom_filter_object,
$license_key = NULL ) {
@@ -97,7 +97,7 @@
// set the minfraud license key, go no further if we don't have
it
if ( !$license_key && !$wgMinFraudLicenseKey ) {
- throw new MWException( "minFraud license key required
but not present." );
+ throw new Exception( "minFraud license key required but
not present." );
}
$this->minfraudLicenseKey = ( $license_key ) ? $license_key :
$wgMinFraudLicenseKey;
@@ -262,12 +262,12 @@
try {
if ( !isset( $this->minfraudResponse['riskScore'] ) ) {
- throw new MWException( "No response at all from
minfraud." );
+ throw new Exception( "No response at all from
minfraud." );
}
$this->cfo->addRiskScore(
$this->minfraudResponse['riskScore'], 'minfraud_filter' );
}
- catch( MWException $ex){
+ catch( Exception $ex){
//log out the whole response to the error log so we can
tell what the heck happened... and fail closed.
$log_message = 'Minfraud filter came back with some
garbage. Assigning all the points.';
$this->cfo->gateway_adapter->log( '"addRiskScore" ' .
$log_message, LOG_ERR, '_fraud' );
diff --git a/gateway_common/DataValidator.php b/gateway_common/DataValidator.php
index 96f80b4..c92ef25 100644
--- a/gateway_common/DataValidator.php
+++ b/gateway_common/DataValidator.php
@@ -279,13 +279,13 @@
*
* @param string $language the code of the requested language
* @param array $msg_keys
- * @throws MWException
+ * @throws Exception
* @return String the text of the first existant message
*/
public static function wfLangSpecificFallback( $language='en',
$msg_keys=array() ){
if ( count( $msg_keys ) < 1 ){
- throw new MWException( __FUNCTION__ . " BAD PROGRAMMER.
No message keys given." );
+ throw new Exception( __FUNCTION__ . " BAD PROGRAMMER.
No message keys given." );
}
# look for the first message that exists
@@ -317,7 +317,7 @@
* on. If this is not populated, no fields will throw errors for being
empty,
* UNLESS they are required for a field that uses them for more complex
* validation (the 'calculated' phase).
- * @throws MWException
+ * @throws Exception
* @return array An array of errors in a format ready for any
derivitive of
* the main DonationInterface Form class to display. The array will be
empty
* if no errors were generated and everything passed OK.
@@ -421,7 +421,7 @@
}
} else {
$errors[ self::getErrorToken( $field ) ] =
self::getErrorMessage( $field, 'non_empty', $language );
- throw new MWException( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('non_empty' rule for $field )" );
+ throw new Exception( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('non_empty' rule for $field )" );
}
}
@@ -439,7 +439,7 @@
}
} else {
$errors[ $errorToken ] = self::getErrorMessage(
$field, 'valid_type', $language );
- throw new MWException( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('valid_type' rule for $field)" );
+ throw new Exception( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('valid_type' rule for $field)" );
}
}
@@ -484,7 +484,7 @@
} else {
$errors[ $errorToken ] = self::getErrorMessage(
$field, 'calculated', $language, $data[$field] );
- throw new MWException( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('calculated' rule for $field)" );
+ throw new Exception( __FUNCTION__ . " BAD
PROGRAMMER. No $function function. ('calculated' rule for $field)" );
}
}
// error_log( __FUNCTION__ . " " . print_r( $instructions, true )
);
@@ -1018,7 +1018,7 @@
* @param string $gateway The gateway we're concerned with. Only
matters if,
* for instance, $wgDonationInterfaceIPBlacklist is different from
* $wgGlobalcollectGatewayIPBlacklist for some silly reason.
- * @throws MWException
+ * @throws Exception
* @return bool
*/
public static function ip_is_listed( $ip, $list_name, $gateway = '' ) {
@@ -1030,7 +1030,7 @@
);
if ( !in_array( $list_name, $globalIPLists ) ){
- throw new MWException( __FUNCTION__ . " BAD PROGRAMMER.
No recognized global list of IPs called $list_name. Do better." );
+ throw new Exception( __FUNCTION__ . " BAD PROGRAMMER.
No recognized global list of IPs called $list_name. Do better." );
}
$class = self::getGatewayClass( $gateway );
diff --git a/gateway_common/EncodingMangler.php
b/gateway_common/EncodingMangler.php
index d2f5fae..b84c23d 100644
--- a/gateway_common/EncodingMangler.php
+++ b/gateway_common/EncodingMangler.php
@@ -59,4 +59,4 @@
$iso = iconv( 'UTF-8', 'ISO-8859-1//TRANSLIT', $value );
return iconv( 'ISO-8859-1', 'UTF-8', $iso );
}
-}
\ No newline at end of file
+}
diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 86c85f2..17c37f7 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -352,7 +352,7 @@
$oldCurrency = $this->adapter->getData_Unstaged_Escaped(
'currency_code' );
if ( $oldCurrency === $defaultCurrency ) {
$adapterClass =
$this->adapter->getGatewayAdapterClass();
- throw new MWException( __FUNCTION__ . " Unsupported
currency $defaultCurrency set as fallback for $adapterClass." );
+ throw new Exception( __FUNCTION__ . " Unsupported
currency $defaultCurrency set as fallback for $adapterClass." );
}
$oldAmount = $this->adapter->getData_Unstaged_Escaped( 'amount'
);
$usdAmount = 0.0;
diff --git a/gateway_common/MWException.drupal.php
b/gateway_common/MWException.drupal.php
index d2d24f8..1d73f66 100644
--- a/gateway_common/MWException.drupal.php
+++ b/gateway_common/MWException.drupal.php
@@ -1,4 +1,4 @@
<?php
-class MWException extends Exception {
+class Exception extends Exception {
}
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index 150708d..a8e6181 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -696,7 +696,7 @@
* on that point, I'm keeping it for now. If we do kill off this param,
we
* should also get rid of the function buildTransactionFormat and
anything
* that calls it.
- * @throws MWException
+ * @throws Exception
* @return mixed The value we want to send directly to the gateway, for
the
* specified gateway field name.
*/
@@ -704,7 +704,7 @@
if ( empty( $this->transactions ) ) {
$msg = self::getGatewayName() . ': Transactions
structure is empty! No transaction can be constructed.';
$this->log( $msg, LOG_CRIT );
- throw new MWException( $msg );
+ throw new Exception( $msg );
}
//Ensures we are using the correct transaction structure for
our various lookups.
$transaction = $this->getCurrentTransaction();
@@ -752,14 +752,14 @@
//Complain furiously, for your code is faulty.
$msg = self::getGatewayName() . ': Requested value ' .
$gateway_field_name . ' cannot be found in the transactions structure.';
$this->log( $msg, LOG_CRIT );
- throw new MWException( $msg );
+ throw new Exception( $msg );
}
/**
* Returns the current transaction request structure if it exists,
otherwise
* returns false.
* Fails nicely if the current transaction is simply not set yet.
- * @throws MWException if the transaction is set, but no structure is
defined.
+ * @throws Exception if the transaction is set, but no structure is
defined.
* @return mixed current transaction's structure as an array, or false
*/
protected function getTransactionRequestStructure(){
@@ -774,7 +774,7 @@
$msg = self::getGatewayName() . ": $transaction request
structure is empty! No transaction can be constructed.";
$this->log( $msg, LOG_CRIT );
- throw new MWException( $msg );
+ throw new Exception( $msg );
}
return $this->transactions[$transaction]['request'];
@@ -1076,9 +1076,9 @@
$this->saveCommunicationStats(
"buildRequestNameValueString", $transaction ); // save profiling data
} else {
- throw new MWException( "Communication type of
'{$commType}' unknown" );
+ throw new Exception( "Communication type of
'{$commType}' unknown" );
}
- } catch ( MWException $e ) {
+ } catch ( Exception $e ) {
$this->log( "Malformed gateway definition. Cannot
continue: Aborting.\n" . $e->getMessage(), LOG_CRIT );
$this->setTransactionResult( array(
@@ -1218,13 +1218,13 @@
* @param type $transaction_name This is a specific transaction type
like
* 'INSERT_ORDERWITHPAYMENT' (if you're GlobalCollect) that maps to a
* first-level key in the $transactions array.
- * @throws MWException
+ * @throws Exception
*/
public function setCurrentTransaction( $transaction_name ){
if ( empty( $this->transactions ) || !is_array(
$this->transactions ) || !array_key_exists( $transaction_name,
$this->transactions ) ) {
$msg = self::getGatewayName() . ': Transaction Name "'
. $transaction_name . '" undefined for this gateway.';
$this->log( $msg, LOG_ALERT );
- throw new MWException( $msg );
+ throw new Exception( $msg );
} else {
$this->current_transaction = $transaction_name;
}
@@ -1738,12 +1738,12 @@
* @param int $lower The integer value of the lower-bound in this code
range.
* @param int $upper Optional: The integer value of the upper-bound in
the
* code range. If omitted, it will make a range of one value: The lower
bound.
- * @throws MWException
+ * @throws Exception
* @return void
*/
protected function addCodeRange( $transaction, $key, $action, $lower,
$upper = null ) {
if ( !$this->validTransactionWMFStatus( $action ) ) {
- throw new MWException( "Transaction WMF Status $action
is invalid." );
+ throw new Exception( "Transaction WMF Status $action is
invalid." );
}
if ( $upper === null ) {
$this->return_value_map[$transaction][$key][$lower] =
$action;
@@ -2225,11 +2225,11 @@
* @param string $status The final status of one discrete donation
attempt,
* can be one of five values: 'complete', 'pending', 'pending-poke',
* 'failed', 'revised'
- * @throws MWException
+ * @throws Exception
*/
public function finalizeInternalStatus( $status ) {
if ( !$this->validTransactionWMFStatus( $status ) ) {
- throw new MWException( "Transaction WMF Status $status
is invalid." );
+ throw new Exception( "Transaction WMF Status $status is
invalid." );
}
/**
@@ -2574,7 +2574,7 @@
* @param bool $reset set to true to do a hard set on the action value.
* Otherwise, the status will only change if it fails harder than it
already
* was.
- * @throws MWException
+ * @throws Exception
*/
public function setValidationAction( $action, $reset = false ) {
//our choices are:
@@ -2585,7 +2585,7 @@
'reject' => 3,
);
if ( !isset( $actions[$action] ) ) {
- throw new MWException( "Action $action is invalid." );
+ throw new Exception( "Action $action is invalid." );
}
if ( $reset ) {
@@ -3679,7 +3679,7 @@
* Get payment submethod meta
*
* @param string $payment_submethod Payment submethods are
mapped to paymentproductid
- * @throws MWException
+ * @throws Exception
*/
public function getPaymentSubmethodMeta( $payment_submethod = null ) {
if ( is_null( $payment_submethod ) ) {
@@ -3697,7 +3697,7 @@
return $this->payment_submethods[ $payment_submethod ];
}
else {
- throw new MWException( "The payment submethod [
{$payment_submethod} ] was not found." );
+ throw new Exception( "The payment submethod [
{$payment_submethod} ] was not found." );
}
}
diff --git a/gateway_forms/RapidHtml.php b/gateway_forms/RapidHtml.php
index 7d36154..472b2ea 100644
--- a/gateway_forms/RapidHtml.php
+++ b/gateway_forms/RapidHtml.php
@@ -133,7 +133,7 @@
if ( empty( $this->html_file_path ) ){
try {
$this->set_html_file_path( $ffname );
- } catch ( MWException $mwe ) {
+ } catch ( Exception $mwe ) {
$message = "Could not load form '$ffname'";
$this->gateway->log( $message, LOG_ERR );
$this->set_html_file_path( 'error-noform' );
@@ -436,7 +436,7 @@
* Set the path to the HTML file for a requested rapid html form.
*
* @param string $form_key The array key defining the whitelisted form
path to fetch from $wgDonationInterfaceAllowedHtmlForms
- * @throws MWException
+ * @throws Exception
*/
public function set_html_file_path( $form_key, $fatal = true ) {
$g = $this->gateway;
@@ -497,7 +497,7 @@
if ( $fatal ){
$message = 'Requested an unavailable or
non-existent form.';
$this->gateway->log( $message . ' ' .
$debug_message . ' ' . $this->gateway->getData_Unstaged_Escaped('utm_source') ,
LOG_ERR );
- throw new MWException( $message ); # TODO:
translate
+ throw new Exception( $message ); # TODO:
translate
} else {
return;
}
diff --git a/globalcollect_gateway/globalcollect.adapter.php
b/globalcollect_gateway/globalcollect.adapter.php
index 1a29ece..ed91d66 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1075,7 +1075,7 @@
* - These may need to move to the parent class
*
* @param string $payment_method Payment methods contain
payment submethods
- * @throws MWException
+ * @throws Exception
*/
public function getPaymentMethodMeta( $payment_method ) {
@@ -1085,7 +1085,7 @@
}
else {
$message = 'The payment method [ ' . $payment_method .
' ] was not found.';
- throw new MWException( $message );
+ throw new Exception( $message );
}
}
@@ -1585,7 +1585,7 @@
*
* @param array $data The data array
*
- * @throws MWException
+ * @throws Exception
* @return boolean
*/
public function checkDoBankValidation( &$data ) {
@@ -1629,7 +1629,7 @@
} else {
$message = 'Unknown check result: (' .
$checkResult . ')';
- throw new MWException( $message );
+ throw new Exception( $message );
}
}
diff --git a/globalcollect_gateway/globalcollect_resultswitcher.body.php
b/globalcollect_gateway/globalcollect_resultswitcher.body.php
index f4e8cbf..38bc464 100644
--- a/globalcollect_gateway/globalcollect_resultswitcher.body.php
+++ b/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -150,7 +150,7 @@
$failpage = $this->adapter->getFailPage();
if ( !$failpage ) {
- throw new MWException( __FUNCTION__ . ': No declined
result page defined. Please define a FailPage global for ' .
$this->adapter->getGatewayIdentifier() );
+ throw new Exception( __FUNCTION__ . ': No declined
result page defined. Please define a FailPage global for ' .
$this->adapter->getGatewayIdentifier() );
}
return $failpage;
}
diff --git a/special/GatewayFormChooser.php b/special/GatewayFormChooser.php
index b3ab04e..4b274d0 100644
--- a/special/GatewayFormChooser.php
+++ b/special/GatewayFormChooser.php
@@ -124,7 +124,7 @@
if ( array_key_exists( 'gateway', $params ) &&
in_array( $params['gateway'], $gateway ) ) {
$gateway = $params['gateway'];
} else {
- throw new MWException( __FUNCTION__ . "
Cannot determine appropriate gateway to use for ffname '$form_key'. " );
+ throw new Exception( __FUNCTION__ . "
Cannot determine appropriate gateway to use for ffname '$form_key'. " );
}
}
@@ -506,7 +506,7 @@
}
if ( !sizeof( $error_forms ) ) {
- throw new MWException( __FUNCTION__ . "No error form
found for gateway '$gateway', method '$payment_method', submethod
'$payment_submethod'" );
+ throw new Exception( __FUNCTION__ . "No error form
found for gateway '$gateway', method '$payment_method', submethod
'$payment_submethod'" );
}
//sort the error_forms by $group; get the most specific form
defined
diff --git a/tests/DonationInterfaceTestCase.php
b/tests/DonationInterfaceTestCase.php
index 9d1f355..a955520 100644
--- a/tests/DonationInterfaceTestCase.php
+++ b/tests/DonationInterfaceTestCase.php
@@ -105,7 +105,7 @@
*
* @param string $country The country we want the test user to be from.
* @return array Donor data to use
- * @throws MWException when there is no data available for the
requested country
+ * @throws Exception when there is no data available for the requested
country
*/
public function getDonorTestData( $country = '' ) {
$donortestdata = array (
@@ -220,7 +220,7 @@
$donortestdata['country'] = $country;
return $donortestdata;
}
- throw new MWException( __FUNCTION__ . ": No donor data for
country '$country'" );
+ throw new Exception( __FUNCTION__ . ": No donor data for
country '$country'" );
}
/**
diff --git a/worldpay_gateway/worldpay.adapter.php
b/worldpay_gateway/worldpay.adapter.php
index d214621..a6d4e38 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -999,7 +999,7 @@
}
if ( !$merchantId ) {
- throw new MWException( 'Could not find
account information for ' .
+ throw new Exception( 'Could not find
account information for ' .
"submethod: {$submethod},
country: {$country}, currency: {$currency}." );
} else {
$this->staged_data['wp_merchant_id'] =
$merchantId;
diff --git a/worldpay_gateway/worldpay_gateway.alias.php
b/worldpay_gateway/worldpay_gateway.alias.php
index c5cd9ab..6d83148 100644
--- a/worldpay_gateway/worldpay_gateway.alias.php
+++ b/worldpay_gateway/worldpay_gateway.alias.php
@@ -5,4 +5,4 @@
/** English */
$specialPageAliases['en'] = array(
'WorldPayGateway' => array( 'WorldPayGateway' ),
-);
\ No newline at end of file
+);
--
To view, visit https://gerrit.wikimedia.org/r/184022
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7156e44d0edaf638adf83b31e8bb92a17e39483e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits