From a93a0366ac159030501240c73d12ea47f7b71392 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 30 Jun 2017 14:49:57 -0700 Subject: [PATCH] CRM-20780 - System::cmsRootPath() - Use the same override on all CMS's --- CRM/Utils/System/Backdrop.php | 5 +++++ CRM/Utils/System/Drupal6.php | 6 ++++++ CRM/Utils/System/Drupal8.php | 5 +++++ CRM/Utils/System/Joomla.php | 5 +++++ CRM/Utils/System/WordPress.php | 5 +++++ 5 files changed, 26 insertions(+) diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index 88ab5c4386..a55dd9b126 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -606,6 +606,11 @@ AND u.status = 1 * @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 54a3d0c007..aae0fbfe16 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -543,6 +543,12 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { // 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 8d931aa045..4e5a44243f 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -483,6 +483,11 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { * @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 8162ac8a61..5f3995c3d0 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -694,6 +694,11 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * 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 d49c7d77b4..bfab40510f 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -481,6 +481,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { * 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)) { -- 2.25.1