Completed
Push — master ( 3495f4...0c435d )
by Stiofan
18s
created
includes/admin/wpinv-upgrade-functions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
  * @since 1.0.0
12 12
 */
13 13
 function wpinv_automatic_upgrade() {
14
-    $wpi_version = get_option( 'wpinv_version' );
14
+    $wpi_version = get_option('wpinv_version');
15 15
     
16
-    if ( $wpi_version == WPINV_VERSION ) {
16
+    if ($wpi_version == WPINV_VERSION) {
17 17
         return;
18 18
     }
19 19
     
20
-    if ( version_compare( $wpi_version, '0.0.5', '<' ) ) {
20
+    if (version_compare($wpi_version, '0.0.5', '<')) {
21 21
         wpinv_v005_upgrades();
22 22
     }
23 23
     
24
-    update_option( 'wpinv_version', WPINV_VERSION );
24
+    update_option('wpinv_version', WPINV_VERSION);
25 25
 }
26
-add_action( 'admin_init', 'wpinv_automatic_upgrade' );
26
+add_action('admin_init', 'wpinv_automatic_upgrade');
27 27
 
28 28
 function wpinv_v005_upgrades() {
29 29
     global $wpdb;
30 30
     
31 31
     // Invoices status
32
-    $wpdb->query( "UPDATE " . $wpdb->posts . " SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
32
+    $wpdb->query("UPDATE " . $wpdb->posts . " SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
33 33
     
34 34
     // Item meta key changes
35 35
     $query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
36
-    $results = $wpdb->get_results( $query );
36
+    $results = $wpdb->get_results($query);
37 37
     
38
-    if ( !empty( $results ) ) {
39
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
40
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
41
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
38
+    if (!empty($results)) {
39
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )");
40
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'");
41
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'");
42 42
         
43
-        foreach ( $results as $row ) {
44
-            clean_post_cache( $row->post_id );
43
+        foreach ($results as $row) {
44
+            clean_post_cache($row->post_id);
45 45
         }
46 46
     }
47 47
 
Please login to merge, or discard this patch.