# WordPress Master Backup

**Last Updated:** 2026-01-10

Complete documentation for the WordPress master backup, including location, structure, and restoration procedures.

## Overview

The WordPress master backup is a complete snapshot of all WordPress blog content extracted before migration. This backup serves as the authoritative source for restoring WordPress content if needed.

## Backup Location

**Directory:** `docs/backups/wordpress-master/`

**Structure:**

```
docs/backups/wordpress-master/
├── BACKUP_MANIFEST.json          # Backup metadata and checksums
├── content/
│   └── blog-posts-content-full.json  # Full HTML content for all posts
├── metadata/
│   └── blog-posts-metadata.json      # Post metadata (titles, dates, SEO)
├── images/
│   └── blog-images-list.json         # List of all images
└── relationships/
    ├── blog-content-relationships.json
    ├── blog-internal-links.json
    ├── blog-cluster-mapping.json
    └── blog-topics-extracted.json
```

## Backup Contents

### Content File

**File:** `content/blog-posts-content-full.json`

Contains:
- Full HTML content for all 99 blog posts
- Plain text content
- Word counts
- Image references
- Embedded content (iframes, scripts, videos)
- Extraction metadata (timestamp, script version)

### Metadata File

**File:** `metadata/blog-posts-metadata.json`

Contains:
- Post titles
- Publication dates
- Meta titles and descriptions
- Featured images
- H1 headings
- WordPress URLs

### Images File

**File:** `images/blog-images-list.json`

Contains:
- All image URLs
- Image metadata (alt text, dimensions)
- Image types (featured/content)
- Source post information

### Relationship Files

**Directory:** `relationships/`

Contains:
- Content relationships between posts
- Internal link data
- Cluster mappings
- Topic assignments

## Backup Manifest

**File:** `BACKUP_MANIFEST.json`

The manifest contains:
- Extraction date and timestamp
- Script version used
- Post count (99 posts)
- File checksums (SHA256)
- WordPress URLs list
- File locations

## Restoration Process

### Prerequisites

1. Python 3.7+ installed
2. Access to backup directory
3. Write permissions to `v2/data/blog/posts/`

### Restoration Steps

1. **Validate Backup**

   ```bash
   python3 scripts/blog/validate-backup.py docs/backups/wordpress-master
   ```

   Verify:
   - All files present
   - JSON files valid
   - Checksums match

2. **Restore Posts**

   ```bash
   python3 scripts/blog/restore-from-wordpress-backup.py
   ```

   This will:
   - Restore all 99 post JSON files
   - Restore to `v2/data/blog/posts/{category}/{slug}.json`
   - Preserve WordPress URLs and metadata
   - Generate restoration report

3. **Verify Restoration**

   ```bash
   python3 scripts/blog/check-backup-integrity.py docs/backups/wordpress-master
   ```

   Check:
   - All posts restored
   - Content matches backup
   - No errors in restoration

### Dry Run

To test restoration without modifying files:

```bash
python3 scripts/blog/restore-from-wordpress-backup.py --dry-run
```

## Backup Validation

### Manual Validation

Check backup integrity:

```bash
python3 scripts/blog/validate-backup.py docs/backups/wordpress-master
```

Expected output:
- ✅ All JSON files valid
- ✅ All checksums match
- ✅ 99 posts verified

### Automated Validation

The backup includes validation in the manifest:
- File checksums (SHA256)
- JSON syntax validation
- Post count verification

## Backup Creation

The WordPress master backup was created using:

1. **Enhanced Extraction Script**

   ```bash
   python3 scripts/blog/extract-content.py
   ```

   Script version: 2.0.0
   Includes: backup metadata, WordPress URL mapping, extraction parameters

2. **Backup Copy Script**

   ```bash
   python3 scripts/blog/copy-wordpress-backup.py
   ```

   Copies extraction files to backup directory and creates manifest

## Restoration Reports

After restoration, check:

- `docs/backups/restoration-report.json` - Restoration details
- Console output - Summary of restored posts

## Troubleshooting

### Backup Not Found

**Error:** "Backup directory not found"

**Solution:**
- Verify backup directory exists: `docs/backups/wordpress-master/`
- Check file permissions
- Verify backup was created successfully

### JSON Validation Errors

**Error:** "JSON syntax error"

**Solution:**
- Check file integrity
- Verify backup wasn't corrupted
- Re-extract from WordPress if needed

### Checksum Mismatch

**Error:** "Checksum mismatch"

**Solution:**
- File may have been modified
- Re-validate backup
- Check for file corruption

### Missing Posts

**Error:** "Post count mismatch"

**Solution:**
- Verify all 99 posts in backup
- Check extraction completed successfully
- Review backup manifest for post count

## Related Documentation

- [Backup Guide](guides/BACKUP_GUIDE.md) — canonical backup strategy and commands
- [Backup Process](BACKUP_PROCESS.md) - Backup procedures and automation
- [Migration Strategy](MIGRATION_STRATEGY.md) - Migration overview

## Backup Maintenance

### When to Update

- Before major content changes
- After WordPress content updates
- Before migration milestones

### Backup Verification

Regular verification recommended:
- Monthly integrity checks
- Before major restorations
- After backup creation

## Notes

- Backup contains complete WordPress content as of extraction date
- All 99 posts included
- Backup is read-only (do not modify backup files)
- Use restoration scripts to restore content
- Always validate before restoration
