Files
homeproz/wp-content/plugins/mls-by-hansonxyz/uninstall.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

49 lines
1.2 KiB
PHP

<?php
/**
* Uninstall MLS by HansonXyz Plugin
*
* This file runs when the plugin is deleted via the WordPress admin.
* It removes all plugin data including database tables and options.
*/
// Exit if not called by WordPress
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
global $wpdb;
// Delete options
delete_option('mls_plugin_options');
delete_option('mls_db_version');
delete_option('mls_activated_at');
// Drop tables
$tables = array(
$wpdb->prefix . 'mls_properties',
$wpdb->prefix . 'mls_media',
$wpdb->prefix . 'mls_sync_state',
$wpdb->prefix . 'mls_rate_limits',
$wpdb->prefix . 'mls_sync_log',
);
foreach ($tables as $table) {
$wpdb->query("DROP TABLE IF EXISTS {$table}");
}
// Clear scheduled cron events
wp_clear_scheduled_hook('mls_sync_properties');
wp_clear_scheduled_hook('mls_sync_media');
wp_clear_scheduled_hook('mls_cleanup');
// Optionally delete media files
// Note: Uncomment this if you want to delete all downloaded media on uninstall
/*
$upload_dir = wp_upload_dir();
$mls_dir = $upload_dir['basedir'] . '/mls-listings';
if (is_dir($mls_dir)) {
// Recursive delete would go here
}
*/