Eileen has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/373975 )
Change subject: Delete 'oneoffs' module ...................................................................... Delete 'oneoffs' module We've been running this sort of thing as db updates in wmf_civicrm Change-Id: I682f113f3eb01c27256a61672dfc15521e5fea61 --- D sites/all/modules/oneoffs/201305_paypal_recurring/SorryRecurringTemplate.php D sites/all/modules/oneoffs/201305_paypal_recurring/sorry_may2013_paypal_recurring.php D sites/all/modules/oneoffs/201305_paypal_recurring/templates/html/sorry_may2013.en.html D sites/all/modules/oneoffs/201305_paypal_recurring/templates/subject/sorry_may2013.en.subject D sites/all/modules/oneoffs/201305_paypal_recurring/templates/txt/sorry_may2013.en.txt D sites/all/modules/oneoffs/oneoffs.drush.inc D sites/all/modules/oneoffs/oneoffs.info D sites/all/modules/oneoffs/oneoffs.module M sites/default/enabled_modules 9 files changed, 0 insertions(+), 207 deletions(-) Approvals: jenkins-bot: Verified Eileen: Looks good to me, approved diff --git a/sites/all/modules/oneoffs/201305_paypal_recurring/SorryRecurringTemplate.php b/sites/all/modules/oneoffs/201305_paypal_recurring/SorryRecurringTemplate.php deleted file mode 100644 index 436cb1a..0000000 --- a/sites/all/modules/oneoffs/201305_paypal_recurring/SorryRecurringTemplate.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -use wmf_communication\AbstractMailingTemplate; - -class SorryRecurringTemplate extends AbstractMailingTemplate { - function getTemplateName() { - return 'sorry_may2013'; - } - - function getTemplateDir() { - return __DIR__ . "/templates"; - } -} diff --git a/sites/all/modules/oneoffs/201305_paypal_recurring/sorry_may2013_paypal_recurring.php b/sites/all/modules/oneoffs/201305_paypal_recurring/sorry_may2013_paypal_recurring.php deleted file mode 100644 index 58befa3..0000000 --- a/sites/all/modules/oneoffs/201305_paypal_recurring/sorry_may2013_paypal_recurring.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php - -use wmf_communication\Job; -use wmf_communication\Recipient; - -/** - * Create a mailing job to apologize for the May 2013 Paypal recurring hole. - * - * See https://mingle.corp.wikimedia.org/projects/fundraiser_2012/cards/986 - */ -function sorry_may2013_paypal_recurring_build_job() { - $dbs = module_invoke( 'wmf_civicrm', 'get_dbs' ); - - // Find all contributions affected by this screwup - $dbs->push( 'civicrm' ); - $result = db_query( " -SELECT - cc.id AS contribution_id, - cc.source AS amount, - cc.receive_date AS date, - cc.contact_id, - ce.email -FROM civicrm_contribution cc -LEFT JOIN civicrm_email ce ON ce.contact_id = cc.contact_id -LEFT JOIN civicrm_address ca ON ca.contact_id = cc.contact_id -LEFT JOIN civicrm_country cco ON ca.country_id = cco.id -WHERE - cc.thankyou_date IS NULL - AND cc.trxn_id LIKE 'RECURRING PAYPAL%' - AND cco.iso_code = 'US' - AND cc.receive_date BETWEEN '2013-02-01' AND '2013-05-01' - AND ce.is_primary -GROUP BY - cc.id -ORDER BY - cc.receive_date ASC -; -" ); - $contributions = $result->fetchAllAssoc( 'contribution_id', PDO::FETCH_ASSOC ); - - if ( !$contributions ) { - drush_print( "No matching records found! Aborting." ); - return; - } - - $byContact = array(); - foreach ( $contributions as $row ) { - $byContact[$row['email']][] = $row; - } - - $dbs->push( 'default' ); - - $job = Job::create( 'SorryRecurringTemplate' ); - - foreach ( $byContact as $contactId => $contributions ) { - Recipient::create( - $job->getId(), - $contributions[0]['contact_id'], - array( - 'contributions' => $contributions, - ) - ); - } - - drush_print( "Built mailing job. Run using 'drush wmf-send-letters {$job->getId()}'" ); -} - -function sorry_may2013_paypal_recurring_mark_thanked() { - $job_ran_date = '2013-08-14 00:00:00'; - - // TODO function Job::getAllRecipientsForStatus or Recipient:getQueued... to do exactly this - $query = db_select( 'wmf_communication_recipient', 'r' ); - $query->join( 'wmf_communication_job', 'j', 'r.job_id = j.id' ); - $query->addField( 'r', 'vars' ); - $query->condition( 'j.template_class', 'SorryRecurringTemplate' ) - ->condition( 'r.status', 'successful' ); - $result = $query->execute(); - - $civi = civicrm_api_classapi(); - - while ( $vars = json_decode( $result->fetchField() ) ) { - foreach ( $vars->contributions as $contribution ) { - $success = $civi->Contribution->Create( array( - 'id' => $contribution->contribution_id, - 'thankyou_date' => $job_ran_date, - - 'version' => '3', - ) ); - if ( !$success ) { - throw new Exception( "Failed to update contribution: " . $civi->errorMsg() ); - } - } - } -} diff --git a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/html/sorry_may2013.en.html b/sites/all/modules/oneoffs/201305_paypal_recurring/templates/html/sorry_may2013.en.html deleted file mode 100644 index 56d9641..0000000 --- a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/html/sorry_may2013.en.html +++ /dev/null @@ -1,31 +0,0 @@ -<p>Dear {{ first_name }},</p> - -<p>Thank you for donating to the Wikimedia Foundation. You are wonderful!</p> - -<p>It's easy to ignore our fundraising banners, and I'm really glad you didn't. This is how Wikipedia pays its bills — people like you giving us money, so we can keep the site freely available for everyone around the world.</p> - -<p>People tell me they donate to Wikipedia because they find it useful, and they trust it because even though it's not perfect, they know it's written for them. Wikipedia isn't meant to advance somebody's PR agenda or push a particular ideology, or to persuade you to believe something that's not true. We aim to tell the truth, and we can do that because of you. The fact that you fund the site keeps us independent and able to deliver what you need and want from Wikipedia. Exactly as it should be.</p> - -<p>You should know: your donation isn't just covering your own costs. The average donor is paying for his or her own use of Wikipedia, plus the costs of hundreds of other people. Your donation keeps Wikipedia available for an ambitious kid in Bangalore who's teaching herself computer programming. A middle-aged homemaker in Vienna who's just been diagnosed with Parkinson's disease. A novelist researching 1850s Britain. A 10-year-old in San Salvador who's just discovered Carl Sagan.</p> - -<p>On behalf of those people, and the half-billion other readers of Wikipedia and its sister sites and projects, I thank you for joining us in our effort to make the sum of all human knowledge available for everyone. Your donation makes the world a better place. Thank you.</p> - -<p><em>Please note that this email will act as a tax receipt for several of your recurring donations to the Wikimedia Foundation. While your donation was still processed monthly via PayPal, the system that generates a tax receipt experienced a glitch that stopped these receipts. If you have any questions about this, please feel free to email the fundraising team via <a href="mailto:don...@wikimedia.org">donate@wikimedia</a>.</em></p> - -<p>Thanks,<br /> -Sue</p> - -<br /> -<p>Sue Gardner<br /> -Executive Director,<br /> -Wikimedia Foundation<br /> -<a href="https://donate.wikimedia.org/">https://donate.wikimedia.org</a></p> - -<p>For your records:<br /> -{% for donation in contributions %} -Your donation on {{ donation.date }} was {{ donation.amount | l10n_currency(locale) }}.<br /> -{% endfor %}</p> - -<p>This letter may serve as a record of your donation. No goods or services were provided, in whole or in part, for this contribution. The Wikimedia Foundation, Inc. is a non-profit charitable corporation with 501(c)(3) tax exempt status in the United States. Our address is 149 New Montgomery, 3rd Floor, San Francisco, CA, 94105. U.S. tax-exempt number: 20-0049703</p> - -<p>You can follow us on Twitter, identi.ca or Google+, like us on Facebook and read our blog. Here is the Wikimedia Foundation annual report for 2010-11, the Wikimedia Foundation annual plan for 2012-13 and the Wikimedia Foundation's five-year strategic plan. You can also now buy Wikipedia merchandise at shop.wikimedia.org.</p> diff --git a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/subject/sorry_may2013.en.subject b/sites/all/modules/oneoffs/201305_paypal_recurring/templates/subject/sorry_may2013.en.subject deleted file mode 100644 index 29c8ee3..0000000 --- a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/subject/sorry_may2013.en.subject +++ /dev/null @@ -1 +0,0 @@ -Thank You from the Wikimedia Foundation diff --git a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/txt/sorry_may2013.en.txt b/sites/all/modules/oneoffs/201305_paypal_recurring/templates/txt/sorry_may2013.en.txt deleted file mode 100644 index 9a72e45..0000000 --- a/sites/all/modules/oneoffs/201305_paypal_recurring/templates/txt/sorry_may2013.en.txt +++ /dev/null @@ -1,31 +0,0 @@ -Dear {{ first_name }}, - -Thank you for donating to the Wikimedia Foundation. You are wonderful! - -It's easy to ignore our fundraising banners, and I'm really glad you didn't. This is how Wikipedia pays its bills --- people like you giving us money, so we can keep the site freely available for everyone around the world. - -People tell me they donate to Wikipedia because they find it useful, and they trust it because even though it's not perfect, they know it's written for them. Wikipedia isn't meant to advance somebody's PR agenda or push a particular ideology, or to persuade you to believe something that's not true. We aim to tell the truth, and we can do that because of you. The fact that you fund the site keeps us independent and able to deliver what you need and want from Wikipedia. Exactly as it should be. - -You should know: your donation isn't just covering your own costs. The average donor is paying for his or her own use of Wikipedia, plus the costs of hundreds of other people. Your donation keeps Wikipedia available for an ambitious kid in Bangalore who's teaching herself computer programming. A middle-aged homemaker in Vienna who's just been diagnosed with Parkinson's disease. A novelist researching 1850s Britain. A 10-year-old in San Salvador who's just discovered Carl Sagan. - -On behalf of those people, and the half-billion other readers of Wikipedia and its sister sites and projects, I thank you for joining us in our effort to make the sum of all human knowledge available for everyone. Your donation makes the world a better place. Thank you. - -Please note that this email will act as a tax receipt for several of your recurring donations to the Wikimedia Foundation. While your donation was still processed monthly via PayPal, the system that generates a tax receipt experienced a glitch that stopped these receipts. If you have any questions about this, please feel free to email the fundraising team via don...@wikimedia.org. - -Thanks, -Sue - -Sue Gardner -Executive Director, -Wikimedia Foundation -https://donate.wikimedia.org - - -For your records: -{% for donation in contributions %} -Your donation on {{ donation.date }} was {{ donation.amount | l10n_currency(locale) }}. -{% endfor %} - -This letter may serve as a record of your donation. No goods or services were provided, in whole or in part, for this contribution. The Wikimedia Foundation, Inc. is a non-profit charitable corporation with 501(c)(3) tax exempt status in the United States. Our address is 149 New Montgomery, 3rd Floor, San Francisco, CA, 94105. U.S. tax-exempt number: 20-0049703 - -You can follow us on Twitter, identi.ca or Google+, like us on Facebook and read our blog. Here is the Wikimedia Foundation annual report for 2010-11, the Wikimedia Foundation annual plan for 2012-13 and the Wikimedia Foundation's five-year strategic plan. You can also now buy Wikipedia merchandise at shop.wikimedia.org. diff --git a/sites/all/modules/oneoffs/oneoffs.drush.inc b/sites/all/modules/oneoffs/oneoffs.drush.inc deleted file mode 100644 index 4397527..0000000 --- a/sites/all/modules/oneoffs/oneoffs.drush.inc +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/** - * Create a mailing job to apologize for the May 2013 Paypal recurring hole. - * - * See https://mingle.corp.wikimedia.org/projects/fundraiser_2012/cards/986 - */ -function oneoffs_drush_command() { - $items = array( - 'oneoffs-sorry-may2013-build-job' => array( - 'description' => 'Compile a list of people affected', - ), - 'oneoffs-sorry-may2013-mark-thanked' => array( - 'description' => 'Mark all email recipients as thank-you\'ed', - ), - ); - - return $items; -} - -function drush_oneoffs_sorry_may2013_build_job() { - require_once '201305_paypal_recurring/sorry_may2013_paypal_recurring.php'; - sorry_may2013_paypal_recurring_build_job(); -} - -function drush_oneoffs_sorry_may2013_mark_thanked() { - require_once '201305_paypal_recurring/sorry_may2013_paypal_recurring.php'; - sorry_may2013_paypal_recurring_mark_thanked(); -} diff --git a/sites/all/modules/oneoffs/oneoffs.info b/sites/all/modules/oneoffs/oneoffs.info deleted file mode 100755 index 053a79e..0000000 --- a/sites/all/modules/oneoffs/oneoffs.info +++ /dev/null @@ -1,6 +0,0 @@ -name = WMF One-offs -description = Single-use scripts which need to run in the Drupal scope -core = 7.x -package = Wikimedia -dependencies[] = wmf_communication -files[] = 201305_paypal_recurring/SorryRecurringTemplate.php diff --git a/sites/all/modules/oneoffs/oneoffs.module b/sites/all/modules/oneoffs/oneoffs.module deleted file mode 100644 index b3d9bbc..0000000 --- a/sites/all/modules/oneoffs/oneoffs.module +++ /dev/null @@ -1 +0,0 @@ -<?php diff --git a/sites/default/enabled_modules b/sites/default/enabled_modules index 533b1ba..168aae4 100644 --- a/sites/default/enabled_modules +++ b/sites/default/enabled_modules @@ -16,7 +16,6 @@ oauth_common oauth_common_providerui offline2civicrm -oneoffs queue2civicrm recurring recurring_globalcollect -- To view, visit https://gerrit.wikimedia.org/r/373975 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I682f113f3eb01c27256a61672dfc15521e5fea61 Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com> Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org> Gerrit-Reviewer: Eileen <emcnaugh...@wikimedia.org> Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org> Gerrit-Reviewer: Mepps <me...@wikimedia.org> Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits