| 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 |
* @link https://ays-pro.com/ |
| 23 |
* @since 1.0.0 |
| 24 |
* |
| 25 |
* @package Survey_Maker |
| 26 |
*/ |
| 27 |
|
| 28 |
// If uninstall not called from WordPress, then exit. |
| 29 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 30 |
exit; |
| 31 |
} |
| 32 |
|
| 33 |
if( get_option('ays_survey_maker_upgrade_plugin','false') === 'false' ){ |
| 34 |
global $wpdb; |
| 35 |
|
| 36 |
$surveys_table = esc_sql( $wpdb->prefix . 'ayssurvey_surveys' ); |
| 37 |
$questions_table = esc_sql( $wpdb->prefix . 'ayssurvey_questions' ); |
| 38 |
$sections_table = esc_sql( $wpdb->prefix . 'ayssurvey_sections' ); |
| 39 |
$survey_categories_table = esc_sql( $wpdb->prefix . 'ayssurvey_survey_categories' ); |
| 40 |
$question_categories_table = esc_sql( $wpdb->prefix . 'ayssurvey_question_categories' ); |
| 41 |
$answers_table = esc_sql( $wpdb->prefix . 'ayssurvey_answers' ); |
| 42 |
$submissions_table = esc_sql( $wpdb->prefix . 'ayssurvey_submissions' ); |
| 43 |
$submissions_questions_table = esc_sql( $wpdb->prefix . 'ayssurvey_submissions_questions' ); |
| 44 |
$settings_table = esc_sql( $wpdb->prefix . 'ayssurvey_settings' ); |
| 45 |
|
| 46 |
$wpdb->query("DROP TABLE IF EXISTS `".$surveys_table."`"); |
| 47 |
$wpdb->query("DROP TABLE IF EXISTS `".$questions_table."`"); |
| 48 |
$wpdb->query("DROP TABLE IF EXISTS `".$sections_table."`"); |
| 49 |
$wpdb->query("DROP TABLE IF EXISTS `".$survey_categories_table."`"); |
| 50 |
$wpdb->query("DROP TABLE IF EXISTS `".$question_categories_table."`"); |
| 51 |
$wpdb->query("DROP TABLE IF EXISTS `".$answers_table."`"); |
| 52 |
$wpdb->query("DROP TABLE IF EXISTS `".$submissions_table."`"); |
| 53 |
$wpdb->query("DROP TABLE IF EXISTS `".$submissions_questions_table."`"); |
| 54 |
$wpdb->query("DROP TABLE IF EXISTS `".$settings_table."`"); |
| 55 |
|
| 56 |
delete_option( "ays_survey_db_version"); |
| 57 |
delete_option( "ays_survey_maker_upgrade_plugin"); |
| 58 |
} |
| 59 |
|