PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
jc-importer / uninstall.php

uninstall.php in Import WP – CSV & XML Import Export for WordPress 2.15.0, at uninstall.php

56 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // if uninstall.php is not called by WordPress, die
3
4 use ImportWP\Common\Importer\ImporterManager;
5 use ImportWP\Common\Migration\Migrations;
6 use ImportWP\Container;
7
8 if (!defined('WP_UNINSTALL_PLUGIN')) {
9 die;
10 }
11
12 do_action('iwp/uninstall_plugin');
13
14 // Escape if cleanup has not been enabled.
15 $uninstall_enabled = get_option('iwp_settings');
16 if (!isset($uninstall_enabled['cleanup']) || true !== $uninstall_enabled['cleanup']) {
17 return;
18 }
19
20 $iwp_base_path = dirname(__FILE__);
21 if (file_exists($iwp_base_path . '/importwp-pro.php')) {
22 require_once $iwp_base_path . '/importwp-pro.php';
23 } else {
24 require_once $iwp_base_path . '/jc-importer.php';
25 }
26
27 // 1. Delete all importers, Delete all importer files
28
29 /**
30 * @var ImporterManager $importer_manager
31 */
32 $importer_manager = Container::getInstance()->get('importer_manager');
33 $importers = $importer_manager->get_importers();
34 foreach ($importers as $importer) {
35
36 $files = $importer->getFiles();
37 foreach ($files as $file) {
38 @unlink($file);
39 }
40
41 $importer->delete();
42 }
43
44 // 2. Delete /wp-content/importwp folder
45 require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
46 $fileSystemDirect = new \WP_Filesystem_Direct(false);
47 $upload_dir = wp_upload_dir();
48
49 $fileSystemDirect->rmdir($upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'importwp', true);
50 $fileSystemDirect->rmdir($upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'exportwp', true);
51
52
53 // 3. Uninstall DB
54 $migrations = new Migrations();
55 $migrations->uninstall();
56