Mwalker has submitted this change and it was merged.

Change subject: Decouple recurring and one-time queue processing
......................................................................


Decouple recurring and one-time queue processing

Change-Id: I10cd9a092476deb5d2c50ea73d8cbdf70fbffedf
---
M sites/all/modules/queue2civicrm/recurring/recurring.module
A sites/all/modules/queue2civicrm/recurring/recurring_queue_consume.drush.inc
2 files changed, 51 insertions(+), 26 deletions(-)

Approvals:
  Mwalker: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/queue2civicrm/recurring/recurring.module 
b/sites/all/modules/queue2civicrm/recurring/recurring.module
index 0e916d2..714faa2 100644
--- a/sites/all/modules/queue2civicrm/recurring/recurring.module
+++ b/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -32,28 +32,20 @@
  */
 function recurring_settings() {
   $form = array();
- 
-  $form[ 'recurring' ][ 'description' ] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Recurring payments'),
-    '#description' => t('The recurring queue contains notifications pertaining 
to subscription donations, such as monthly payments, cancellation,and 
expiration.'),
-    '#collapsible' => FALSE,
-    '#collapsed' => FALSE,
-  );
 
-  $form['recurring_process'] = array(
-    '#type' => 'radios',
-    '#title' => t('Process recurring transactions during queue consumption'),
-    '#description' => t('If enabled, recurring processing will take place at 
the end of the regular queue2civicrm job.  If disabled, recurring notifications 
must be processed by a dedicated job.'),
-    '#required' => TRUE,
-    '#options' => array(
-      FALSE => t('No'),
-      TRUE => t('Yes'),
-    ),
-    '#default_value' => variable_get('recurring_process', FALSE),
+  $form['recurring_disable'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable job'),
+    '#description' => t('If checked, no message processing will be 
performed.'),
+    '#default_value' => variable_get('recurring_disable', false),
+  );
+ 
+  $form['recurring_description'] = array(
+    '#type' => 'markup',
+    '#markup' => t('<p>The recurring queue contains notifications pertaining 
to subscription donations, such as monthly payments, cancellation,and 
expiration.</p>'),
   );
   
-  $form[ 'recurring' ][ 'recurring_subscription' ] = array(
+  $form['recurring_subscription'] = array(
     '#type' => 'textfield',
     '#title' => t('Subscription path'),
     '#required' => TRUE,
@@ -61,7 +53,7 @@
     '#description' => t( 'Queue to watch for recurring notifications' ),
   );
   
-  $form[ 'recurring' ][ 'recurring_batch' ] = array(
+  $form['recurring_batch'] = array(
     '#type' => 'select',
     '#title' => t('Cron batch size'),
     '#description' => t('Maximum number of items processed by the recurring 
job'),
@@ -86,12 +78,8 @@
   return system_settings_form( $form );
 }
 
-/**
- * Implementation of hook queue2civicrm_batch_process
- * 
- */
-function recurring_queue2civicrm_batch_process() {
-  if (!variable_get( "recurring_process", false )){
+function recurring_batch_process() {
+  if (variable_get( "recurring_disable", false )){
     watchdog('recurring', 'Recurring is disabled. No contributions 
processed.');
     return 0;
   }
diff --git 
a/sites/all/modules/queue2civicrm/recurring/recurring_queue_consume.drush.inc 
b/sites/all/modules/queue2civicrm/recurring/recurring_queue_consume.drush.inc
new file mode 100644
index 0000000..c78aa50
--- /dev/null
+++ 
b/sites/all/modules/queue2civicrm/recurring/recurring_queue_consume.drush.inc
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Implementation of hook_drush_command()
+ */
+function recurring_queue_consume_drush_command() {
+  $items = array();
+
+  $items['recurring-queue-consume'] = array(
+    'description' => 
+      'Consumes items from a specified ActiveMQ queue and processes them into 
CiviCRM',
+    'examples' => array( 'drush recurring-queue-consume' => '# Consume the 
queue' ), 
+    'aliases' => array( 'rqc' ),
+  );
+
+  return $items;
+}
+
+/**
+ * Implementation of hook_drush_help()
+ */
+function recurring_queue_consume_drush_help( $section ) {
+  switch ( $section ) {
+    case 'drush:recurring-queue-consume':
+      return dt( "Pulls recurring items from an ActiveMQ queue and processes 
them into CiviCRM" );
+  }
+}
+
+/**
+ * Fires the 'batch_process' method in the recurring module.
+ *
+ * This simply executes the code necessary to pull and process items from 
+ * a queue.  All configurations happen in the module.
+ */
+function drush_recurring_queue_consume() {
+  module_invoke( 'recurring', 'batch_process' );
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/120742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I10cd9a092476deb5d2c50ea73d8cbdf70fbffedf
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Adamw <awi...@wikimedia.org>
Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org>
Gerrit-Reviewer: Mwalker <mwal...@wikimedia.org>
Gerrit-Reviewer: Ssmith <ssm...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to