Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-18144

ckeditor customization does not work when using sites/example.org/files/civicrm, [civicrm.files] seems wrong

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 4.7.2
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      I was testing the new CKeditor config interface, but my changes were never reflected in the interface.

      Digging further, I found that CiviCRM was trying to load:
      https://example.org/sites/default/files/civicrm/persist/crm-ckeditor-config.js

      instead of:
      https://example.org/sites/example.org/files/civicrm/persist/crm-ckeditor-config.js

      Looking in the code, it seems that it tries to use [civicrm.files], and this resolves to https://example.org/sites/default/files

      Civi/Core/Paths:

        public function __construct() {
          $this
            ->register('civicrm.root', function () {
              return \CRM_Core_Config::singleton()->userSystem->getCiviSourceStorage();
            })
            ->register('civicrm.files', function () {
              return \CRM_Core_Config::singleton()->userSystem->getDefaultFileStorage();
            })
            // ...
        }
      

      CRM/Utils/System/Base.php :

        public function getDefaultFileStorage() {
           // ...
          elseif ($this->is_drupal) {
            $siteName = $config->userSystem->parseDrupalSiteName($civicrm_root);
            if ($siteName) {
              $filesURL = $baseURL . "sites/$siteName/files/civicrm/";
            }
            else {
              $filesURL = $baseURL . "sites/default/files/civicrm/";
            }
            // ...
        }
      

      However, how can the code guess the $siteName from the $civicrm_root ?

      $siteName = $config->userSystem->parseDrupalSiteName($civicrm_root);
      

      In my case, the $civicrm_root is /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mlutfy Mathieu Lutfy
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: