WPCloud Deploy Documentation

Action Hook: wpcd_command_wordpress-app_completed

do_action( "wpcd_command_{$this->get_app_name()}_{$status}", $id, $name,$base_command )

This is a variable action hook whose name changes based on the status of the command being run.  See discussion below for more information.

Example Hook

add_action( "wpcd_command_wordpress-app_completed", 'my_function', 10, 3 );
public function my_function( $id, $name,$base_command ) { 
    //your code here 
}

Discussion

This hook is fired after any long-running command is completed. Long running commands are actions like deploying servers and websites (the ones that usually include the black ‘terminal’ screen.)

The name of the hook depends on the status and the app name being run.  For WordPress actions, the app name will always be wordpress-app.  The most common status you use will be completed.

Unless you want to run an action after every single long-running command, you should check the $name variable and base your code on the result of that check.

If you are looking to run actions after a server is deployed you can use this hook.  This is NOT the hook to use if you need to run actions after a WordPress site has been deployed. For that you should use the wpcd_command_wordpress-app_completed_after_cleanup hook instead.

  • $id is the post_id of the SERVER custom post type record.  The post id for the related APP is NOT available here.   Use the wpcd_command_{$this->get_app_name()}_completed_after_cleanup hook instead if you need the APP as well.
  • $name is the name of the command being run but it can also include a random number unique to the current process.
  • $base_command is the command name such as change_domain, prepare_server or install_wp.

Reference

Located in:

  • Function: update_command_status
  • File: /includes/core/apps/class-wpcd-app.php

Availability

This hook is only available in WPCD versions 4.2.5 or later.

 

Share: