# WordPress Plugin Sync Fix - Deployment Checklist **Version**: 1.0 **Date**: November 22, 2025 **Risk Level**: Low (Non-breaking changes) --- ## Pre-Deployment ### Code Review - [ ] Review changes in `includes/functions.php` - [ ] Enhanced `igny8_sync_site_structure_to_backend()` function - [ ] Better error handling and response parsing - [ ] Added platform filter to API query - [ ] Improved debug logging - [ ] Review changes in `admin/class-admin.php` - [ ] User feedback messages added - [ ] Non-blocking approach maintained - [ ] Connection still succeeds even if sync fails - [ ] Review changes in `includes/class-igny8-api.php` - [ ] POST request debug logging added - [ ] Respects WP_DEBUG and IGNY8_DEBUG flags - [ ] Token refresh logic preserved - [ ] Review new test file `tests/test-sync-structure.php` - [ ] Diagnostic script for troubleshooting - [ ] Can be run standalone - [ ] Review documentation - [ ] `SYNC-FIX-REPORT.md` - Technical details - [ ] `SYNC-FIX-EXECUTIVE-SUMMARY.md` - Overview - [ ] `SYNC-DATA-FLOW-DIAGRAM.md` - Data flow visual - [ ] This checklist - Deployment guide ### Backup - [ ] Backup WordPress database - Command: `wp db export backup-$(date +%s).sql` - Location: Keep in safe place - [ ] Backup IGNY8 backend database - [ ] PostgreSQL: `pg_dump igny8_production > backup-$(date +%s).sql` - Or Docker: `docker exec igny8_db pg_dump -U postgres igny8_production > backup.sql` - [ ] Backup current plugin files - Command: `tar -czf plugin-backup-$(date +%s).tar.gz includes/ admin/ sync/` - [ ] Document current state - [ ] Note any active integrations - [ ] Document any custom configurations ### Testing Environment - [ ] Set up staging environment - [ ] Fresh copy of WordPress - [ ] Fresh copy of IGNY8 backend - [ ] Sufficient test data - [ ] Verify test environment is isolated - [ ] Different database - [ ] Different API endpoints (if possible) - [ ] No production data --- ## Staging Deployment ### Deploy Code - [ ] Copy modified files to staging WordPress: ```bash cp includes/functions.php staging-wp/wp-content/plugins/igny8-bridge/includes/ cp admin/class-admin.php staging-wp/wp-content/plugins/igny8-bridge/admin/ cp includes/class-igny8-api.php staging-wp/wp-content/plugins/igny8-bridge/includes/ ``` - [ ] Copy test file: ```bash cp tests/test-sync-structure.php staging-wp/wp-content/plugins/igny8-bridge/tests/ ``` - [ ] Verify plugin is still active: ```bash wp plugin list | grep igny8-bridge ``` ### Configure Debug Logging (Staging Only) - [ ] Enable WordPress debug logging in `wp-config.php`: ```php define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('IGNY8_DEBUG', true); ``` - [ ] Verify log file exists: ```bash ls -la wp-content/debug.log ``` ### Functional Testing - [ ] **Test 1: Connection** - [ ] Go to WordPress Admin → Settings → IGNY8 API - [ ] Enter credentials and click "Connect to IGNY8" - [ ] Verify: Success message appears - [ ] Verify: "Site structure synced" message appears (or "will be retried") - [ ] **Test 2: Debug Logging** - [ ] Check `wp-content/debug.log`: ```bash tail -50 wp-content/debug.log | grep IGNY8 ``` - [ ] Should see: - [ ] "Sending structure sync to endpoint..." - [ ] "DEBUG POST: .../update-structure/" - [ ] "DEBUG POST RESPONSE: Status=200" - [ ] "Site structure synced successfully" - [ ] **Test 3: Backend Storage** - [ ] Run Django shell: ```bash docker exec -it igny8_backend python manage.py shell ``` - [ ] Check storage: ```python from igny8_core.business.integration.models import SiteIntegration si = SiteIntegration.objects.filter(platform='wordpress').first() print(si.config_json.get('content_types', {}).keys()) # Should show: dict_keys(['post_types', 'taxonomies', 'last_structure_fetch']) ``` - [ ] **Test 4: Frontend Display** - [ ] Navigate to Site Settings → Content Types tab - [ ] Verify display shows: - [ ] Post Types section - [ ] Taxonomies section - [ ] Counts for each item - [ ] "Structure last fetched" timestamp - [ ] **Test 5: Diagnostic Script** - [ ] Run test script: ```bash wp eval-file tests/test-sync-structure.php ``` - [ ] Verify: All tests pass (6/6 ✅) - [ ] **Test 6: Error Scenarios** - [ ] Disable backend temporarily - [ ] Try to connect - [ ] Verify: Connection fails with clear error - [ ] Verify: Debug log shows connection error - [ ] Re-enable backend - [ ] Try connection again - [ ] Verify: Works correctly - [ ] **Test 7: Cron Job** - [ ] Check if daily cron is scheduled: ```bash wp cron event list | grep igny8_sync_site_structure ``` - [ ] Manually trigger it: ```bash wp cron test # or wp cron event run igny8_sync_site_structure ``` - [ ] Verify: Logs show successful sync - [ ] **Test 8: Multiple Sites** - [ ] If applicable, test with multiple WordPress sites connected - [ ] Verify: Each shows correct post types/taxonomies - [ ] Verify: No data leakage between sites ### Performance Testing - [ ] Load test: Multiple simultaneous sync requests - [ ] No timeouts - [ ] No memory issues - [ ] Database performs well - [ ] Monitor resources during sync: - [ ] CPU usage reasonable - [ ] Memory stable - [ ] No database locks ### Security Review - [ ] Verify API credentials not logged: - [ ] Check debug log - [ ] Authorization headers masked (Bearer ***) - [ ] API keys not exposed - [ ] Verify access control: - [ ] Only authenticated users can trigger sync - [ ] Only owners can see their site data - [ ] Cross-site access denied ### Regression Testing - [ ] Verify existing functionality still works: - [ ] Plugin connection (original method) - [ ] Manual sync buttons - [ ] Post sync operations - [ ] Taxonomy sync operations - [ ] Webhook handling ### Staging Sign-Off - [ ] QA approval: ✅ or ❌ - [ ] If issues found: - [ ] Document issue - [ ] Fix code - [ ] Re-test - [ ] Return to staging sign-off --- ## Production Deployment ### Pre-Deployment Confirmation - [ ] Staging tests passed - [ ] QA sign-off obtained - [ ] Stakeholders notified - [ ] Maintenance window scheduled (if needed) - [ ] Rollback plan documented ### Deploy to Production - [ ] **Timing**: Deploy during low-traffic period - [ ] **Method 1: FTP/SFTP** ```bash scp -r includes/ admin/ sync/ user@prod-server:wp-content/plugins/igny8-bridge/ ``` - [ ] **Method 2: Git Deploy** ```bash cd /var/www/html/wp-content/plugins/igny8-bridge/ git pull origin main ``` - [ ] **Method 3: WordPress Admin** - [ ] Upload plugin zip file - [ ] Click "Install" - [ ] Activate plugin ### Verify Deployment - [ ] Plugin still active: ```bash wp plugin list | grep igny8-bridge ``` - [ ] No PHP errors: ```bash grep -i "fatal\|error" wp-content/debug.log | tail -20 ``` - [ ] Files in correct locations: ```bash ls -la wp-content/plugins/igny8-bridge/includes/class-igny8-api.php ls -la wp-content/plugins/igny8-bridge/admin/class-admin.php ls -la wp-content/plugins/igny8-bridge/includes/functions.php ``` ### Smoke Tests (Production) - [ ] Verify connection still works - [ ] Test with staging IGNY8 account first (if possible) - [ ] Then test with production account - [ ] Check debug logs: ```bash tail -30 wp-content/debug.log | grep IGNY8 ``` - [ ] Verify frontend displays content types - [ ] Check multiple sites if applicable - [ ] Verify counts are correct - [ ] Check that no errors in logs: ```bash grep -i "error" wp-content/debug.log | tail -10 ``` ### Monitoring (First 24 Hours) - [ ] **Hour 0-1**: Active monitoring - [ ] Check debug logs every 10 minutes - [ ] Monitor error rates - [ ] Watch for user complaints - [ ] **Hour 1-6**: Periodic checks - [ ] Check logs every 30 minutes - [ ] Verify syncs completing - [ ] Monitor performance metrics - [ ] **Hour 6-24**: Daily monitoring - [ ] Check logs at start, middle, end of day - [ ] Verify cron jobs running - [ ] Monitor for anomalies ### Issues During Deployment If issues arise: - [ ] **Do not panic** - Changes are non-breaking - [ ] Collect information: - [ ] Screenshots of errors - [ ] Debug log excerpts (last 100 lines) - [ ] Browser console errors - [ ] Backend logs - [ ] Create incident ticket - [ ] Decide: Fix or rollback? ### Rollback Plan (If Needed) - [ ] Restore from backup: ```bash cp plugin-backup-*.tar.gz current.tar.gz tar -xzf current.tar.gz -C wp-content/plugins/igny8-bridge/ ``` - [ ] Clear any caches: ```bash wp cache flush ``` - [ ] Test connection again: - [ ] Should revert to previous behavior - [ ] May need to re-connect plugin - [ ] Notify stakeholders: - [ ] Rollback was performed - [ ] Feature postponed - [ ] New deployment planned --- ## Post-Deployment ### Documentation - [ ] Update deployment log: - [ ] Version deployed - [ ] Date/time - [ ] Any issues encountered - [ ] Resolution steps - [ ] Update team documentation: - [ ] Point to `SYNC-FIX-REPORT.md` - [ ] Share `SYNC-DATA-FLOW-DIAGRAM.md` - [ ] Add to internal knowledge base - [ ] Create support guide: - [ ] How to verify sync is working - [ ] Common issues and solutions - [ ] Who to contact for support ### Team Communication - [ ] Notify development team: - [ ] Deployment completed successfully - [ ] Link to documentation - [ ] Invite questions - [ ] Notify product team: - [ ] Feature is now active - [ ] Users can see Content Types tab - [ ] Daily sync is automatic - [ ] Notify support team: - [ ] How to troubleshoot issues - [ ] Where to find logs - [ ] Escalation path ### Cleanup - [ ] Disable WP_DEBUG if enabled: ```php define('WP_DEBUG', false); define('WP_DEBUG_LOG', false); define('IGNY8_DEBUG', false); ``` - [ ] Clear debug logs (optional): ```bash rm wp-content/debug.log ``` - [ ] Clear cache: ```bash wp cache flush ``` - [ ] Archive backup files: - [ ] Keep backups for 30 days minimum - [ ] Document backup locations ### Success Criteria ✅ Deployment successful if: - [ ] No PHP errors in logs - [ ] Plugin connections working - [ ] Frontend shows Content Types - [ ] Debug logs show sync messages - [ ] Users report success - [ ] No performance degradation - [ ] Cron jobs running - [ ] No security issues --- ## Sign-Off | Role | Name | Signature | Date | |------|------|-----------|------| | Developer | | | | | QA | | | | | DevOps | | | | | Product | | | | --- ## Support Contact For issues during/after deployment: - **Development Team**: [contact info] - **DevOps Team**: [contact info] - **Support Team**: [contact info] --- ## Appendix ### Useful Commands **Check plugin status:** ```bash wp plugin list | grep igny8 ``` **View error logs:** ```bash tail -100 wp-content/debug.log ``` **Test connection manually:** ```bash wp eval-file tests/test-sync-structure.php ``` **Force sync:** ```bash wp cron event run igny8_sync_site_structure ``` **Check backend integration:** ```bash docker exec igny8_backend python manage.py shell from igny8_core.business.integration.models import SiteIntegration SiteIntegration.objects.filter(platform='wordpress').count() ``` **Restart WordPress (if needed):** ```bash # Clear caches wp cache flush wp rewrite flush ``` --- _Last Updated: November 22, 2025_ _Next Review: December 2025_