51 lines
1.2 KiB
PHP
Executable File
51 lines
1.2 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Plugin deactivator class
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class MLS_Deactivator {
|
|
|
|
/**
|
|
* Run on plugin deactivation
|
|
*/
|
|
public static function deactivate() {
|
|
// Clear scheduled cron events
|
|
self::clear_cron();
|
|
|
|
// Flush rewrite rules
|
|
flush_rewrite_rules();
|
|
}
|
|
|
|
/**
|
|
* Clear all scheduled cron events
|
|
*/
|
|
private static function clear_cron() {
|
|
// Clear property sync cron
|
|
$timestamp = wp_next_scheduled('mls_sync_properties');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'mls_sync_properties');
|
|
}
|
|
|
|
// Clear media sync cron
|
|
$timestamp = wp_next_scheduled('mls_sync_media');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'mls_sync_media');
|
|
}
|
|
|
|
// Clear cleanup cron
|
|
$timestamp = wp_next_scheduled('mls_cleanup');
|
|
if ($timestamp) {
|
|
wp_unschedule_event($timestamp, 'mls_cleanup');
|
|
}
|
|
|
|
// Clear all hooks with our prefix
|
|
wp_clear_scheduled_hook('mls_sync_properties');
|
|
wp_clear_scheduled_hook('mls_sync_media');
|
|
wp_clear_scheduled_hook('mls_cleanup');
|
|
}
|
|
}
|