PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.0.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.0.0
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
← All changes | includes/Upgrade.php +7 -8 1.4.02.0.0 View file →
@@ -7,8 +7,11 @@
7 7 // HPOS: This file uses direct SQL on postmeta for migration/upgrade tasks only.
8 8 // Do NOT use direct SQL for live WooCommerce order data access—use WooCommerce CRUD for HPOS compatibility.
9 9 // All live order data access must use WooCommerce CRUD methods.
10 10
11 +/**
12 + * Upgrade class
13 + */
11 14 class Upgrade {
12 15
13 16 public function run() {
14 17 if ( version_compare( '1.1.0', get_option( 'subscrpt_version' ), '>' ) ) {
@@ -26,10 +29,9 @@
26 29 }
27 30
28 31 public function move_product_meta() {
29 32 global $wpdb;
30 - $product_meta_query = 'SELECT * FROM ' . $wpdb->prefix . "postmeta WHERE meta_key='subscrpt_general'";
31 - $products_meta = $wpdb->get_results( $product_meta_query );
33 + $products_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s", 'subscrpt_general' ) );
32 34 foreach ( $products_meta as $product_meta ) {
33 35 update_post_meta( $product_meta->post_id, '_subscrpt_meta', unserialize( $product_meta->meta_value ) );
34 36 update_post_meta(
35 37 $product_meta->post_id,
@@ -47,13 +49,11 @@
47 49
48 50 public function update_subscription_meta() {
49 51 global $wpdb;
50 52
51 - $subscription_meta_query = 'SELECT * FROM ' . $wpdb->prefix . "postmeta WHERE meta_key='_subscrpt_order_general'";
52 - $subscriptions_meta = $wpdb->get_results( $subscription_meta_query );
53 + $subscriptions_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s", '_subscrpt_order_general' ) );
53 54
54 - $subscription_history_query = 'SELECT * FROM ' . $wpdb->prefix . "postmeta WHERE meta_key='_subscrpt_order_history'";
55 - $histories = $wpdb->get_results( $subscription_history_query );
55 + $histories = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s", '_subscrpt_order_history' ) );
56 56
57 57 foreach ( $subscriptions_meta as $subscription_meta ) {
58 58 $subscription_meta_value = unserialize( $subscription_meta->meta_value );
59 59 $order_item_id = 0;
@@ -127,10 +127,9 @@
127 127 }
128 128
129 129 public function update_comment_meta() {
130 130 global $wpdb;
131 - $query = 'SELECT * FROM ' . $wpdb->prefix . "commentmeta WHERE meta_key='subscrpt_activity'";
132 - $comments_meta = $wpdb->get_results( $query );
131 + $comments_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->commentmeta} WHERE meta_key = %s", 'subscrpt_activity' ) );
133 132 foreach ( $comments_meta as $comment_meta ) {
134 133 update_comment_meta( $comment_meta->comment_id, '_subscrpt_activity', $comment_meta->meta_value );
135 134 delete_comment_meta( $comment_meta->comment_id, 'subscrpt_activity' );
136 135 }