diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index 88ab5c43863a..a55dd9b126ed 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -606,6 +606,11 @@ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = * @inheritDoc */ public function cmsRootPath($scriptFilename = NULL) { + global $civicrm_paths; + if (!empty($civicrm_paths['cms.root']['path'])) { + return $civicrm_paths['cms.root']['path']; + } + $cmsRoot = NULL; $valid = NULL; diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 54a3d0c007ed..aae0fbfe1682 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -543,6 +543,12 @@ public function cmsRootPath($scriptFilename = NULL) { // drush anyway takes care of multisite install etc return drush_get_context('DRUSH_DRUPAL_ROOT'); } + + global $civicrm_paths; + if (!empty($civicrm_paths['cms.root']['path'])) { + return $civicrm_paths['cms.root']['path']; + } + // CRM-7582 $pathVars = explode('/', str_replace('//', '/', diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index 8d931aa04560..4e5a44243faf 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -483,6 +483,11 @@ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = * @return NULL|string */ public function cmsRootPath($path = NULL) { + global $civicrm_paths; + if (!empty($civicrm_paths['cms.root']['path'])) { + return $civicrm_paths['cms.root']['path']; + } + if (defined('DRUPAL_ROOT')) { return DRUPAL_ROOT; } diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index 8162ac8a615c..5f3995c3d030 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -694,6 +694,11 @@ public function getLoginDestination(&$form) { * local file system path to CMS root, or NULL if it cannot be determined */ public function cmsRootPath() { + global $civicrm_paths; + if (!empty($civicrm_paths['cms.root']['path'])) { + return $civicrm_paths['cms.root']['path']; + } + list($url, $siteName, $siteRoot) = $this->getDefaultSiteSettings(); $includePath = "$siteRoot/libraries/cms/version"; if (file_exists("$includePath/version.php")) { diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index d49c7d77b470..bfab40510f32 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -481,6 +481,11 @@ public function validInstallDir($dir) { * local file system path to CMS root, or NULL if it cannot be determined */ public function cmsRootPath() { + global $civicrm_paths; + if (!empty($civicrm_paths['cms.root']['path'])) { + return $civicrm_paths['cms.root']['path']; + } + $cmsRoot = $valid = NULL; if (defined('CIVICRM_CMSDIR')) { if ($this->validInstallDir(CIVICRM_CMSDIR)) {