From c47b135ff5c4f48a3df14f0d90fdfd26bb220801 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 5 Dec 2012 15:21:31 +0000 Subject: [PATCH] Clear meta key after update. Closes #1911. --- admin/includes/updates/woocommerce-update-2.0.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/includes/updates/woocommerce-update-2.0.php b/admin/includes/updates/woocommerce-update-2.0.php index df4cbc8101c..8040f1a1745 100644 --- a/admin/includes/updates/woocommerce-update-2.0.php +++ b/admin/includes/updates/woocommerce-update-2.0.php @@ -29,8 +29,11 @@ if ( $existing_file_paths ) { $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) ); $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $existing_file_path->meta_value ), $existing_file_path->post_id ) ); + } + // Rename old key + $wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_path_backup' WHERE meta_key = '_file_path'" ); } // Update table primary keys