Ok, some updates relative to our workflow.
We have a fully automated site creation workflow and we need to figure how to manage the licensing of commandui correctly.
Sites are autogenerated locally through a code generator then a bunch of script shells using essentially WP cli are executed to provision the default state of the website depending on the customer and then they are auto deployed to a production environment on a temporary domain then when the site is ready the final domain is used.
Here is how we handle the licensing:
Currently in initialization process, we set commandui licence in db:
wp option set commandui_license_key "ak_***************"
then
wp plugin activate commandui
wp option get commandui_activations
array (
'hash' =>
array (
'first_connected' => 1765982027,
'connection_key' => 'ck_****',
'maybe_original_fingerprint' => 'domain.com.docker',
),
)
Save DB, deploy DB to (pre)production env.
In deployment process,
wp plugin deactivate commandui && wp plugin activate commandui
The license is created in (pre)production:
wp option get commandui_activations
array (
'hash' =>
array (
'first_connected' => 1765982027,
'connection_key' => 'ck_1****',
'maybe_original_fingerprint' => 'domain.com.docker',
),
'hash2' =>
array (
'first_connected' => 1765985608,
'connection_key' => 'ck_2****',
'maybe_original_fingerprint' => 'domain.com.preprod.agency.com',
),
)
So basically, the solution seems to do :
- wp plugin activate commandui locally before any deployment
- automate wp plugin de/activate on deployments
That's not a big deal, but honestly I would prefer a dedicated "license_activate" / "license_check" command because it will prevent the deactivation => activation process which is slow by nature because it triggers a ton of hooks.
I gave a look quickly at the commandui plugin file, and it looks like the effort to achieve that is minimal. Basically, the function defined in the register_activation_hook should be defined externally. So we can even trigger it in a custom deployment hook or though a WP CLI. Ideally, the WP CLI is also bundled in your plugin.
Thanks for having worked on that issue quickly,