Skip to content

Commit

Permalink
Use config/application.php constant for WP_CUBI_WEBHOOKS_SECRET
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Dargham committed Mar 22, 2023
1 parent 09b687b commit 22eff37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/DeployTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,15 @@ protected function rsync($fromHost, $fromUser, $fromPath, $toHost, $toUser, $toP

protected function sendWebhookHttpRequest($site_url, $webhook)
{
$this->loadWpConfig();

if (!defined('WP_CUBI_WEBHOOKS_SECRET')) {
return;
}

$url = self::trailingslashit($site_url);
$url .= "?wp-cubi-webhooks-run=" . $webhook;
$url .= "&wp-cubi-webhooks-secret=" . \RoboFile::WP_CUBI_WEBHOOKS_SECRET;
$url .= "&wp-cubi-webhooks-secret=" . WP_CUBI_WEBHOOKS_SECRET;

$cmd = new Command('curl');
$cmd = $cmd->arg($url)
Expand Down
11 changes: 11 additions & 0 deletions src/WordPressTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,15 @@ protected function wpActivatePlugins()
->arg('view_query_monitor')
->execute();
}

protected function loadWpConfig()
{
$config_vars = \RoboFile::ROOT . '/' . \RoboFile::PATH_FILE_CONFIG_VARS;
$config_application = \RoboFile::ROOT . '/' . \RoboFile::PATH_FILE_CONFIG_APPLICATION;
$config_local = \RoboFile::ROOT . '/' . \RoboFile::PATH_FILE_CONFIG_LOCAL;

defined('WP_CUBI_CONFIG') || define('WP_CUBI_CONFIG', require $config_vars);
require_once $config_application;
require_once $config_local;
}
}

0 comments on commit 22eff37

Please sign in to comment.