| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired during plugin deactivation |
| 5 |
* |
| 6 |
* @link https://searchatlas.com |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package Metasync |
| 10 |
* @subpackage Metasync/includes |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* Fired during plugin deactivation. |
| 15 |
* |
| 16 |
* This class defines all code necessary to run during the plugin's deactivation. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
* @package Metasync |
| 20 |
* @subpackage Metasync/includes |
| 21 |
* @author Engineering Team <support@searchatlas.com> |
| 22 |
*/ |
| 23 |
class Metasync_Deactivator |
| 24 |
{ |
| 25 |
|
| 26 |
/** |
| 27 |
* Short Description. (use period) |
| 28 |
* |
| 29 |
* Long Description. |
| 30 |
* |
| 31 |
* @since 1.0.0 |
| 32 |
*/ |
| 33 |
public static function deactivate() |
| 34 |
{ |
| 35 |
// add_filter('wp_sitemaps_enabled', '__return_true'); |
| 36 |
//delete_option( "metasync_options" ); |
| 37 |
//delete_option( "metasync_options_instant_indexing" ); |
| 38 |
|
| 39 |
// Clean up announce ping counter |
| 40 |
delete_option('metasync_announce_attempt_count'); |
| 41 |
|
| 42 |
// Unschedule every MetaSync cron hook so no orphaned events remain after deactivation |
| 43 |
foreach (Metasync_Activator::$cron_hooks as $hook) { |
| 44 |
wp_unschedule_hook($hook); |
| 45 |
} |
| 46 |
|
| 47 |
// Soft flush only (no .htaccess rewrite). A hard flush calls |
| 48 |
// save_mod_rewrite_rules(), which opens the site's root .htaccess with an |
| 49 |
// exclusive flock(). On hosts whose cache/optimizer layer also holds that |
| 50 |
// lock (e.g. SiteGround + SG Optimizer), the deactivation request blocks on |
| 51 |
// the lock until max_execution_time and the host returns a 500 — so the |
| 52 |
// plugin never deactivates. MetaSync registers its rewrite rules via |
| 53 |
// add_rewrite_rule (stored in the `rewrite_rules` option, NOT in .htaccess), |
| 54 |
// so a soft flush fully clears them without ever touching the file. |
| 55 |
flush_rewrite_rules(false); |
| 56 |
|
| 57 |
// Reset one-time cleanup flag so it re-runs on next activation/update |
| 58 |
delete_option('metasync_wp299_cron_cleanup_done'); |
| 59 |
} |
| 60 |
} |
| 61 |
|