You are here

function uc_stripe_update_6202 in Ubercart Stripe 6.2

Move customer IDs from uc_recurring_stripe into account

Return value

string

File

./uc_stripe.install, line 103
Installation file for the uc_stripe module.

Code

function uc_stripe_update_6202(&$sandbox) {
  $ret = array();
  $sandbox['per_run'] = 10;

  // users per run
  if (db_table_exists('uc_recurring_stripe')) {
    if (!isset($sandbox['progress'])) {
      $sandbox['progress'] = 0;
      $sandbox['max'] = db_result(db_query('SELECT COUNT(rfid)
      FROM {uc_recurring_stripe} urs
      WHERE urs.rfid IN (
        SELECT max(sq.rfid) FROM {uc_recurring_stripe} sq WHERE sq.uid=urs.uid AND active=1
     )'));
    }
    $ret = _uc_stripe_move_customer_id($sandbox);
    return $ret;
  }
  return array(
    '#done' => array(
      'success' => TRUE,
      'query' => 'Old uc_recurring_stripe table did not exist, no action taken.',
    ),
  );
}