MksDdn Migrate Content - Complete Description
Category: WordPress Plugins • Platform: PHP
MksDdn Migrate Content is a clean-room migration suite that packages your site into deterministic .wpbkp archives. Each bundle contains a manifest, checksum, database segments, media, selected files, and user decisions, so imports stay predictable.
Why MksDdn Migrate Content?
- Dual export modes – choose Full Site (database + uploads/plugins/themes) or Selected Content (multi-select posts/pages/CPTs) with or without referenced media.
- Chunked pipeline – large archives stream through REST API endpoints with resume tokens, so multi‑GB transfers survive flaky networks.
- User merge control – compare archive vs current users and decide how to merge conflicts.
- Integrity & safety –
.wpbkparchives ship with manifests and checksums; imports verify capabilities, nonces, and disk space before touching data.
Feature Highlights
- Archive format with manifest, checksum, and payload folders (
content.json,media/,options/, filesystem slices). - Media scanner that collects featured images, galleries, attachments referenced inside blocks or shortcodes.
- File-system coverage for
wp-content/uploads,wp-content/plugins,wp-content/themeswith filters to skip VCS/system files. - Chunked upload/download JS client with live progress, auto-resume, and graceful fallback to direct transfer.
- Server file import – select backup files directly from
wp-content/uploads/mksddn-mc/imports/directory without browser uploads. - Custom
.wpbkpdrag-and-drop uploader with checksum guardrails (UI polish deferred to next milestone, functionality already complete).
Architecture
The plugin follows SOLID principles and WordPress Coding Standards with a clean, modular architecture:
Service Container & Dependency Injection
- Centralized
ServiceContainermanages all dependencies - Service Providers (
CoreServiceProvider,AdminServiceProvider,ExportServiceProvider,ImportServiceProvider,ChunkServiceProvider) register services - All dependencies resolved through container, eliminating direct instantiation
- Full support for interface-based dependency injection
Request Handlers
ExportRequestHandler– handles export requestsImportRequestHandler– delegates to specialized import services (supports unified import viaUnifiedImportOrchestrator)UserMergeRequestHandler– processes user merge operationsChunkRestController– REST API controller for chunked upload/download operations- All handlers implement corresponding interfaces for testability
Service Layer
SelectedContentImportService– handles selected content importsFullSiteImportService– manages full site importsUnifiedImportOrchestrator– orchestrates unified import with automatic type detection and routingImportTypeDetector– detects import type (full site or selected content) from archive fileImportFileValidator– validates uploaded filesImportPayloadPreparer– prepares import payloadsServerBackupScanner– scans and validates backup files on the serverResponseHandler– manages redirects and status messagesNotificationService– handles user notificationsProgressService– tracks operation progressErrorHandler– centralized error handling and loggingUserDiffBuilder– builds user difference comparisonUserMergeApplier– applies user merge operations
Contracts (Interfaces)
All key components implement interfaces:
* ExporterInterface, ImporterInterface
* MediaCollectorInterface, ChunkJobRepositoryInterface
* UserPreviewStoreInterface, UserDiffBuilderInterface, UserMergeApplierInterface
* NotificationServiceInterface, ProgressServiceInterface
* ArchiveHandlerInterface, ValidatorInterface
* Request handler interfaces for all handlers
Error Handling
- Specialized exceptions:
ValidationException,FileOperationException,DatabaseOperationException,ImportException,ExportException - Centralized
ErrorHandlerfor consistent error processing - Proper logging and user-friendly error messages
- Validation classes:
ArchiveValidator,ImportDataValidator,ExportDataValidator,FileValidator
Performance
BatchLoaderfor optimized database queries (prevents N+1 problems)- Efficient media collection with batch processing (
AttachmentCollector) - Chunked transfer for large files via REST API (
ChunkRestController) - Memory-efficient streaming for large archives
FullArchivePayloadfor efficient archive payload handlingContentCollectorfor filesystem content collection
Security
- All admin operations check
current_user_can('manage_options') - Nonce verification for all forms and AJAX requests
- REST API endpoints protected with permission callbacks
- Input sanitization using WordPress sanitization functions
- Output escaping with
esc_html(),esc_attr(),esc_url() - File upload validation with MIME type checking
- Path traversal protection for server file access (
ServerBackupScanner) SiteUrlGuardprevents accidental site URL changes during importImportLockprevents concurrent import operationsDomainReplacersafely handles URL replacement during migrations