r104933 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104932‎ | r104933 | r104934 >
Date:01:18, 2 December 2011
Author:khorn
Status:ok
Tags:
Comment:
Splits the limbo queue into Credit Card, and Everything Else.
Modified paths:
  • /trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php (modified) (history)
  • /trunk/extensions/DonationInterface/donationinterface.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/donationinterface.php
@@ -357,6 +357,7 @@
358358 //$wgStompQueueName = ""; //only set this with an actual value. Default is unset.
359359 //$wgPendingStompQueueName = ""; //only set this with an actual value. Default is unset.
360360 //$wgLimboStompQueueName = ""; //only set this with an actual value. Default is unset.
 361+ //$wgCCLimboStompQueueName = ""; //only set this with an actual value. Default is unset.
361362 }
362363
363364 //Extras globals - required for ANY optional class that is considered an "extra".
Index: trunk/extensions/DonationInterface/globalcollect_gateway/scripts/orphans.php
@@ -117,7 +117,7 @@
118118 if ( count( $bucket ) && ( count( $bucket ) >= $count || $ackNow ) ){
119119 //ack now.
120120 $selector = 'JMSCorrelationID IN (' . implode( ", ", $bucket ) . ')';
121 - $ackMe = stompFetchMessages( 'limbo', $selector, $count * 100 ); //This is outrageously high, but I just want to be reasonably sure we get all the matches.
 121+ $ackMe = stompFetchMessages( 'cc-limbo', $selector, $count * 100 ); //This is outrageously high, but I just want to be reasonably sure we get all the matches.
122122 $retrieved_count = count( $ackMe );
123123 if ( $retrieved_count ){
124124 stompAckMessages( $ackMe );
@@ -130,7 +130,7 @@
131131
132132 function handleStompAntiMessages(){
133133 $selector = "antimessage = 'true'";
134 - $antimessages = stompFetchMessages( 'limbo', $selector, 1000 );
 134+ $antimessages = stompFetchMessages( 'cc-limbo', $selector, 1000 );
135135 $count = 0;
136136 while ( count( $antimessages ) ){ //if there's an antimessage, we can ack 'em all right now.
137137 $count += count( $antimessages );
@@ -142,7 +142,7 @@
143143 echo 'The STOMP message ' . $message->headers['message-id'] . ' has no correlation ID!';
144144 }
145145 }
146 - $antimessages = stompFetchMessages( 'limbo', $selector, 1000 );
 146+ $antimessages = stompFetchMessages( 'cc-limbo', $selector, 1000 );
147147 }
148148 $this->addStompCorrelationIDToAckBucket( false, true ); //this just acks everything that's waiting for it.
149149 $this->adapter->log("Found $count antimessages.");
@@ -155,7 +155,7 @@
156156 function getStompOrphans(){
157157 $time_buffer = 60*20; //20 minutes? Sure. Why not?
158158 $selector = "payment_method = 'cc'";
159 - $messages = stompFetchMessages( 'limbo', $selector, 300 );
 159+ $messages = stompFetchMessages( 'cc-limbo', $selector, 300 );
160160 $orphans = array();
161161 foreach ( $messages as $message ){
162162 if ( !array_key_exists('antimessage', $message->headers )
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -1529,9 +1529,17 @@
15301530 if ( !$this->getGlobal( 'EnableStomp' ) ){
15311531 return;
15321532 }
1533 - global $wgLimboStompQueueName;
1534 - if ( !isset( $wgLimboStompQueueName ) || $wgLimboStompQueueName === false ){
1535 - return;
 1533+
 1534+ if ($this->getData_Raw( 'payment_method' ) === 'cc'){
 1535+ global $wgCCLimboStompQueueName;
 1536+ if ( !isset( $wgCCLimboStompQueueName ) || $wgCCLimboStompQueueName === false ){
 1537+ return;
 1538+ }
 1539+ } else {
 1540+ global $wgLimboStompQueueName;
 1541+ if ( !isset( $wgLimboStompQueueName ) || $wgLimboStompQueueName === false ){
 1542+ return;
 1543+ }
15361544 }
15371545
15381546 $this->debugarray[] = "Attempting Limbo Stomp Transaction!";
Index: trunk/extensions/DonationInterface/activemq_stomp/activemq_stomp.php
@@ -128,10 +128,14 @@
129129 * nothing exploded big enough to kill the whole thing.
130130 */
131131 function sendLimboSTOMP( $transaction ) {
132 - global $wgStompServer, $wgLimboStompQueueName;
 132+ global $wgStompServer, $wgLimboStompQueueName, $wgCCLimboStompQueueName;
 133+
 134+ if ( $transaction['payment_method'] === 'cc' ) {
 135+ $queueName = isset( $wgCCLimboStompQueueName ) ? $wgCCLimboStompQueueName : 'cc-limbo';
 136+ } else {
 137+ $queueName = isset( $wgLimboStompQueueName ) ? $wgLimboStompQueueName : 'limbo';
 138+ }
133139
134 - $queueName = isset( $wgLimboStompQueueName ) ? $wgLimboStompQueueName : 'limbo';
135 -
136140 // include a library
137141 require_once( "Stomp.php" );
138142
@@ -244,7 +248,7 @@
245249 * @return array an array of stomp messages, with a count of up to $limit.
246250 */
247251 function stompFetchMessages( $queue, $selector = null, $limit = 50 ){
248 - global $wgStompQueueName, $wgPendingStompQueueName, $wgLimboStompQueueName;
 252+ global $wgStompQueueName, $wgPendingStompQueueName, $wgLimboStompQueueName, $wgCCLimboStompQueueName;
249253
250254 switch($queue){
251255 case 'pending':
@@ -253,6 +257,9 @@
254258 case 'limbo':
255259 $queue = $wgLimboStompQueueName;
256260 break;
 261+ case 'cc-limbo':
 262+ $queue = $wgCCLimboStompQueueName;
 263+ break;
257264 case 'verified':
258265 default:
259266 $queue = $wgStompQueueName;

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

Status & tagging log