From 9470e1fb51ef317ee6d3f211af1bbf99e91431db Mon Sep 17 00:00:00 2001 From: Kevin Cristiano <kcristiano@kcristiano.com> Date: Thu, 21 Nov 2019 12:31:14 -0500 Subject: [PATCH] CiviMail sent via wp-cli and cron mangles mailing urls Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com> --- civicrm/CRM/Utils/System/WordPress.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index 9c074c5a88..87562d56ba 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -558,23 +558,10 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { } } else { - $pathVars = explode('/', str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME'])); - - //might be windows installation. - $firstVar = array_shift($pathVars); - if ($firstVar) { - $cmsRoot = $firstVar; - } - - //start w/ csm dir search. - foreach ($pathVars as $var) { - $cmsRoot .= "/$var"; - if ($this->validInstallDir($cmsRoot)) { - //stop as we found bootstrap. - $valid = TRUE; - break; - } - } + $setting = Civi::settings()->get('wpLoadPhp'); + $path = str_replace('wp-load.php', '', $setting); + $cmsRoot = rtrim($path, '/\\'); + $valid = TRUE; } return ($valid) ? $cmsRoot : NULL; -- GitLab