PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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 +5 -32 2.7.23.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { // If uninstall not called from WordPress exit
4 7 exit;
5 8 }
@@ -46,33 +49,10 @@
46 49 */
47 50 public function uninstall() {
48 51 global $wpdb;
49 52
50 - // Executes each module's uninstall script, if it exists
51 - $pll_modules_dir = dirname( __FILE__ ) . '/modules';
52 - opendir( $pll_modules_dir );
53 - while ( ( $module = readdir() ) != false ) {
54 - if ( substr( $module, 0, 1 ) !== '.' ) {
55 - $uninstall_script = $pll_modules_dir . '/' . $module . '/uninstall.php';
56 - if ( file_exists( $uninstall_script ) ) {
57 - require $uninstall_script; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
58 - }
59 - }
60 - }
61 - closedir();
53 + do_action( 'pll_uninstall' );
62 54
63 - // Suppress data of the old model < 1.2
64 - // FIXME: to remove when support for v1.1.6 will be dropped
65 - $wpdb->termmeta = $wpdb->prefix . 'termmeta'; // registers the termmeta table in wpdb
66 -
67 - // Do nothing if the termmeta table does not exists
68 - if ( count( $wpdb->get_results( "SHOW TABLES LIKE '$wpdb->termmeta'" ) ) ) {
69 - $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_translations'" );
70 - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_language'" );
71 - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_rtl'" );
72 - $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = '_translations'" );
73 - }
74 -
75 55 // Need to register the taxonomies
76 56 $pll_taxonomies = array( 'language', 'term_language', 'post_translations', 'term_translations' );
77 57 foreach ( $pll_taxonomies as $taxonomy ) {
78 58 register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) );
@@ -103,15 +83,9 @@
103 83 foreach ( $ids as $id ) {
104 84 wp_delete_post( $id, true );
105 85 }
106 86
107 - // Delete the strings translations ( <1.2 )
108 - // FIXME: to remove when support for v1.1.6 will be dropped
109 - foreach ( $languages as $lang ) {
110 - delete_option( 'polylang_mo' . $lang->term_id );
111 - }
112 -
113 - // Delete the strings translations 1.2+
87 + // Delete the strings translations.
114 88 register_post_type( 'polylang_mo', array( 'rewrite' => false, 'query_var' => false ) );
115 89 $ids = get_posts(
116 90 array(
117 91 'post_type' => 'polylang_mo',
@@ -153,9 +127,8 @@
153 127 delete_option( 'pll_dismissed_notices' );
154 128
155 129 // Delete transients
156 130 delete_transient( 'pll_languages_list' );
157 - delete_transient( 'pll_upgrade_1_4' );
158 131 }
159 132 }
160 133
161 134 new PLL_Uninstall();