r104791 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104790‎ | r104791 | r104792 >
Date:23:45, 30 November 2011
Author:khorn
Status:ok (Comments)
Tags:
Comment:
Another round of preparatory limbo stomp changes.
- Allows for the whole limbo stomp process to get short-circuited if the limbo queue name is undefined, or false.
- A couple bug fixes in which various overloaded versions of the do_transaction function weren't always returning... anything at all.
- Moved the re-definition of early pending transactions to failed transactions, into a bit of code that will only fire if we are rectifying orphans.
Modified paths:
  • /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphan_adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php
@@ -38,7 +38,7 @@
3939
4040 //Now, actually do the processing.
4141 if ( method_exists( $this, $func ) ) {
42 - $this->{$function_name}();
 42+ $this->{$func}();
4343 } else {
4444 echo "There's no $func in Orphan Rectifying!\n";
4545 die();
Index: trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphan_adapter.php
@@ -100,7 +100,8 @@
101101 // return "NOPE";
102102 // break;
103103 default:
104 - return parent::do_transaction( $transaction );
 104+ $ret = parent::do_transaction( $transaction );
 105+ return $ret;
105106 break;
106107 }
107108 }
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -1049,6 +1049,7 @@
10501050 $this->getStopwatch( __FUNCTION__, true );
10511051 $result = $this->transactionConfirm_CreditCard();
10521052 $this->saveCommunicationStats( __FUNCTION__, $transaction );
 1053+ return $result;
10531054 break;
10541055 default:
10551056 return parent::do_transaction( $transaction );
@@ -1080,14 +1081,14 @@
10811082 } else { //this is an orphan transaction.
10821083 $this->staged_data['order_id'] = $this->staged_data['i_order_id'];
10831084 $is_orphan = true;
 1085+ //have to change this code range: All these are usually "pending" and
 1086+ //that would still be true...
 1087+ //...aside from the fact that if the user has gotten this far, they left
 1088+ //the part where they could add more data.
 1089+ //By now, "incomplete" definitely means "failed" for 0-70.
 1090+ $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'failed', 0, 70 );
10841091 }
10851092
1086 - //have to change this code range: All these are usually "pending" and
1087 - //that would still be true...
1088 - //...aside from the fact that if the user has gotten this far, they left
1089 - //the part where they could add more data.
1090 - //By now, "incomplete" definitely means "failed" for 0-70.
1091 - $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'failed', 0, 70 );
10921093 $status_result = $this->do_transaction( 'GET_ORDERSTATUS' );
10931094
10941095 $cancelflag = false; //this will denote the thing we're trying to do with the donation attempt
@@ -1095,7 +1096,6 @@
10961097 $problemmessage = ''; //to be used in conjunction with the flag.
10971098 $add_antimessage = false; //this tells us if we should add an antimessage when we are done or not.
10981099
1099 -
11001100 if ( $is_orphan ){
11011101 if ( array_key_exists('data', $status_result) ) {
11021102 foreach ( $pull_vars as $theirkey => $ourkey) {
@@ -1195,10 +1195,10 @@
11961196 $problemflag = true;
11971197 $problemmessage = "CANCEL_PAYMENT couldn't communicate properly!";
11981198 }
 1199+ } else {
 1200+ //in case we got wiped out, set the final status to what it was before.
 1201+ $this->setTransactionWMFStatus( $order_status_results );
11991202 }
1200 - //No else. We can't be in here if we've had problems, so the
1201 - //GET_STATUS must have told us no. No action required (in fact,
1202 - //GC will complain if we try to can something at this point).
12031203 }
12041204 }
12051205
@@ -1214,7 +1214,7 @@
12151215 $problemmessage = $this->getData_Raw( 'contribution_tracking_id' ) . ':' . $this->getData_Raw( 'order_id' ) . ' ' . $problemmessage;
12161216 self::log( $problemmessage );
12171217 //hurm. It would be swell if we had a message that told the user we had some kind of internal error.
1218 - return array(
 1218+ $ret = array(
12191219 'status' => false,
12201220 //TODO: appropriate messages.
12211221 'message' => $problemmessage,
@@ -1223,6 +1223,7 @@
12241224 ),
12251225 'action' => $this->getValidationAction(),
12261226 );
 1227+ return $ret;
12271228 }
12281229
12291230 // return something better... if we need to!
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -1529,6 +1529,11 @@
15301530 if ( !$this->getGlobal( 'EnableStomp' ) ){
15311531 return;
15321532 }
 1533+ global $wgLimboStompQueueName;
 1534+ if ( !isset( $wgLimboStompQueueName ) || $wgLimboStompQueueName === false ){
 1535+ return;
 1536+ }
 1537+
15331538 $this->debugarray[] = "Attempting Limbo Stomp Transaction!";
15341539 $hook = 'gwLimboStomp';
15351540
Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
@@ -130,7 +130,7 @@
131131 function sendLimboSTOMP( $transaction ) {
132132 global $wgStompServer, $wgLimboStompQueueName;
133133
134 - $queueName = isset( $wgLimboStompQueueName ) ? $wgLimboStompQueueName : 'test';
 134+ $queueName = isset( $wgLimboStompQueueName ) ? $wgLimboStompQueueName : 'limbo';
135135
136136 // include a library
137137 require_once( "Stomp.php" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r105350MFT r104225, r104471, r104503, r104539, r104588, r104600, r104607, r104648, ...khorn21:12, 6 December 2011
r105351MFT r104225, r104471, r104503, r104539, r104588, r104600, r104607, r104648, ...khorn21:12, 6 December 2011
r105502MFT r103501, r103503, r104648, r104791, r104933khorn00:45, 8 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104503Establishes a 'limbo' queue for data that GlobalCollect is either extremely l...khorn23:12, 28 November 2011
r104539More changes for the 'limbo' queue functionality....khorn03:08, 29 November 2011
r104588r104503, r104539...khorn20:38, 29 November 2011
r104648followup r104503, r104539, r104588...khorn02:54, 30 November 2011

Comments

#Comment by Khorn (WMF) (talk | contribs)   00:00, 1 December 2011

Status & tagging log