function uc_order_update_6010 in Ubercart 6.2
Remove new users' passwords from order data.
File
- uc_order/
uc_order.install, line 837 - Install, update and uninstall functions for the uc_order module.
Code
function uc_order_update_6010(&$sandbox) {
$ret = array();
if (!isset($sandbox['progress'])) {
$sandbox['progress'] = 0;
$sandbox['current_order_id'] = 0;
$sandbox['max'] = db_result(db_query("SELECT COUNT(order_id) FROM {uc_orders} WHERE data LIKE '%%new_user%%'"));
}
$limit = 100;
$result = db_query_range("SELECT order_id, data FROM {uc_orders} WHERE data LIKE '%%new_user%%' AND order_id > %d ORDER BY order_id", $sandbox['current_order_id'], 0, $limit);
while ($order = db_fetch_object($result)) {
$order->data = unserialize($order->data);
if (isset($order->data['new_user']['pass'])) {
unset($order->data['new_user']['pass']);
db_query("UPDATE {uc_orders} SET data = '%s' WHERE order_id = %d", serialize($order->data), $order->order_id);
}
$sandbox['progress']++;
$sandbox['current_order_id'] = $order->order_id;
}
$t = get_t();
$ret[] = array(
'success' => TRUE,
'query' => $t("Removed new users' passwords from order data."),
);
$ret['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max'];
return $ret;
}