Skip to content

Commit

Permalink
Merge pull request #6 from totten/eileenmcnaughton-cms
Browse files Browse the repository at this point in the history
CRM-20780 - System::cmsRootPath() - Use the same override on all CMS's
  • Loading branch information
eileenmcnaughton authored Jun 30, 2017
2 parents d33e2f7 + a93a036 commit 9ac4f54
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CRM/Utils/System/Backdrop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions CRM/Utils/System/Drupal6.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('//', '/',
Expand Down
5 changes: 5 additions & 0 deletions CRM/Utils/System/Drupal8.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions CRM/Utils/System/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
5 changes: 5 additions & 0 deletions CRM/Utils/System/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 9ac4f54

Please sign in to comment.