wpvivid-backuprestore
Last commit date
admin
3 years ago
includes
3 years ago
languages
4 years ago
vendor
3 years ago
index.php
7 years ago
readme.txt
3 years ago
uninstall.php
4 years ago
wpvivid-backuprestore.php
3 years ago
uninstall.php
103 lines
| 1 | <?php |
| 2 | |
| 3 | // If uninstall not called from WordPress, then exit. |
| 4 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 5 | exit; |
| 6 | } |
| 7 | |
| 8 | function wpvivid_clear_free_dir($directory){ |
| 9 | if(file_exists($directory)){ |
| 10 | if($dir_handle=@opendir($directory)){ |
| 11 | while($filename=readdir($dir_handle)){ |
| 12 | if($filename!='.' && $filename!='..'){ |
| 13 | $subFile=$directory."/".$filename; |
| 14 | if(is_dir($subFile)){ |
| 15 | wpvivid_clear_free_dir($subFile); |
| 16 | } |
| 17 | if(is_file($subFile)){ |
| 18 | unlink($subFile); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | closedir($dir_handle); |
| 23 | rmdir($directory); |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | $wpvivid_common_setting = get_option('wpvivid_common_setting', array()); |
| 29 | if(!empty($wpvivid_common_setting)){ |
| 30 | if(isset($wpvivid_common_setting['uninstall_clear_folder']) && $wpvivid_common_setting['uninstall_clear_folder']){ |
| 31 | $wpvivid_local_setting = get_option('wpvivid_local_setting', array()); |
| 32 | if(isset($wpvivid_local_setting['path'])){ |
| 33 | if($wpvivid_local_setting['path'] !== 'wpvividbackups'){ |
| 34 | wpvivid_clear_free_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.'wpvividbackups'); |
| 35 | } |
| 36 | wpvivid_clear_free_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$wpvivid_local_setting['path']); |
| 37 | } |
| 38 | else{ |
| 39 | wpvivid_clear_free_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.'wpvividbackups'); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | delete_option('wpvivid_schedule_setting'); |
| 45 | delete_option('wpvivid_email_setting'); |
| 46 | delete_option('wpvivid_compress_setting'); |
| 47 | delete_option('wpvivid_local_setting'); |
| 48 | delete_option('wpvivid_upload_setting'); |
| 49 | delete_option('wpvivid_common_setting'); |
| 50 | delete_option('wpvivid_backup_list'); |
| 51 | delete_option('wpvivid_task_list'); |
| 52 | delete_option('wpvivid_init'); |
| 53 | delete_option('wpvivid_remote_init'); |
| 54 | delete_option('wpvivid_last_msg'); |
| 55 | delete_option('wpvivid_download_cache'); |
| 56 | delete_option('wpvivid_download_task'); |
| 57 | delete_option('wpvivid_user_history'); |
| 58 | delete_option('wpvivid_saved_api_token'); |
| 59 | delete_option('wpvivid_import_list_cache'); |
| 60 | delete_option('wpvivid_importer_task_list'); |
| 61 | delete_option('wpvivid_list_cache'); |
| 62 | delete_option('wpvivid_exporter_task_list'); |
| 63 | delete_option('wpvivid_need_review'); |
| 64 | delete_option('wpvivid_review_msg'); |
| 65 | delete_option('wpvivid_migrate_status'); |
| 66 | delete_option('clean_task'); |
| 67 | delete_option('cron_backup_count'); |
| 68 | delete_option('wpvivid_backup_success_count'); |
| 69 | delete_option('wpvivid_backup_error_array'); |
| 70 | delete_option('wpvivid_amazons3_notice'); |
| 71 | delete_option('wpvivid_hide_mwp_tab_page_v1'); |
| 72 | delete_option('wpvivid_hide_wp_cron_notice'); |
| 73 | delete_option('wpvivid_transfer_error_array'); |
| 74 | delete_option('wpvivid_transfer_success_count'); |
| 75 | delete_option('wpvivid_api_token'); |
| 76 | delete_option('wpvivid_download_task_v2'); |
| 77 | delete_option('wpvivid_export_list'); |
| 78 | delete_option('wpvivid_backup_report'); |
| 79 | |
| 80 | $options=get_option('wpvivid_staging_options',array()); |
| 81 | $staging_keep_setting=isset($options['staging_keep_setting']) ? $options['staging_keep_setting'] : true; |
| 82 | if($staging_keep_setting) |
| 83 | { |
| 84 | |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | delete_option('wpvivid_staging_task_list'); |
| 89 | delete_option('wpvivid_staging_task_cancel'); |
| 90 | delete_option('wpvivid_staging_options'); |
| 91 | delete_option('wpvivid_staging_history'); |
| 92 | delete_option('wpvivid_staging_list'); |
| 93 | } |
| 94 | |
| 95 | define('WPVIVID_MAIN_SCHEDULE_EVENT','wpvivid_main_schedule_event'); |
| 96 | |
| 97 | if(wp_get_schedule(WPVIVID_MAIN_SCHEDULE_EVENT)) |
| 98 | { |
| 99 | wp_clear_scheduled_hook(WPVIVID_MAIN_SCHEDULE_EVENT); |
| 100 | $timestamp = wp_next_scheduled(WPVIVID_MAIN_SCHEDULE_EVENT); |
| 101 | wp_unschedule_event($timestamp,WPVIVID_MAIN_SCHEDULE_EVENT); |
| 102 | } |
| 103 |