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

Need to be able to identify public/private files directories if Apache isn't being used

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.7.19
    • Fix Version/s: None
    • Component/s: Core CiviCRM
    • Labels:
    • Versioning Impact:
      None (no code merged)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      In civicrm.settings.php I've set CIVICRM_TEMPLATE_COMPILEDIR to be a private directory:

      define('CIVICRM_TEMPLATE_COMPILEDIR', '/full/path/sites/default/files/private/civicrm/templates_c/');

       I'm using Drupal 7.

      I'm having issues with making a customized CKEditor js file. Even though the code in CRM/Admin/Page/CKEditorConfig.php seems to save it in, and call it from I[civicrm.files]. It seems to actually be looking for the js outside the private directory.

      The file is saved in sites/default/files/private/civicrm/persist, CKEditor is trying to find it in sites/default/files/civicrm/persist.

      I've tested this on a fresh install.

       

      I suspect it may have something to do with this function in CRM_Utils_System_Base, which is assuming a hardcoded: sites/default/files/civicrm location:

       

      public function getDefaultFileStorage() {
       global $civicrm_root;
       $config = CRM_Core_Config::singleton();
       $baseURL = CRM_Utils_System::languageNegotiationURL($config->userFrameworkBaseURL, FALSE, TRUE);
      $filesURL = NULL;
       $filesPath = NULL;
      if ($config->userFramework == 'Joomla') {
       // gross hack
       // we need to remove the administrator/ from the end
       $tempURL = str_replace("/administrator/", "/", $baseURL);
       $filesURL = $tempURL . "media/civicrm/";
       }
       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/";
       }
       }
       elseif ($config->userFramework == 'UnitTests') {
       $filesURL = $baseURL . "sites/default/files/civicrm/";
       }
       else {
       throw new CRM_Core_Exception("Failed to locate default file storage ($config->userFramework)");
       }
      return array(
       'url' => $filesURL,
       'path' => CRM_Utils_File::baseFilePath(),
       );
       }
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              herb@freeform Herb
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: