CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Multi-Site functionality »
  • Directory settings not read correctly for multi-site
Pages: [1]

Author Topic: Directory settings not read correctly for multi-site  (Read 7672 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Directory settings not read correctly for multi-site
August 09, 2012, 02:51:05 am
The civicrm_settings table stores Directory settings for each Domain in a multi-site installation. However, when read from the database, the Domain is ignored.

See CRM/Core/BAO/Setting.php and retrieveDirectoryAndURLPreferences() starting on line 458 (v4.1.3). There is no reference to Domain in this function, despite the table containing Directory settings stored separately for each Domain. The $sql returns the Directory settings for all the Domains, so it is the "last ones read" that are used.

I suggest the query is changed to ...
Code: [Select]
    $sql = "
SELECT name, group_name, value
FROM   civicrm_setting
WHERE  domain_id = %1
AND    ( group_name = %2
OR       group_name = %3 )
";
    $sqlParams = array(1 => array(CRM_Core_Config::domainID(), 'Integer'),
      2 => array(self::DIRECTORY_PREFERENCES_NAME, 'String'),
      3 => array(self::URL_PREFERENCES_NAME, 'String'),
    );

Also the function fixAndStoreDirAndURL() in the same file has a query that ignores the Domain. In this case, though, it seems that all that happens is that the settings for this Domain are repeated, once for each Domain. It's inefficient but not incorrect.

Ken
« Last Edit: August 09, 2012, 03:04:24 am by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Directory settings not read correctly for multi-site
August 09, 2012, 06:47:10 am
Note that retrieveDirectoryAndURLPreferences() is fixed in version 4.2.beta5.

fixAndStoreDirAndURL() remains inefficient but not incorrect.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Directory settings not read correctly for multi-site
August 09, 2012, 07:02:45 am
Here's a patch for fixAndStoreDirAndURL()

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Directory settings not read correctly for multi-site
September 29, 2012, 08:25:38 pm
Do the core team mind if I create an issue for the patch I supplied in the previous comment?

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Directory settings not read correctly for multi-site
September 30, 2012, 01:17:58 am
Quote
Do the core team mind if I create an issue for the patch I supplied in the previous comment?

i doubt it. i would do so and reference this post since that gets it one step closer to solving the issue for you.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: Directory settings not read correctly for multi-site
September 30, 2012, 03:26:56 am
http://issues.civicrm.org/jira/browse/CRM-10948

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Multi-Site functionality »
  • Directory settings not read correctly for multi-site

This forum was archived on 2017-11-26.