Files
homeproz/wp-content/plugins/mls-by-hansonxyz/includes/class-mls-deactivator.php
T
Hanson.xyz Dev 6556479417 Add MLS by HansonXyz plugin for MLS Grid API integration
Features:
- Full sync of NorthStar MLS properties via MLS Grid API v2
- Incremental sync using ModificationTimestamp
- Local media download and storage
- Rate limit compliance (2 req/sec, 7200/hr, 40000/day)
- Sync state tracking with resume capability
- WP-CLI commands: test, sync, status, stats, cache
- Admin settings page with manual sync triggers
- Public API functions: mls_get_properties, mls_get_property, etc.

Database tables:
- mls_properties: Listing data with full field mapping
- mls_media: Downloaded images
- mls_sync_state: Sync progress tracking
- mls_rate_limits: API usage tracking
- mls_sync_log: Debug logging

Documentation:
- docs/CLAUDE.md: AI development guide
- docs/API.md: MLS Grid API reference
- docs/USAGE.md: User documentation

Tested: Connection, auth, sync 10 records, media download verified

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 21:24:38 -06:00

51 lines
1.2 KiB
PHP

<?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');
}
}