function uc_cart_update_6201 in Ubercart 6.2
Add index to uc_cart_products.cart_id.
File
- uc_cart/
uc_cart.install, line 155 - Install hooks for uc_cart.module.
Code
function uc_cart_update_6201() {
$ret = array();
db_add_index($ret, 'uc_cart_products', 'cart_id', array(
'cart_id',
));
// Remove unnecessary error message that would occur for new installs.
$mysql_error = check_plain("Duplicate key name 'cart_id'");
$pg_error = check_plain('relation "uc_cart_products_cart_id_idx" already exists');
$pg_error2 = check_plain('query: CREATE INDEX uc_cart_products_cart_id_idx ON uc_cart_products (cart_id)');
$errors = $_SESSION['messages']['error'];
$total = count($errors);
for ($i = 0; $i < $total; $i++) {
if (strpos($errors[$i], $mysql_error) || strpos($errors[$i], $pg_error) || strpos($errors[$i], $pg_error2)) {
unset($_SESSION['messages']['error'][$i]);
$ret[0]['success'] = TRUE;
}
}
if (empty($_SESSION['messages']['error'])) {
unset($_SESSION['messages']['error']);
}
return $ret;
}