r106375 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106374‎ | r106375 | r106376 >
Date:21:29, 15 December 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ContributionTracking (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking.processor.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking_body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking_body.php
@@ -76,7 +76,7 @@
7777
7878 $repost = ContributionTrackingProcessor::getRepostFields( $params );
7979
80 - $wgOut->addWikiText( "{{2009/Donate-banner/$language}}" );
 80+ #$wgOut->addWikiText( "{{2009/Donate-banner/$language}}" );
8181 $wgOut->addHTML( $this->msgWiki( 'contrib-tracking-submitting' ) );
8282
8383 // Output the repost form
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking_body.php
___________________________________________________________________
Modified: svn:mergeinfo
8484 Merged /trunk/extensions/ContributionTracking/ContributionTracking_body.php:r103622,104210,104368,106136,106367
Index: branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking.processor.php
@@ -151,7 +151,7 @@
152152
153153 /**
154154 * Effectively changes the name of a key in an array. If the key does not
155 - * exist, no change is made.
 155+ * exist, no change is made.
156156 * @param array $array The array to rekey (by reference)
157157 * @param string $oldkey The key to change
158158 * @param string $newkey The new value for the key
@@ -169,7 +169,7 @@
170170 * table.
171171 * For these values, if the key exists (and is not explicit false), it is
172172 * received as "true". Therefore, the rekey'd value should be false.
173 - * However, the old key not existing isn't exactly conclusive.
 173+ * However, the old key not existing isn't exactly conclusive.
174174 * @param array $array The array to rekey (by reference)
175175 * @param string $oldkey The key to change
176176 * @param string $invertedkey The key meant to contain the inverted boolean
@@ -255,12 +255,12 @@
256256 'notify_url' => '',
257257 'item_name' => '',
258258 'address1' => '',
259 - 'city' => '',
 259+ 'city' => '',
260260 'state' => '',
261261 'zip' => '',
262262 'country' => 'US',
263263 'address_override' => '0'
264 -
 264+
265265 );
266266 }
267267
@@ -301,7 +301,7 @@
302302 * gateway to complete the transaction.
303303 */
304304 static function getRepostFields( $input ) {
305 - global $wgContributionTrackingPayPalBusiness, $wgContributionTrackingReturnToURLDefault;
 305+ global $wgContributionTrackingPayPalBusiness, $wgContributionTrackingReturnToURLDefault, $wgContributionTrackingRPPLength;
306306 // Set the action and tracking ID fields
307307 $input = ContributionTrackingProcessor::stage_repost( $input );
308308
@@ -331,7 +331,7 @@
332332 if ( $returnTitle ) {
333333 $returnto = wfExpandUrl( $returnTitle->getFullUrl(), PROTO_CURRENT );
334334 } else {
335 - $returnto = $wgContributionTrackingReturnToURLDefault . "/$language";
 335+ $returnto = $wgContributionTrackingReturnToURLDefault . "/$language"; // FIXME: $language is undefined
336336 }
337337 $repost['fields']['return'] = $returnto;
338338 $repost['fields']['currency_code'] = $input['currency_code'];
@@ -378,7 +378,7 @@
379379
380380 $repost['fields']['t3'] = "M"; // The unit of measurement for for p3 (M = month)
381381 $repost['fields']['p3'] = '1'; // Billing cycle duration
382 - $repost['fields']['srt'] = '12'; // # of billing cycles
 382+ $repost['fields']['srt'] = $wgContributionTrackingRPPLength; // # of billing cycles
383383 $repost['fields']['src'] = '1'; // Make this 'recurring'
384384 $repost['fields']['sra'] = '1'; // Turn on re-attempt on failure
385385 $repost['fields']['cmd'] = '_xclick-subscriptions';
@@ -390,7 +390,7 @@
391391 $repost['fields']['notify_url'] = $input['notify_url'];
392392 $repost['fields']['item_name'] = $input['item_name'];
393393 }
394 - } else if ( $input['gateway'] == 'moneybookers' ) {
 394+ } elseif ( $input['gateway'] == 'moneybookers' ) {
395395 $repost['action'] = 'https://www.moneybookers.com/app/payment.pl';
396396
397397 // Tracking
@@ -408,10 +408,12 @@
409409 }
410410
411411 // Normalized amount
412 - $repost['fields'][$amount_field_name] = $input['amount'];
413 - if ( $input['amount_given'] ) {
414 - $repost['fields'][$amount_field_name] = $input['amount_given'];
 412+ $amount = $input['amount'];
 413+ // If amount is not a number, use amount_given
 414+ if ( !( preg_match( '/^\d+(\.(\d+)?)?$/', $amount ) ) && $input['amount_given'] ) {
 415+ $amount = $input['amount_given'];
415416 }
 417+ $repost['fields'][$amount_field_name] = $amount;
416418
417419 // Tracking
418420 $repost['fields']['custom'] = $input['contribution_tracking_id'];
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking.processor.php
___________________________________________________________________
Modified: svn:mergeinfo
419421 Merged /trunk/extensions/ContributionTracking/ContributionTracking.processor.php:r103611,103620,103622,104210,104368,106136,106367
Index: branches/wmf/1.18wmf1/extensions/ContributionTracking/ContributionTracking.php
@@ -12,7 +12,7 @@
1313 $wgExtensionCredits['specialpage'][] = array(
1414 'path' => __FILE__,
1515 'name' => 'ContributionTracking',
16 - 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributionTracking',
 16+ 'url' => 'https://www.mediawiki.org/wiki/Extension:ContributionTracking',
1717 'author' => 'David Strauss',
1818 'descriptionmsg' => 'contributiontracking-desc',
1919 );
@@ -33,7 +33,7 @@
3434
3535 $wgAutoloadClasses['ApiContributionTracking'] = $dir . 'ApiContributionTracking.php';
3636 $wgAutoloadClasses['ContributionTrackingProcessor'] = $dir . 'ContributionTracking.processor.php';
37 -
 37+
3838 //this only works if contribution tracking is inside a mediawiki DB, which typically it isn't.
3939 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efContributionTrackingLoadUpdates';
4040
@@ -75,6 +75,12 @@
7676 */
7777 $wgContributionTrackingPayPalBusiness = 'donations@wikimedia.org';
7878
 79+/**
 80+ * Recurring PayPal subscription Length. Default of 0 is unlimited until canceled
 81+ */
 82+
 83+$wgContributionTrackingRPPLength = '0';
 84+
7985 # Unit tests
8086 $wgHooks['UnitTestsList'][] = 'efContributionTrackingUnitTests';
8187
@@ -109,7 +115,7 @@
110116 } else {
111117 global $wgContributionTrackingDBname;
112118
113 - if($updater->getDB()->getDBName() === $wgContributionTrackingDBname) {
 119+ if( $updater->getDB()->getDBname() === $wgContributionTrackingDBname ) {
114120 $updater->addExtensionTable( 'contribution_tracking', $dir . 'ContributionTracking.sql' );
115121 $updater->addExtensionTable( 'contribution_tracking_owa_ref', $dir . 'ContributionTracking_OWA_ref.sql' );
116122 $updater->addExtensionUpdate( array( 'addField', 'contribution_tracking', 'owa_session',
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionTracking
___________________________________________________________________
Modified: svn:mergeinfo
117123 Merged /trunk/extensions/ContributionTracking:r103611,103620,103622,104210,104368,106136,106367

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103611make sure that we only use amount_given if amount is not a numberkaldari20:23, 18 November 2011
r103620follow-up to r103611, missing semicolonkaldari22:31, 18 November 2011
r103622commenting out outdated banner inclusionkaldari22:49, 18 November 2011
r104210"else if" -> "elseif"reedy00:20, 25 November 2011
r104368Fix wrong method call (getDBname!)...reedy22:55, 27 November 2011
r106136Update a butt-ton of extension about URLs to point to https://www.mediawiki.org/brion23:49, 13 December 2011
r106367adjust billing length of recurring paypal contributions to be configuarable a...jamesur20:56, 15 December 2011

Status & tagging log