wp-staging
Last commit date
Backend
2 years ago
Backup
2 years ago
Basic
2 years ago
Core
2 years ago
Duplicator
2 years ago
Framework
2 years ago
Frontend
2 years ago
assets
2 years ago
languages
3 years ago
vendor_wpstg
2 years ago
Deactivate.php
2 years ago
README.md
3 years ago
SECURITY.md
2 years ago
autoloader.php
3 years ago
bootstrap.php
2 years ago
constantsFree.php
2 years ago
freeBootstrap.php
2 years ago
install.php
2 years ago
opcacheBootstrap.php
2 years ago
readme.txt
2 years ago
runtimeRequirements.php
2 years ago
uninstall.php
2 years ago
wp-staging-error-handler.php
3 years ago
wp-staging.php
2 years ago
uninstall.php
141 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Backend; |
| 4 | |
| 5 | use WPStaging\Backup\BackupScheduler; |
| 6 | |
| 7 | /** |
| 8 | * Uninstall WP-Staging |
| 9 | * |
| 10 | * @package WPSTG |
| 11 | * @subpackage Uninstall |
| 12 | * @copyright Copyright (c) 2015, René Hermenau |
| 13 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 14 | * @since 0.9.0 |
| 15 | */ |
| 16 | // No direct access |
| 17 | if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 18 | exit; |
| 19 | } |
| 20 | |
| 21 | class uninstall |
| 22 | { |
| 23 | public function __construct() |
| 24 | { |
| 25 | $this->init(); |
| 26 | } |
| 27 | |
| 28 | private function init() |
| 29 | { |
| 30 | $options = json_decode(json_encode(get_option("wpstg_settings", []))); |
| 31 | |
| 32 | /** |
| 33 | * @todo Write a query that delete all the options from option table where option_name like (wpstg_* or wpstgpro_*) |
| 34 | * but not in (wpstg_existing_clones, wpstg_existing_clones_beta, wpstg_staging_sites, wpstg_connection) |
| 35 | * but there will be not need of this condition once we add a routine that deletes staging sites |
| 36 | */ |
| 37 | if (isset($options->unInstallOnDelete) && $options->unInstallOnDelete === '1') { |
| 38 | // Options |
| 39 | delete_option("wpstg_version_upgraded_from"); |
| 40 | delete_option("wpstg_version"); |
| 41 | delete_transient("wpstg_login_link_settings"); |
| 42 | delete_option("wpstgpro_version_upgraded_from"); |
| 43 | delete_option("wpstgpro_version"); |
| 44 | // @see \WPStaging\Backend\Pro\Upgrade\Upgrade::OPTION_UPGRADE_DATE |
| 45 | delete_option("wpstgpro_upgrade_date"); |
| 46 | // @see \WPStaging\Backend\Upgrade\Upgrade::OPTION_UPGRADE_DATE |
| 47 | delete_option("wpstg_free_upgrade_date"); |
| 48 | delete_option("wpstg_installDate"); // @deprecated |
| 49 | // @see \WPStaging\Backend\Upgrade\Upgrade::OPTION_INSTALL_DATE |
| 50 | delete_option("wpstg_free_install_date"); |
| 51 | // @see \WPStaging\Backend\Pro\Upgrade\Upgrade::OPTION_INSTALL_DATE |
| 52 | delete_option("wpstgpro_install_date"); |
| 53 | delete_option("wpstg_firsttime"); // @deprecated |
| 54 | delete_option("wpstg_is_staging_site"); |
| 55 | delete_option("wpstg_settings"); |
| 56 | delete_option("wpstg_rmpermalinks_executed"); |
| 57 | delete_option("wpstg_activation_redirect"); |
| 58 | delete_option("wpstg_disabled_items_notice"); // @deprecated |
| 59 | delete_option("wpstg_clone_settings"); |
| 60 | delete_option("wpstg_clone_excluded_files_list"); |
| 61 | delete_option("wpstg_different_prefix_backup_notice"); |
| 62 | /* @see \WPStaging\Pro\Notices\EntireNetworkCloneServerConfigNotice::OPTION_NAME */ |
| 63 | delete_option("wpstg_entire_network_clone_notice"); |
| 64 | // Old notice used for display cache on staging site. |
| 65 | delete_option("wpstg_disabled_cache_notice"); // @deprecated |
| 66 | // Old option, now moved inside wpstg_clone_settings |
| 67 | delete_option("wpstg_emails_disabled"); // @deprecated |
| 68 | delete_option("wpstg_disabled_mail_notice"); // @deprecated |
| 69 | // Option related to staging sites shifting from one db option to another |
| 70 | delete_option("wpstg_structure_updated"); // @deprecated |
| 71 | // Store the latest WP STAGING PRO version |
| 72 | delete_option("wpstg_version_latest"); |
| 73 | // Option that hold the old snapshots |
| 74 | delete_option("wpstg_snapshots"); // @deprecated |
| 75 | delete_option("wpstg_access_token"); |
| 76 | delete_option("wpstg_backups"); |
| 77 | delete_option("wpstg_old_staging_sites_backup"); // @deprecated |
| 78 | delete_option("wpstg_staging_sites_backup"); |
| 79 | delete_option("wpstg_missing_cloneName_routine_executed"); |
| 80 | delete_option('wpstg_googledrive'); |
| 81 | delete_option('wpstg_amazons3'); |
| 82 | delete_option('wpstg_sftp'); |
| 83 | delete_option('wpstg_digitalocean'); |
| 84 | delete_option('wpstg_wasabi'); |
| 85 | delete_option('wpstg_free_backup_notice_dismissed'); |
| 86 | delete_option('wpstg_first_backup_speed_index'); |
| 87 | delete_option('wpstg_backup_speed_index'); |
| 88 | delete_option('wpstg_backup_speed_modal_shown'); |
| 89 | delete_option('wpstg_backup_notice_is_closed'); |
| 90 | delete_option('wpstg_backup_notice_remind_me'); |
| 91 | |
| 92 | // @see \WPStaging\Backup\BackupScheduler::OPTION_BACKUP_SCHEDULES |
| 93 | delete_option('wpstg_backup_schedules'); |
| 94 | |
| 95 | /** |
| 96 | * @see \WPStaging\Framework\Security\UniqueIdentifier::IDENTIFIER_OPTION_NAME; |
| 97 | */ |
| 98 | delete_option("wpstg_unique_identifier"); |
| 99 | |
| 100 | |
| 101 | /* Do not delete these fields without actually deleting the staging site |
| 102 | * @create a delete routine which deletes the staging sites first |
| 103 | */ |
| 104 | //delete_option( "wpstg_existing_clones" ); |
| 105 | //delete_option( "wpstg_existing_clones_beta" ); |
| 106 | //delete_option( "wpstg_staging_sites" ); |
| 107 | //delete_option( "wpstg_connection" ); |
| 108 | |
| 109 | // Old wpstg 1.3 options for admin notices |
| 110 | delete_option("wpstg_start_poll"); |
| 111 | delete_option("wpstg_hide_beta"); |
| 112 | delete_option("wpstg_RatingDiv"); |
| 113 | |
| 114 | // New 2.x options for admin notices |
| 115 | delete_option("wpstg_poll"); |
| 116 | delete_option("wpstg_rating"); |
| 117 | delete_option("wpstg_beta"); |
| 118 | |
| 119 | /* @see \WPStaging\Framework\Staging\FirstRun::FIRST_RUN_KEY */ |
| 120 | delete_option('wpstg_execute'); |
| 121 | |
| 122 | /* @see \WPStaging\Framework\BackgroundProcessing\Queue::QUEUE_TABLE_VERSION_KEY */ |
| 123 | delete_option('wpstg_queue_table_version'); |
| 124 | |
| 125 | /** @see \WPStaging\Framework\BackgroundProcessing\Queue::QUEUE_TABLE_STRUCTURE_VERSION_KEY */ |
| 126 | delete_option('wpstg_queue_table_structure_version'); |
| 127 | |
| 128 | /** @see \WPStaging\Framework\Notices\WarningsNotice::OPTION_NAME */ |
| 129 | delete_option('wpstg_warnings_notice'); |
| 130 | |
| 131 | // Delete events |
| 132 | wp_clear_scheduled_hook('wpstg_weekly_event'); |
| 133 | |
| 134 | // Transients |
| 135 | delete_transient("wpstg_issue_report_submitted"); |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | new uninstall(); |
| 141 |