| @@ -1,8 +1,5 @@ | ||
| 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 | 4 | exit; |
| 8 | 5 | } |
| @@ -49,9 +46,20 @@ | ||
| 49 | 46 | */ |
| 50 | 47 | public function uninstall() { |
| 51 | 48 | global $wpdb; |
| 52 | 49 | |
| 53 | - do_action( 'pll_uninstall' ); | |
| 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(); | |
| 54 | 62 | |
| 55 | 63 | // Suppress data of the old model < 1.2 |
| 56 | 64 | // FIXME: to remove when support for v1.1.6 will be dropped |
| 57 | 65 | $wpdb->termmeta = $wpdb->prefix . 'termmeta'; // registers the termmeta table in wpdb |