williarin / wordpress-anonymizer

Anonymize a WordPress database without a WordPress installation
MIT License
18 stars 1 forks source link

Is there an integration as a WordPress plugin available? #1

Open patrickheck opened 2 years ago

patrickheck commented 2 years ago

Thanks for your great work with this! I'd like to use this as a way to clean up staging and test environments. Unfortunately, those usually don't have docker or composer available. So, I was wondering if you know of anyone who integrated your work into a WordPress plugin? I'd prefer to use it as a wp-cli command, since that should still be quite fast. Thanks! Patrick

williarin commented 2 years ago

Thanks! I haven't used it within WordPress but a couple months ago I made a plugin based on another library I made. You can take a look on how it's done: https://github.com/williarin/wordpress-simple-queries

The plugin is built by Github actions, it creates a prefixed vendor directory so there is no conflict with other plugins, and creates a release with the pre-installed vendors, so you don't need composer when you put it in your WordPress plugins folder.

So if you use this technique to create a plugin based on this lib, you can easily create a WP-CLI command out of it.

  1. Create a composer.json file with Imposter Plugin and this lib as dependencies https://github.com/williarin/wordpress-simple-queries/blob/b727da8397314942012781d261d8a0db3dd71aaf/composer.json#L31:L39

  2. Create the plugin php file and your WP-CLI class https://github.com/williarin/wordpress-simple-queries/blob/b727da8397314942012781d261d8a0db3dd71aaf/simple-queries.php

  3. Create the final plugin with Github actions https://github.com/williarin/wordpress-simple-queries/blob/b727da8397314942012781d261d8a0db3dd71aaf/.github/workflows/build_release.yml

patrickheck commented 2 years ago

Hi @williarin , thanks a lot for taking the time to reply in such a detailed way. I will try to implement this as soon as I find the time. Best Patrick