Download the PHP package daan/strip-db-dump without Composer
On this page you can find all versions of the php package daan/strip-db-dump. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daan/strip-db-dump
More information about daan/strip-db-dump
Files in daan/strip-db-dump
Package strip-db-dump
Short Description Adds shorthands in WP-CLI to easily create database dumps without sensitive data, i.e. customers, users and/or orders.
License GPL-2.0-or-later
Informations about the package strip-db-dump
WP-CLI Strip Database Dump
This is a tiny plugin, which adds shorthands to WP-CLI which allows you to easily create database dumps and exclude sensitive data.
The following options are available:
--users: excludes thewp_usersandwp_usermetatables.--customers: excludes Customer related tables for supported 3rd party plugins.--orders: excludes Order related tables for supported 3rd party plugins.--all: exclude all of the above.
After running the command, 2 separate database exports are created:
[your-filename]-1.sqlcontaining all tables where data should be retained.[your-filename]-2.sqlcontaining all tables where all data should be stripped.
[!IMPORTANT] The created DB dumps must be imported in the provided order.
Usage
To create a database that excludes orders, customers and users and save it one directory up from the current directory, run it as follows:
`
To just strip customer data and store the dump in the current directory, run:
`
[!NOTE] It's not required to append a file extension to the filename argument.
If no filename is provided, a random one will be generated and saved in WordPress' root directory.
[!IMPORTANT] When the
--usersparameter is added to the command, theuserstable will be empty when importing it to your database. This means you need to create at least a new administrator user after importing the generated table. This can be done using the following WP-CLI command:wp user create username [email protected] --role=administrator.
3rd Party Plugin Support
The plugin currently removes sensitive data (i.e. any data containing personal information) for the following plugins:
- AffiliateWP
- Easy Digital Downloads
- WooCommerce
- WPForms
[!TIP] If You want this plugin to support more 3rd party plugins, feel free to submit a pull request!
As of v1.1.1 adding support for additional 3rd party plugins is easy. It's a matter of adding a class to
src/Compatibility and implementing this plugin's different interfaces along with their required methods. If your
plugin requires truncating of Orders and Customers tables, your Compatibility class should implement the
CustomersCompatibilityInterface and the OrdersCompatibilityInterface.
Each method
should return an array of corresponding table names without prefix! Then, add the new class to the corresponding
handlers in Main and you're ready to submit your PR! :-)
Installation
Download the latest release from the Releases page (or click the link) and install it in WordPress:
- Navigate to your Administrator area,
- Go to Plugins >> Add New Plugin
- Click the Upload Plugin button in the top-left of the screen
- Browse... to the ZIP file and install it by clicking Install Now.