dev/core/1412 CiviMail sent via wp-cli and cron mangles mailing urls on WP
authorKevin Cristiano <kcristiano@kcristiano.com>
Thu, 21 Nov 2019 20:12:01 +0000 (15:12 -0500)
committerKevin Cristiano <kcristiano@kcristiano.com>
Thu, 21 Nov 2019 20:12:01 +0000 (15:12 -0500)
CRM/Utils/System/WordPress.php

index 382892d314b62688942bcfdacbc56655b2324cc1..30bb9f98164b63eda444538338e8d1c549b854b5 100644 (file)
@@ -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;