Softaculous


Topic : Is it possible to automatically run some wp-cli commands after staging


Posted By: ratcliffe_mike on April 30, 2021, 11:50 am
Is it possible to automatically run some wp-cli commands after staging. This would make your Wordpress staging even more useful.
This is my ideal workflow:
  1. Click "Create Staging" button.
  2. The staging instance is created and then two wp_cli commands are automatically run: i) wp plugin deactivate plugin1 plugin2 ii) wp db query "SQL query to update plugin keys"
  3. Make changes on staging instance.
  4. Click "Push to live"
  5. The staging instance is piushed to live and then two wp_cli commands are automatically run: i) wp plugin activate plugin1 plugin2 ii) wp db query "SQL query to update plugin keys"

Posted By: Brijesh on May 14, 2021, 2:32 pm | Post: 1
Hi,

Sorry for the delay in response.

Yes this is possible but you will need root access to the server to configure this.

You can do the above steps by using filters in Softaculous. Filters are PHP files which you can configure to execute your PHP function when a particular task is done in Softaculous. You can also execute shell commands using shell_exec or exec functions.

You can use the post_staging filter to execute code after staging is done :
https://www.softaculous.com/docs/developers/filters/#post_staging

You can use the post_pushtolive filter to execute code after push to live is done :
https://www.softaculous.com/docs/developers/filters/#post_pushtolive


-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool

Posted By: ratcliffe_mike on May 14, 2021, 2:41 pm | Post: 2
Perfect, that looks like exactly what I need... thanks!

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.