PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.7.5
Import WP – CSV & XML Import Export for WordPress v2.7.5
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.7.5, at uninstall.php

51 lines 1.3 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 // Escape if cleanup has not been enabled.
13 $uninstall_enabled = get_option('iwp_settings');
14 if (!isset($uninstall_enabled['cleanup']) || true !== $uninstall_enabled['cleanup']) {
15 return;
16 }
17
18 $iwp_base_path = dirname(__FILE__);
19 if (file_exists($iwp_base_path . '/importwp-pro.php')) {
20 require_once $iwp_base_path . '/importwp-pro.php';
21 } else {
22 require_once $iwp_base_path . '/jc-importer.php';
23 }
24
25 // 1. Delete all importers, Delete all importer files
26
27 /**
28 * @var ImporterManager $importer_manager
29 */
30 $importer_manager = Container::getInstance()->get('importer_manager');
31 $importers = $importer_manager->get_importers();
32 foreach ($importers as $importer) {
33
34 $files = $importer->getFiles();
35 foreach ($files as $file) {
36 @unlink($file);
37 }
38
39 $importer->delete();
40 }
41
42 // 2. Delete /wp-content/importwp folder
43 require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
44 $fileSystemDirect = new \WP_Filesystem_Direct(false);
45 $fileSystemDirect->rmdir(WP_CONTENT_DIR . '/uploads/importwp', true);
46
47
48 // 3. Uninstall DB
49 $migrations = new Migrations();
50 $migrations->uninstall();
51