Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20780 Add drupal option to define CMS_ROOT #10574

Merged
merged 3 commits into from
Jun 30, 2017

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 28, 2017

@seamuslee001
Copy link
Contributor

I'm ok with it

@totten
Copy link
Member

totten commented Jun 30, 2017

Why does this need a new constant? In civicrm.settings.php, can't one now say:

global $civicrm_paths;
$civicrm_paths['cms.root']['path'] = '/var/ww/foo';

@eileenmcnaughton
Copy link
Contributor Author

I can try that

@totten
Copy link
Member

totten commented Jun 30, 2017

Erm, responding to my own comment a bit...

  1. I do think it'll be long-term more coherent to handle path/url overrides through $civicrm_paths array.

  2. There are a few older bits of code which explicitly call cmsRootPath(), eg here or here. These call-paths don't currently respect the global $civicrm_paths. Either of these should solve that:

    • Search/replace. Most places currently calling cmsRootPath() should instead call Civi::paths()->getVariable('cms.root', 'path') or Civi::paths->getPath('[cms.root]/foo/bar')
    • Hotwire. Use a patch just like this one you wrote, but -- instead of reading CMS_ROOT -- read $GLOBALS['civicrm_paths']['cms.root']['path']. (Preferrably, reproduce this in each variant of CRM_Utils_System_*::cmsRootPath().)

@eileenmcnaughton
Copy link
Contributor Author

@totten kinda snap - I tried it & this worked find - so I'll swap to that

    global $civicrm_paths;
    if (!empty($civicrm_paths['cms.root']['path'])) {
      return $civicrm_paths['cms.root']['path'];
    }

@eileenmcnaughton
Copy link
Contributor Author

I have merged @totten addition & I'm taking that plus previous discussion as approval & adding merge-on-pass

@totten totten merged commit c9a664c into civicrm:master Jun 30, 2017
@eileenmcnaughton eileenmcnaughton deleted the cms branch July 2, 2017 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants