Index: ec_address/ec_address.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_address/ec_address.install,v
retrieving revision 1.3.2.6
diff -u -r1.3.2.6 ec_address.install
--- ec_address/ec_address.install	5 Jul 2009 06:39:55 -0000	1.3.2.6
+++ ec_address/ec_address.install	22 Jan 2011 15:21:41 -0000
@@ -68,6 +68,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_address_update_5400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * United Kingdom should use the ISO country code GB (not UK).
  */
 function ec_address_update_5401() {
Index: ec_anon/ec_anon.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_anon/ec_anon.install,v
retrieving revision 1.10.2.22
diff -u -r1.10.2.22 ec_anon.install
--- ec_anon/ec_anon.install	16 Dec 2010 11:55:57 -0000	1.10.2.22
+++ ec_anon/ec_anon.install	22 Jan 2011 15:21:42 -0000
@@ -72,15 +72,105 @@
 }
 
 /**
- * Implementation of hook_update_n().
+ * Implementation of hook_update_last_removed().
  */
-function ec_anon_update_4001() {
-  drupal_install_modules(array('ec_common'));
-  if (!function_exists('ec_anon_policy_list')) {
-    drupal_load('module', 'ec_anon');
+function ec_anon_update_last_removed() {
+  return 4001;
+}
+
+/**
+ * Enable new dependent modules
+ */
+function ec_anon_update_6390() {
+  $ret = array();
+
+  $versions = drupal_get_installed_schema_version('store', FALSE, TRUE);
+  $modules = array('ctools' => t('CTools'), 'views' => t('Views'), 'views_bulk_operations' => t('Views Bulk Operations'), 'rules' => t('Rules'), 'rules_scheduler' => t('Rules Scheduler'), 'ec_common' => t('e-Commerce Common'));
+  $missing_modules = array();
+  foreach ($modules as $module => $description) {
+    if (!isset($versions[$module])) {
+      $missing_modules[] = l($description, 'http://drupal.org/project/' . $module);
+    }
+    elseif (module_exists($module)) {
+      unset($modules[$module]);
+    }
+
   }
-  ec_anon_enable();
-  return array();
+
+  if (!empty($missing_modules)) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('The following dependant modules are missing and must be installed before the e-Commerce can be upgraded := !missing_modules', array('!missing_modules' => implode(', ', $missing_modules))));
+    return $ret;
+  }
+
+  if (!empty($modules)) {
+    drupal_install_modules(array_keys($modules));
+  }
+
+  module_list(TRUE);
+
+  $ret[] = array('success' => TRUE, 'query' => t('The following dependant modules have been enabled:= !missing_modules', array('!missing_modules' => implode(', ', $modules))));
+  
+  return $ret;
+}
+
+/**
+ * Check that the dependent modules have been enabled.
+ */
+function ec_anon_update_6391() {
+  $ret = array();
+  $modules = array('ctools' => t('CTools'), 'views' => t('Views'), 'views_bulk_operations' => t('Views Bulk Operations'), 'rules' => t('Rules'), 'rules_scheduler' => t('Rules Scheduler'), 'ec_common' => t('e-Commerce Common'));
+  
+  $missing_modules = array();
+  
+  foreach ($modules as $module => $description) {
+    if (!module_exists($module)) {
+      $missing_modules[] = $description;
+    }
+  }
+  
+  if (!empty($missing_modules)) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('The following dependant modules had problems being installed and must be installed before the e-Commerce can be upgraded := !missing_modules, However you may want to try running the upgrade again as sometimes this upgrade process doesn\'t detect the installation of new modules.', array('!missing_modules' => implode(', ', $missing_modules))));
+    return $ret;
+  }
+}
+
+/**
+ * Convert all the modules to the new names.
+ */
+function ec_anon_update_6392() {
+  $ret = array();
+  
+  $convert = array(
+    'store' => 'ec_store',
+    'product' => 'ec_product',
+    'address' => 'ec_address',
+    'cart' => 'ec_cart',
+    'donate' => 'ec_donate',
+    'eway' => 'ec_eway',
+    'payment' => 'ec_receipt',
+    'paypal' => 'ec_paypal',
+    'tangible' => 'ec_availability',
+  );
+
+  $modules = array();
+
+  foreach ($convert as $from => $to) {
+    if (($new = db_fetch_array(db_query('SELECT * FROM {system} WHERE name = \'%s\' AND type = \'module\'', $to))) && ($old = db_fetch_array(db_query('SELECT * FROM {system} WHERE name = \'%s\' AND type = \'module\'', $from)))) {
+      db_query("DELETE FROM {system} WHERE name = '%s' AND type = 'module'", $to);
+      db_query("UPDATE {system} SET filename = '%s', name = '%s' WHERE name = '%s' AND type = 'module'", $new['filename'], $new['name'], $from);
+      
+      module_list(TRUE);
+
+      if ($old['schema_version'] >= 0) {
+        $modules[] = $to;
+      }
+    }
+  }
+
+  module_enable($modules);
+  drupal_get_schema(NULL, TRUE);
+
+  return $ret;
 }
 
 /**
Index: ec_availability/ec_availability.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_availability/ec_availability.install,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ec_availability.install
--- ec_availability/ec_availability.install	2 Jul 2009 10:25:40 -0000	1.1.2.1
+++ ec_availability/ec_availability.install	22 Jan 2011 15:21:42 -0000
@@ -46,3 +46,4 @@
   return $schema;
 }
 
+// TODO: Write upgrade from the tangible module
\ No newline at end of file
Index: ec_buynow/ec_buynow.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_buynow/ec_buynow.install,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 ec_buynow.install
--- ec_buynow/ec_buynow.install	18 Oct 2009 14:18:21 -0000	1.1.2.5
+++ ec_buynow/ec_buynow.install	22 Jan 2011 15:21:42 -0000
@@ -49,6 +49,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_buynow_update_5999() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Implementation of hook_update_n().
  *
  * Insert hide_cart_link into ec_product.
Index: ec_cart/ec_cart.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_cart/ec_cart.install,v
retrieving revision 1.2.2.9
diff -u -r1.2.2.9 ec_cart.install
--- ec_cart/ec_cart.install	16 Dec 2010 11:55:57 -0000	1.2.2.9
+++ ec_cart/ec_cart.install	22 Jan 2011 15:21:42 -0000
@@ -84,6 +84,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_cart_update_5400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Implementation of hook_update().
  *
  * Change the the
Index: ec_charge/ec_charge.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_charge/ec_charge.install,v
retrieving revision 1.1.4.17
diff -u -r1.1.4.17 ec_charge.install
--- ec_charge/ec_charge.install	16 Dec 2010 11:55:57 -0000	1.1.4.17
+++ ec_charge/ec_charge.install	22 Jan 2011 15:21:42 -0000
@@ -106,6 +106,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_charge_update_6400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Rename componet to component in all tables and columns.
  */
 function ec_charge_update_6401() {
Index: ec_checkout/ec_checkout.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_checkout/ec_checkout.install,v
retrieving revision 1.3.2.6
diff -u -r1.3.2.6 ec_checkout.install
--- ec_checkout/ec_checkout.install	16 Dec 2010 11:55:57 -0000	1.3.2.6
+++ ec_checkout/ec_checkout.install	22 Jan 2011 15:21:42 -0000
@@ -43,6 +43,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_checkout_update_6400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Enable the ctools module or abort
  */
 function ec_checkout_update_6401() {
Index: ec_common/ec_common.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_common/ec_common.install,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 ec_common.install
--- ec_common/ec_common.install	16 Dec 2010 11:55:58 -0000	1.1.2.2
+++ ec_common/ec_common.install	22 Jan 2011 15:21:42 -0000
@@ -13,6 +13,21 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_common_update_5999() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+  
+  return $ret;
+}
+
+/**
  * Update weight of the system weight for the ec_common module
  */
 function ec_common_update_6400() {
Index: ec_customer/ec_customer.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_customer/ec_customer.install,v
retrieving revision 1.2.2.10
diff -u -r1.2.2.10 ec_customer.install
--- ec_customer/ec_customer.install	16 Dec 2010 11:55:58 -0000	1.2.2.10
+++ ec_customer/ec_customer.install	22 Jan 2011 15:21:42 -0000
@@ -110,6 +110,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_customer_update_6400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Change ecid so that it is a auto incrementing field instead of just an
  * int.
  */
Index: ec_paypal/ec_paypal.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_paypal/ec_paypal.install,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 ec_paypal.install
--- ec_paypal/ec_paypal.install	16 Dec 2010 11:55:58 -0000	1.1.2.6
+++ ec_paypal/ec_paypal.install	22 Jan 2011 15:21:43 -0000
@@ -43,6 +43,19 @@
 }
 
 /**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_paypal_update_6400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
  * Add subscr_id field to store the subscription id
  */
 function ec_paypal_update_6401() {
Index: ec_product/ec_product.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_product/ec_product.install,v
retrieving revision 1.2.2.23
diff -u -r1.2.2.23 ec_product.install
--- ec_product/ec_product.install	16 Dec 2010 11:55:58 -0000	1.2.2.23
+++ ec_product/ec_product.install	22 Jan 2011 15:21:43 -0000
@@ -143,9 +143,24 @@
   }
 }
 
+/**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_product_update_5400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
 function ec_product_update_5401() {
   $schema = ec_product_schema();
-  db_create_table($ret, 'ec_product_ptypes', $schema['ec_product_ptypes']);
+  if (!db_table_exists('ec_product_ptypes')) {
+    db_create_table($ret, 'ec_product_ptypes', $schema['ec_product_ptypes']);
+  }
 
   $ptypes = array(
     array(
@@ -173,7 +188,9 @@
 
 function ec_product_update_5402() {
   $schema = ec_product_schema();
-  db_create_table($ret, 'ec_product_features', $schema['ec_product_features']);
+  if (!db_table_exists('ec_product_features')) {
+    db_create_table($ret, 'ec_product_features', $schema['ec_product_features']);
+  }
 
   $ptypes = array(
     array(
@@ -188,10 +205,13 @@
     ),
   );
 
+  drupal_load('module', 'ec_product');
+
   foreach ($ptypes as $ptype) {
     ec_product_ptypes_save((object)$ptype);
   }
-  ec_product_feature_enable(ec_product_get_types('type', 'tangible'), 'shippable');
+  $record = array('ptype' => 'tangible', 'ftype' => 'shippable');
+  drupal_write_record('ec_product_features', $record);
   return $ret;
 }
 
Index: ec_receipt/ec_receipt.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_receipt/ec_receipt.install,v
retrieving revision 1.2.2.17
diff -u -r1.2.2.17 ec_receipt.install
--- ec_receipt/ec_receipt.install	5 Jan 2011 23:20:42 -0000	1.2.2.17
+++ ec_receipt/ec_receipt.install	22 Jan 2011 15:21:44 -0000
@@ -317,6 +317,144 @@
   return $a->name;
 }
 
+/**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_receipt_update_0() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }
+}
+
+/**
+ * Implementations of hook_update_x()
+ */
+function ec_receipt_update_1() {
+  $ret = array();
+
+  db_create_table($ret, 'ec_receipt_allocation', array(
+    'description' => t('eCommerce Receipt Allocations'),
+    'fields' => array(
+      'eaid' => array(
+        'description' => t('Allocation Id'),
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'erid' => array(
+        'description' => t('Receipt Id'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'type' => array(
+        'description' => t('Type of Allocation'),
+        'type' => 'varchar',
+        'length' => '32',
+        'not null' => TRUE,
+      ),
+      'etid' => array(
+        'description' => t('Transaction Id'),
+        'type' => 'varchar',
+        'length' => '32',
+        'not null' => TRUE,
+      ),
+      'created' => array(
+        'description' => t('Date Created'),
+        'type' => 'int',
+        'not null' => TRUE,
+      ),
+      'amount' => array(
+        'description' => t('Allocation Amount'),
+        'type' => 'numeric',
+        'not null' => TRUE,
+        'precision' => '10',
+        'scale' => '2',
+      ),
+    ),
+    'primary key' => array('eaid'),
+    'indexes' => array(
+      'erid' => array('erid'),
+      'type' => array('type', 'etid'),
+    ),
+  ));
+
+  return $ret;
+}
+
+function ec_receipt_update_2() {
+  $ret = array();
+
+  db_change_field($ret, 'ec_receipt', 'erid', 'erid', array(
+    'description' => t('Receipt Id'),
+    'type' => 'serial',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+  ));
+
+  return $ret;
+}
+
+/**
+ * Add Allocated and Balance fields
+ */
+function ec_receipt_update_3() {
+  $ret = array();
+
+  db_add_field($ret, 'ec_receipt', 'allocated', array(
+    'description' => t('Allocation Amount'),
+    'type' => 'numeric',
+    'not null' => TRUE,
+    'precision' => '10',
+    'scale' => '2',
+  ));
+  db_add_field($ret, 'ec_receipt', 'balance', array(
+    'description' => t('Receipt Balance'),
+    'type' => 'numeric',
+    'not null' => TRUE,
+    'precision' => '10',
+    'scale' => '2',
+  ));
+
+  return $ret;
+}
+
+/**
+ * Add Allocated and Balance fields
+ */
+function ec_receipt_update_4() {
+  $ret = array();
+
+  $result = db_query('SELECT er.erid, er.amount, IFNULL(SUM(era.amount), 0) AS allocated, IFNULL(er.amount - SUM(era.amount), er.amount ) AS balance FROM {ec_receipt} er LEFT JOIN {ec_receipt_allocation} era ON er.erid = era.erid GROUP BY er.erid');
+  while ($row = db_fetch_object($result)) {
+    $ret[] = update_sql('UPDATE {ec_receipt} SET allocated = '. $row->allocated .', balance = '. $row->balance .' WHERE erid = '. $row->erid);
+  }
+
+  return $ret;
+}
+
+/**
+ * Add Allocated and Balance fields
+ */
+function ec_receipt_update_5() {
+  $ret = array();
+
+  db_add_field($ret, 'ec_receipt_allocation', 'reversed', array(
+    'description' => t('Allocation Reversed'),
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+    'default' => 0,
+  ));
+
+  return $ret;
+}
+
+
 function ec_receipt_update_6401() {
   $ret = array();
 
Index: ec_store/ec_store.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_store/ec_store.install,v
retrieving revision 1.2.2.31
diff -u -r1.2.2.31 ec_store.install
--- ec_store/ec_store.install	16 Dec 2010 11:55:58 -0000	1.2.2.31
+++ ec_store/ec_store.install	22 Jan 2011 15:21:45 -0000
@@ -507,22 +507,39 @@
  * All incremental database updates performed between Drupal releases.
  */
 
+/**
+ * Check that the ec_anon updates have past 6400
+ */
+function ec_store_update_5400() {
+  $ret = array();
+  $version = drupal_get_installed_schema_version('ec_anon', TRUE);
+  
+  if ($version < 6400) {
+    $ret['#abort'] = array('success' => FALSE, 'query' => t('Waiting until eC Anonymous has completed the initial upgrade'));
+    return $ret;
+  }  
+  return $ret;
+}
+
 function ec_store_update_5401() {
+  $ret = array();
+  
   module_rebuild_cache();
   drupal_install_modules(array('ec_customer'));
+  drupal_get_schema(NULL, TRUE);
   drupal_load('module', 'ec_customer');
   $ret[] = update_sql('ALTER TABLE {ec_transaction} ADD ecid INT UNSIGNED NOT NULL AFTER uid');
   $ret[] = update_sql('ALTER TABLE {ec_transaction} ADD INDEX (ecid)');
+
   return $ret;
 }
 
-function ec_store_update_5402() {
-  if (!isset($_SESSION['store_update_5402_count'])) {
-    $_SESSION['store_update_5402_count'] = 0;
-    $_SESSION['store_update_5402_total'] =  db_result(db_query('SELECT COUNT(*) FROM {ec_transaction} WHERE uid > 0 AND ecid = 0 GROUP BY uid'));
-    // Return query info
-    $ret['#finished'] = 0;
-    return $ret;
+function ec_store_update_5402(&$sandbox) {
+  $ret = array();
+  
+  if (!isset($sandbox['count'])) {
+    $sandbox['count'] = 0;
+    $sandbox['total'] =  db_result(db_query('SELECT COUNT(*) FROM {ec_transaction} WHERE uid > 0 AND ecid = 0 GROUP BY uid'));
   }
 
   // Do work.
@@ -530,8 +547,10 @@
   $result = db_query('SELECT uid FROM {ec_transaction} WHERE uid > 0 AND ecid = 0 GROUP BY uid');
   while (($txn = db_fetch_object($result))) {
     $customer = ec_customer_get_customer(array('type' => 'user', 'exid' => $txn->uid));
+    $ret[] = array('success' => TRUE, 'query' => print_r($customer, TRUE));
     if (empty($customer->ecid)) {
       $customer = ec_customer_insert($customer);
+      $ret[] = array('success' => TRUE, 'query' => print_r($customer, TRUE));
     }
     $ret[] = update_sql('UPDATE {ec_transaction} SET ecid = ' . $customer->ecid . ' WHERE uid = '. $txn->uid);
     ++$count;
@@ -539,29 +558,24 @@
       break;
     }
   }
-  $_SESSION['store_update_5402_count'] += $count;
+  $sandbox['count'] += $count;
 
   // See if we are done.
-  if ($_SESSION['store_update_5402_count'] < $_SESSION['store_update_5402_total']) {
+  if ($sandbox['count'] < $sandbox['total']) {
     // Not done yet. Return the progress.
-    return array('#finished' => $_SESSION['store_update_5402_count'] / $_SESSION['store_update_5402_total']);
+    return array('#finished' => $sandbox['count'] / $sandbox['total']);
   }
   else {
     // Done. Clean up and indicate we're finished.
     $ret['#finished'] = 1;
-    unset($_SESSION['store_update_5402_count']);
-    unset($_SESSION['store_update_5402_total']);
     return $ret;
   }
 }
 
 function ec_store_update_5403() {
-  if (!isset($_SESSION['store_update_5403_count'])) {
-    $_SESSION['store_update_5403_count'] = 0;
-    $_SESSION['store_update_5403_total'] = db_result(db_query('SELECT COUNT(*) FROM {ec_transaction} WHERE uid > 0 AND ecid = 0 GROUP BY uid'));
-    // Return query info
-    $ret['#finished'] = 0;
-    return $ret;
+  if (!isset($sandbox['count'])) {
+    $sandbox['count'] = 0;
+    $sandbox['total'] = db_result(db_query('SELECT COUNT(*) FROM {ec_transaction} WHERE uid > 0 AND ecid = 0 GROUP BY uid'));
   }
 
   // Do work.
@@ -579,18 +593,16 @@
       break;
     }
   }
-  $_SESSION['store_update_5403_count'] += $count;
+  $sandbox['count'] += $count;
 
   // See if we are done.
-  if ($_SESSION['store_update_5403_count'] < $_SESSION['store_update_5403_total'] && $count > 0) {
+  if ($sandbox['count'] < $sandbox['total'] && $count > 0) {
     // Not done yet. Return the progress.
-    return array('#finished' => $_SESSION['store_update_5403_count'] / $_SESSION['store_update_5403_total']);
+    return array('#finished' => $sandbox['count'] / $sandbox['total']);
   }
   else {
     // Done. Clean up and indicate we're finished.
     $ret['#finished'] = 1;
-    unset($_SESSION['store_update_5403_count']);
-    unset($_SESSION['store_update_5403_total']);
     return $ret;
   }
 }
