
內容簡介
MultiSite Clone Duplicator 加入「複製網站」功能至您的網路安裝中。
它允許您將網站克隆為新網站:所有數據、檔案、使用者和角色都可以複製。當您想要從同一模板創建多個網站時,它非常有用:不要浪費時間一遍又一遍地複製相同的配置!
這個簡單易用的外掛在不污染儀表板的情況下擴展了 WordPress 核心網路的功能。
警告:如果您複製主要網站,必須使用 mucd_default_primary_tables_to_copy 篩選器來聲明插件和自定義數據庫表格,否則您複製的網站將不完整。
特點:
- 複製 WordPress 多站點安裝中的任何網站
- 複製所有文章和設置
- 產生日誌文件(如果選項已勾選)
- 複製從複製的網站中的所有檔案(如果選項已勾選)
- 保留複製的網站中的使用者和角色(如果選項已勾選)
- 配置那些可複製的網站(因此您可以定義獨特的“模式”網站)
- 完全可鉤子化
- 可從命令行直接執行(提供 WP-CLI 子命令)
鉤子:
- mucd_before_copy_files / mucd_after_copy_files:複製文件之前/之後的動作
參數:from_site_id(來源網站 ID)和 to_site_id(目標網站 ID)
- mucd_before_copy_data / mucd_after_copy_data:複製數據之前/之後的動作
參數:from_site_id(來源網站 ID)和 to_site_id(目標網站 ID)
- mucd_before_copy_users / mucd_after_copy_users:在複製用戶之前/之後的動作
參數:from_site_id(來源網站 ID)和 to_site_id(目標網站 ID)
- mucd_copy_blog_data_saved_options 篩選器:過濾應在新博客中保留的選項(創建的博客的原始值不會被複制到舊網站的表格中)
參數:option_name(字符串數組)
- mucd_default_fields_to_update 篩選器:篩選複製數據後要更新的字段
參數:table_name(字段名和字串數組)
- mucd_default_primary_tables_to_copy 篩選器:在複製的網站是主網站時過濾要複製的表格
參數:table_name(字符串數組)
- mucd_copy_dirs 篩選器:篩選要複製的目錄和檔案
參數:dirs(字符串數組)、from_site_id(來源網站 ID)和 to_site_id(目標網站 ID)
- mucd_string_to_replace 篩選器:篩選想要在更新期間替換的字串
參數:string_to_replace(字符串)和 from_site_id(來源網站 ID)和 to_site_id(目標網站 ID)
WP-CLI 參數:
--slug=:從複製的網站創建一個具有指定 Slug 的新網站。請注意,Slug 是網站名稱的一部分。必需參數。
--source=:從 site_id 指定的網站創建一個新網站。必需參數。
--title=:指定新網站的標題。
--email=:指定新網站的管理員電子郵件地址。
--network_id=:指定網路的 ID。
--private:創建一個私有網站,這需要支援密碼保護的佈景主題。
--porcelain:以機器可讀的形式輸出結果。
--v:詳細輸出。
--do_not_copy_files:不要複製檔案。
--keep_users:保留使用者。
--log=:指定日誌記錄的目錄路徑。
本外掛的原始版本是由一個名叫 Julien OGER 的人開發,他仍然密切關注這個項目。這個外掛最初包含了用於在 SQL 序列化數據中搜索和替換的代碼。
外掛標籤
開發者團隊
原文外掛簡介
MultiSite Clone Duplicator adds a “Duplicate Site” functionality to your network installation.
It allows you to clone any site of your network into a new one : all data, files, users and roles can be copied.
It is useful when you want to create multiple sites from the same template : Don’t waste your time copying the same configuration again and again !
Simple and user-friendly, this plugin extends WordPress core network’s functionalities without polluting the dashboard.
WARNING : If you clone the primary site, you must use mucd_default_primary_tables_to_copy filter to declare plugins and custom database tables, or your cloned site won’t be complete
Features:
Clones any site of your wordpress multisite installation
Copies all posts and settings
Generates log files (if option is checked)
Copy all files from duplicated site (if option is checked)
Keep users and roles from duplicated site (if option is checked)
Configure which site is clonable (so you can define an unique “pattern” site)
Fully hookable
Command line ready (provides a WP-CLI subcommand)
Hooks
Action : mucd_before_copy_files / mucd_after_copy_files
Action before / after copying files
Args :
Int : from_site_id
Int : to_site_id
Action : mucd_before_copy_data / mucd_after_copy_data
Action before / after copying data
Args :
Int : from_site_id
Int : to_site_id
Action : mucd_before_copy_users / mucd_after_copy_users
Action before / after copying users
Args :
Int : from_site_id
Int : to_site_id
Filter : mucd_copy_blog_data_saved_options
Filter options that should be preserved in the new blog (original values from created blog will not be erased by copy of old site’s tables)
Args :
Array of string : option_name
Filter : mucd_default_fields_to_update
Filter fields to scan for an update after data copy
Args :
Array of ( ‘table_name’ => array(‘field_1’, ‘field_2’ …));
Filter : mucd_default_primary_tables_to_copy
Filter tables to duplicate when duplicated site is primary site
Args :
Array of string table_name
Filter : mucd_copy_dirs
Filter directories and files you want to copy
Args :
Array of string : dirs
Int : from_site_id
Int : to_site_id
Filter : mucd_string_to_replace
Filter which strings we want to replace during update
Args :
String : string_to_replace
Int : from_site_id
Int : to_site_id
WP-CLI arguments
Arguments are :
wp site duplicate --slug=
[--email=
[--do_not_copy_files] [--keep_users] [--log=
Thank’s
The original version of this plugin has been developed by Julien OGER who keeps following the project carefully.
Some code for search and replace in SQL serialised data were initialy taken from Lionel Pointet WordPress Migration tool
