From 57811df843859619a95e98191f1565896864d911 Mon Sep 17 00:00:00 2001 From: Kevin Cristiano Date: Thu, 21 Nov 2019 15:12:01 -0500 Subject: [PATCH] dev/core/1412 CiviMail sent via wp-cli and cron mangles mailing urls on WP --- CRM/Utils/System/WordPress.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 382892d314b6..30bb9f98164b 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -558,23 +558,10 @@ public function cmsRootPath() { } } 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;