| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired when the plugin is uninstalled. |
| 5 |
* |
| 6 |
* When populating this file, consider the following flow |
| 7 |
* of control: |
| 8 |
* |
| 9 |
* - This method should be static |
| 10 |
* - Check if the $_REQUEST content actually is the plugin name |
| 11 |
* - Run an admin referrer check to make sure it goes through authentication |
| 12 |
* - Verify the output of $_GET makes sense |
| 13 |
* - Repeat with other user roles. Best directly by using the links/query string parameters. |
| 14 |
* - Repeat things for multisite. Once for a single site in the network, once sitewide. |
| 15 |
* |
| 16 |
* This file may be updated more in future version of the Boilerplate; however, this is the |
| 17 |
* general skeleton and outline for how the file should work. |
| 18 |
* |
| 19 |
* For more information, see the following discussion: |
| 20 |
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913 |
| 21 |
* |
| 22 |
* |
| 23 |
* @since 1.0.0 |
| 24 |
* * @package Yatra |
| 25 |
*/ |
| 26 |
|
| 27 |
// If uninstall not called from WordPress, then exit. |
| 28 |
if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 29 |
exit; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
if (!defined('YATRA_REMOVE_ALL_DATA')) { |
| 34 |
|
| 35 |
define('YATRA_REMOVE_ALL_DATA', true); |
| 36 |
} |
| 37 |
|
| 38 |
/* |
| 39 |
* Only remove ALL demo importer data if YATRA_REMOVE_ALL_DATA constant is set to true in user's |
| 40 |
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
| 41 |
* and to ensure only the site owner can perform this action. |
| 42 |
*/ |
| 43 |
if (defined('YATRA_REMOVE_ALL_DATA') && true === YATRA_REMOVE_ALL_DATA && apply_filters('yatra_remove_all_data_on_uninstall', false)) { |
| 44 |
|
| 45 |
global $wpdb, $wp_version; |
| 46 |
|
| 47 |
|
| 48 |
include_once dirname(__FILE__) . '/includes/class-yatra-install.php'; |
| 49 |
|
| 50 |
Yatra_Install::drop_tables(); |
| 51 |
|
| 52 |
} |