PluginProbe
Polylang / 2.5
Polylang v2.5
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | uninstall.php +8 -16 2.92.5 View file →
@@ -1,11 +1,8 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { // If uninstall not called from WordPress exit
7 - exit;
4 + exit();
8 5 }
9 6
10 7 /**
11 8 * Manages Polylang uninstallation
@@ -22,13 +19,8 @@
22 19 */
23 20 public function __construct() {
24 21 global $wpdb;
25 22
26 - // Don't do anything except if the constant PLL_REMOVE_ALL_DATA is explicitely defined and true.
27 - if ( ! defined( 'PLL_REMOVE_ALL_DATA' ) || ! PLL_REMOVE_ALL_DATA ) {
28 - return;
29 - }
30 -
31 23 // Check if it is a multisite uninstall - if so, run the uninstall function for each blog id
32 24 if ( is_multisite() ) {
33 25 foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
34 26 switch_to_blog( $blog_id );
@@ -47,14 +39,17 @@
47 39 *
48 40 * @since 0.5
49 41 */
50 42 public function uninstall() {
51 - global $wpdb;
43 + $options = get_option( 'polylang' );
52 44
53 - do_action( 'pll_uninstall' );
45 + if ( empty( $options['uninstall'] ) ) {
46 + return;
47 + }
54 48
55 49 // Suppress data of the old model < 1.2
56 50 // FIXME: to remove when support for v1.1.6 will be dropped
51 + global $wpdb;
57 52 $wpdb->termmeta = $wpdb->prefix . 'termmeta'; // registers the termmeta table in wpdb
58 53
59 54 // Do nothing if the termmeta table does not exists
60 55 if ( count( $wpdb->get_results( "SHOW TABLES LIKE '$wpdb->termmeta'" ) ) ) {
@@ -74,9 +69,9 @@
74 69
75 70 // Delete users options
76 71 foreach ( get_users( array( 'fields' => 'ID' ) ) as $user_id ) {
77 72 delete_user_meta( $user_id, 'pll_filter_content' );
78 - delete_user_meta( $user_id, 'pll_dismissed_notices' ); // Legacy meta.
73 + delete_user_meta( $user_id, 'pll_duplicate_content' );
79 74 foreach ( $languages as $lang ) {
80 75 delete_user_meta( $user_id, 'description_' . $lang->slug );
81 76 }
82 77 }
@@ -117,11 +112,8 @@
117 112 wp_delete_post( $id, true );
118 113 }
119 114
120 115 // Delete all what is related to languages and translations
121 - $term_ids = array();
122 - $tt_ids = array();
123 -
124 116 foreach ( get_terms( $pll_taxonomies, array( 'hide_empty' => false ) ) as $term ) {
125 117 $term_ids[] = (int) $term->term_id;
126 118 $tt_ids[] = (int) $term->term_taxonomy_id;
127 119 }
@@ -141,13 +133,13 @@
141 133 delete_option( 'polylang' );
142 134 delete_option( 'widget_polylang' ); // Automatically created by WP
143 135 delete_option( 'polylang_wpml_strings' ); // Strings registered with icl_register_string
144 136 delete_option( 'polylang_licenses' );
145 - delete_option( 'pll_dismissed_notices' );
146 137
147 138 // Delete transients
148 139 delete_transient( 'pll_languages_list' );
149 140 delete_transient( 'pll_upgrade_1_4' );
141 + delete_transient( 'pll_translated_slugs' );
150 142 }
151 143 }
152 144
153 145 new PLL_Uninstall();