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-19303 - Drupal - Fix computation of civicrm.files on multisite #10511

Merged
merged 2 commits into from
Jun 16, 2017

Conversation

totten
Copy link
Member

@totten totten commented Jun 15, 2017

Description

Improve computation of [civicrm.files] URL and path when using Drupal
multisite.

A good way to test this is to open multiple tabs:

  • Open civicrm/admin/setting/url?reset=1 (one tab for each site)
  • Open civicrm/admin/setting/path?reset=1 (one tab for each site)
  • In each tab, click the "?" help icon and view the variable definitions

Before

The [civicrm.files] path/URL would always return the default
(e.g. http://example.org/sites/default/civicrm/files).

The path and URL for [civicrm.files] and [civicrm.root] are always computed.

After

If a folder named sites/{$NAME}/civicrm/files exists, it
will be used. Otherwise, the folder sites/default/files/civicrm
will be used.

The path and URL for [civicrm.files] and [civicrm.root] are computed by default. However, as a last-resort, you can explicitly set these variables in civicrm.settings.php, as in:

$GLOBALS['civicrm_paths']['civicrm.files'] = array(
  'path' => '/var/www/dmaster/civifiles/',
  'url' => 'http://dmaster.l/civifiles/',
);

totten added 2 commits June 15, 2017 01:27
A few changes:
 * Move logic out of `CRM_Utils_System_Base` to `CRM_Utils_System_DrupalBase`
   so that it's easier to read.
 * Update `[civicrm.files]`:  First, try to use `sites/{$name}/files/civicrm`.
   Otherwise, use `sites/default/files/civicrm`.
    * Note: The `$name` is parsed/validated the same way as `civicrm.config.php`.
      It takes the full HTTP_HOST and then tries various substrings.
 * Update `[civicrm.root]`:  Compare `$civicrm_root` and `cmsRootPath()`
   to determine the relative path.  Then, combine `CIVICRM_UF_BASEURL` with
   relpath.  (This is the same as WordPress.)
@seamuslee001
Copy link
Contributor

@totten I tested this on AUG's system last night and appeared to work for us I couldn't see any obvious issues

@totten totten changed the title CRM-19303 - Drupal - Improve computation of civicrm.files CRM-19303 - Drupal - Fix computation of civicrm.files on multisite Jun 16, 2017
@totten totten merged commit 652ccfe into civicrm:master Jun 16, 2017
@totten totten deleted the master-19303 branch June 16, 2017 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants