| @@ -51,20 +51,8 @@ | ||
| 51 | 51 | global $wpdb; |
| 52 | 52 | |
| 53 | 53 | do_action( 'pll_uninstall' ); |
| 54 | 54 | |
| 55 | - // Suppress data of the old model < 1.2 | |
| 56 | - // FIXME: to remove when support for v1.1.6 will be dropped | |
| 57 | - $wpdb->termmeta = $wpdb->prefix . 'termmeta'; // registers the termmeta table in wpdb | |
| 58 | - | |
| 59 | - // Do nothing if the termmeta table does not exists | |
| 60 | - if ( count( $wpdb->get_results( "SHOW TABLES LIKE '$wpdb->termmeta'" ) ) ) { | |
| 61 | - $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_translations'" ); | |
| 62 | - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_language'" ); | |
| 63 | - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_rtl'" ); | |
| 64 | - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_translations'" ); | |
| 65 | - } | |
| 66 | - | |
| 67 | 55 | // Need to register the taxonomies |
| 68 | 56 | $pll_taxonomies = array( 'language', 'term_language', 'post_translations', 'term_translations' ); |
| 69 | 57 | foreach ( $pll_taxonomies as $taxonomy ) { |
| 70 | 58 | register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) ); |
| @@ -69,9 +57,9 @@ | ||
| 69 | 57 | foreach ( $pll_taxonomies as $taxonomy ) { |
| 70 | 58 | register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) ); |
| 71 | 59 | } |
| 72 | 60 | |
| 73 | - $languages = get_terms( 'language', array( 'hide_empty' => false ) ); | |
| 61 | + $languages = get_terms( array( 'taxonomy' => 'language', 'hide_empty' => false ) ); | |
| 74 | 62 | |
| 75 | 63 | // Delete users options |
| 76 | 64 | foreach ( get_users( array( 'fields' => 'ID' ) ) as $user_id ) { |
| 77 | 65 | delete_user_meta( $user_id, 'pll_filter_content' ); |
| @@ -95,15 +83,9 @@ | ||
| 95 | 83 | foreach ( $ids as $id ) { |
| 96 | 84 | wp_delete_post( $id, true ); |
| 97 | 85 | } |
| 98 | 86 | |
| 99 | - // Delete the strings translations ( <1.2 ) | |
| 100 | - // FIXME: to remove when support for v1.1.6 will be dropped | |
| 101 | - foreach ( $languages as $lang ) { | |
| 102 | - delete_option( 'polylang_mo' . $lang->term_id ); | |
| 103 | - } | |
| 104 | - | |
| 105 | - // Delete the strings translations 1.2+ | |
| 87 | + // Delete the strings translations. | |
| 106 | 88 | register_post_type( 'polylang_mo', array( 'rewrite' => false, 'query_var' => false ) ); |
| 107 | 89 | $ids = get_posts( |
| 108 | 90 | array( |
| 109 | 91 | 'post_type' => 'polylang_mo', |
| @@ -120,9 +102,9 @@ | ||
| 120 | 102 | // Delete all what is related to languages and translations |
| 121 | 103 | $term_ids = array(); |
| 122 | 104 | $tt_ids = array(); |
| 123 | 105 | |
| 124 | - foreach ( get_terms( $pll_taxonomies, array( 'hide_empty' => false ) ) as $term ) { | |
| 106 | + foreach ( get_terms( array( 'taxonomy' => $pll_taxonomies, 'hide_empty' => false ) ) as $term ) { | |
| 125 | 107 | $term_ids[] = (int) $term->term_id; |
| 126 | 108 | $tt_ids[] = (int) $term->term_taxonomy_id; |
| 127 | 109 | } |
| 128 | 110 | |
| @@ -145,9 +127,8 @@ | ||
| 145 | 127 | delete_option( 'pll_dismissed_notices' ); |
| 146 | 128 | |
| 147 | 129 | // Delete transients |
| 148 | 130 | delete_transient( 'pll_languages_list' ); |
| 149 | - delete_transient( 'pll_upgrade_1_4' ); | |
| 150 | 131 | } |
| 151 | 132 | } |
| 152 | 133 | |
| 153 | 134 | new PLL_Uninstall(); |