diff --git a/app/ProviderAction.php b/app/ProviderAction.php index cbb193c..bb1cf26 100644 --- a/app/ProviderAction.php +++ b/app/ProviderAction.php @@ -247,7 +247,7 @@ public function run() { } } \CaptainCore\ProcessLog::insert( "Created site", $site_id ); - captaincore_run_background_command( "site sync $site_id --update-extras" ); + \CaptainCore\Run::CLI("site sync $site_id --update-extras"); } } diff --git a/app/Run.php b/app/Run.php index c78fc25..52c35dc 100644 --- a/app/Run.php +++ b/app/Run.php @@ -6,7 +6,7 @@ class Run { protected $account_id = ""; - public static function CLI( $command = "" ) { + public static function CLI( $command = "", $background = false ) { if ( empty( $command ) ) { return; @@ -29,7 +29,11 @@ public static function CLI( $command = "" ) { ]; // Add command to dispatch server - $response = wp_remote_post( CAPTAINCORE_CLI_ADDRESS . "/run", $data ); + $url = CAPTAINCORE_CLI_ADDRESS . "/run"; + if ( $background ) { + $url = CAPTAINCORE_CLI_ADDRESS . "/run/background"; + } + $response = wp_remote_post( $url, $data ); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); return [];