承接 soderlind/multisite-exporter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

soderlind/multisite-exporter

Composer 安装命令:

composer require soderlind/multisite-exporter

包简介

Runs WordPress Exporter on each subsite in a multisite, in the background.

README 文档

README

Multisite Exporter is a WordPress plugin that allows you to export content from all subsites in a WordPress multisite installation. The plugin generates WordPress XML (WXR) files by running the WordPress exporter on each subsite in the background using the Action Scheduler library, making it efficient even for large multisite networks.

Features | Requirements | Installation | Usage | Action Scheduler | Export File Storage | Translation | Debugging

multisite-exporter.mp4

Features

  • Export content from all subsites in a WordPress multisite network as XML (WXR) files.
  • Background processing using Action Scheduler to handle large networks efficiently
  • Filter exports by content type, post type, and date range
  • Centralized export file storage for easy access to all exports
  • Select and download multiple export files as a zip archive
  • Powerful WP CLI commands for automated/scripted exports
  • Fully translatable with .pot file included
  • Customizable export directory location via filter

Requirements

  • WordPress Multisite installation
  • PHP 8.2 or higher
  • Action Scheduler library (included with the plugin)

Installation

  • Quick Install

    • Download multisite-exporter.zip
    • Upload via WordPress Network > Plugins > Add New > Upload Plugin
    • Network activate the plugin.
  • Composer Install

    composer require soderlind/multisite-exporter
  • Updates

Usage

Running an Export (UI Method)

  1. Log in to your WordPress Network Admin dashboard
  2. Navigate to MS Exporter → Multisite Exporter
  3. Configure your export settings:
    • Content: Choose to export all content, posts, pages, or media
    • Post Type: Optionally specify a custom post type
    • Date Range: Optionally filter by start and end date
  4. Click "Run Export for All Subsites"
  5. Exports will be processed in the background using Action Scheduler

Running an Export

Accessing Export Files (UI Method)

  1. Navigate to MS Exporter → Exports
  2. View a list of all completed exports from all subsites
  3. Download options:
    • Click the "Download" button next to an individual export
    • Select multiple exports using checkboxes and click "Download Selected" to get a zip file
    • Use "Select All" and "Download Selected" to download all exports at once in a zip file.

Accessing Export Files

WP CLI Method

The plugin includes a WP CLI command to export content directly from the command line.

Basic Export (All Sites, All Content)

wp multisite-exporter export

This will export all content from all sites in your multisite network.

Exporting Specific Content Types

wp multisite-exporter export --content=posts,pages

Valid content types are: all, posts, pages, media

Exporting Specific Sites

wp multisite-exporter export --site_ids=1,2,3

This will export only the sites with the specified IDs.

Filtering by Date Range

wp multisite-exporter export --start_date=2023-01-01 --end_date=2023-12-31

Full Example

wp multisite-exporter export --site_ids=1,2,3 --content=posts,pages --start_date=2023-01-01

The command will display a progress bar during export. When completed:

  • For a single site, the export file will be saved in your current directory
  • For multiple sites, a zip file containing all exports will be created in your current directory

How Action Scheduler Works

The Multisite Exporter plugin uses Action Scheduler, a robust background processing library for WordPress, to handle export operations efficiently across multiple sites. Here's how it works:

Overview

  1. Task Scheduling: When you click "Run Export for All Subsites," the plugin creates an individual task for each subsite in your network.

  2. Background Processing: These tasks are processed in the background using WordPress cron, without blocking user interactions or causing timeout issues.

  3. Failure Handling: If an export fails, Action Scheduler will automatically retry it based on its built-in retry logic, ensuring robust operation even in challenging environments.

Technical Details

  • Storage: Action Scheduler stores tasks in a custom table, ensuring they don't get lost even in case of server interruptions.

  • Queue Processing: Tasks are executed in a controlled manner, with rate limiting to prevent server overload.

  • Admin Interface: The plugin provides a filtered view of Action Scheduler's interface under MS Exporter → Scheduled Actions, where you can monitor the progress of exports.

  • Scaling: The architecture can handle thousands of tasks, making it perfect for large multisite networks with hundreds of subsites.

Action Scheduler Location

The Action Scheduler library is included in this plugin via Composer and can be found at:

/vendor/woocommerce/action-scheduler/

All Action Scheduler related files are loaded automatically when the plugin initializes.

Benefits for Multisite Exports

  • No Timeout Issues: Export processes run in the background, avoiding PHP timeout restrictions.

  • Server-Friendly: Tasks are processed in batches, preventing server resource exhaustion.

  • Monitoring: You can track the progress of exports and identify any issues that may occur.

  • Reliability: The persistent storage mechanism ensures that even if a server restarts, your export tasks will continue where they left off.

Export File Storage

All export files are stored in a centralized location within your WordPress uploads directory:

wp-content/uploads/multisite-exports/

This makes it easy to find and manage exports from all your subsites in one place.

Customizing Export Directory

You can change the default export directory by using the multisite_exporter_directory filter:

/**
 * Change the directory where Multisite Exporter stores exported files
 */
add_filter( 'multisite_exporter_directory', 'my_custom_export_directory' );
function my_custom_export_directory( $default_export_dir ) {
    // Define a custom location for your export files
    return WP_CONTENT_DIR . '/my-custom-exports';
}

Add this code to your theme's functions.php file or a custom plugin.

Translation

The plugin is fully translatable. A POT file is included in the languages directory to help with translations.

To create a translation:

  1. Copy the languages/multisite-exporter.pot file
  2. Rename it to multisite-exporter-{locale}.po (e.g., multisite-exporter-fr_FR.po)
  3. Translate using a tool like Poedit
  4. Save both .po and .mo files to the languages directory

Debugging

Error Logging

Multisite Exporter follows WordPress best practices for error logging. All error messages are conditionally logged based on the WP_DEBUG constant setting:

if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    error_log( 'Multisite Exporter: [error message]' );
}

This ensures that:

  • In development environments with WP_DEBUG enabled, you'll see detailed logs about the export process
  • In production environments with WP_DEBUG disabled, no error messages will be written to the log files

WXR Validation

Multisite Exporter includes a WXR (WordPress eXtended RSS) validator that checks the integrity of export files:

  • Automatic Validation: Each export file is automatically validated after creation
  • XML Structure Check: Ensures the export file has valid XML structure
  • WXR Schema Validation: Validates against WordPress WXR format requirements
  • Error Detection: Identifies and logs specific issues in malformed export files

The validator helps troubleshoot problematic exports and ensures your export files will be compatible with WordPress import tools.

Common Log Messages

When WP_DEBUG is enabled, you may see the following messages in your WordPress debug log:

  • Filesystem initialization: Messages about WordPress filesystem initialization
  • Export progress: Notifications when exports start and complete for each blog
  • File operations: Information about file cleanup and management
  • Error handling: Details about any issues encountered during the export process
  • WXR validation: Results of export file validation checks

Enabling Debug Mode

To enable debug logging for troubleshooting, add the following to your wp-config.php file:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

This configuration will log all errors to the debug.log file without displaying them on screen.

Copyright and License

Multisite Exporter is copyright © 2025 Per Søderlind.

Multisite Exporter is open-source software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.

Multisite Exporter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE for more information.

soderlind/multisite-exporter 适用场景与选型建议

soderlind/multisite-exporter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 6, 最近一次更新时间为 2025 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 soderlind/multisite-exporter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 soderlind/multisite-exporter 我们能提供哪些服务?
定制开发 / 二次开发

基于 soderlind/multisite-exporter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-05-14