From d33e2f7dafa7d43d355d46c3d485f5d0ebe50a4f Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 28 Jun 2017 20:29:54 +1200 Subject: [PATCH 1/2] CRM-20780 Add drupal option to define CMS_ROOT --- CRM/Utils/System/Drupal.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 1c9d8b288057..b9c99989e761 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -590,6 +590,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('//', '/', From a93a0366ac159030501240c73d12ea47f7b71392 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 30 Jun 2017 14:49:57 -0700 Subject: [PATCH 2/2] 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 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)) {