Add verbose mode, progress indicators, and missing media log

- Add --verbose flag to sync commands for detailed API request/response output
- Add progress indicators (.=#xPpE|) for compact sync output
- Implement exponential backoff (1s, 2s, 4s, 8s, 16s) for media downloads
- Log failed media downloads to wp-content/uploads/mls-missing-media.log
- Add 'wp mls cache missing' command to view/clear the log
- Retry on rate limit (429) and server errors (5xx)
- Update documentation with new features

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Hanson.xyz Dev
2025-12-14 22:20:41 -06:00
parent 6556479417
commit 5e4ebfb99e
5 changed files with 626 additions and 48 deletions
@@ -56,17 +56,53 @@ wp mls sync incremental
# Download pending media
wp mls sync media
# Use --verbose for detailed output
wp mls sync full --verbose
wp mls sync incremental --verbose
```
### Via Cron
#### Progress Indicators
Add to your system crontab for scheduled sync:
During sync, you'll see progress characters:
- `.` = new property
- `#` = updated property
- `x` = deleted property
- `P` = photo downloaded
- `p` = photo skipped (exists)
- `E` = photo error
- `|` = page complete
Use `--verbose` for detailed timestamped output showing API requests and individual items.
### Via Unix Cron
Add to your system crontab (`crontab -e`) for scheduled sync:
```bash
# Run incremental sync every hour
0 * * * * cd /var/www/html && wp mls sync incremental --allow-root
# Incremental sync every hour (recommended for production)
0 * * * * cd /var/www/html && wp mls sync incremental --allow-root >> /var/log/mls-sync.log 2>&1
# Or every 30 minutes for more frequent updates
*/30 * * * * cd /var/www/html && wp mls sync incremental --allow-root >> /var/log/mls-sync.log 2>&1
# Full sync weekly (Sunday at 3am) to catch any missed records
0 3 * * 0 cd /var/www/html && wp mls sync full --allow-root >> /var/log/mls-sync.log 2>&1
# Download any pending media every 15 minutes
*/15 * * * * cd /var/www/html && wp mls sync media --limit=50 --allow-root >> /var/log/mls-sync.log 2>&1
```
**Important Notes:**
- Use `--allow-root` when running as root user
- Redirect output to a log file for debugging
- MLS Grid requires refresh at least every 12 hours per IDX rules
- The plugin handles rate limits automatically (waits if approaching limits)
### Via WP-Cron (Alternative)
Enable auto-sync in Settings > MLS Settings to use WordPress's built-in cron system. This runs on page loads rather than true system cron, so may be less reliable for high-frequency syncs.
## Checking Status
### Via Admin
@@ -237,6 +273,25 @@ wp mls cache clear --confirm
This removes all synced data but keeps settings.
### Missing Media Log
Failed media downloads are logged for review:
```bash
# View missing media log
wp mls cache missing
# View first 20 entries
wp mls cache missing --limit=20
# Clear the log
wp mls cache missing --clear
```
Log location: `wp-content/uploads/mls-missing-media.log`
The log shows listing key, media key, error type, and original URL for each failed download. Media downloads automatically retry with exponential backoff (up to 5 attempts) for rate limit and server errors.
## Support
For plugin issues: Check logs at Settings > MLS Settings