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

Force reload of CSS/JS after running rebuildMenuAndCaches

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Labels:
      None

      Description

      I observed a weird phenomenon with /civicrm/profile-editor. On my localhost, it works fine. On sandbox.drupal.civicrm.org, it works if I use Firefox and Cmd-Shft-R, but otherwise it doesn't work. However, when I hacked CRM_Core_Resources to make the URLs arbitrarily different, it suddenly worked again. I believe that an overly zealous HTTP cache prevents reloading.

      In many applications (including Drupal), this is solved by appending a revision-code or nonce-value to CSS/JS URLs. The revision-code should be changed whenever new code is deployed. We don't exactly receive a hook whenever a CSS/JS file is deployed, so – as a substitute – we can change the code whenever the cache is cleared.

      Key changes:

      • Update Resources::addScriptFile() to append the code
      • Update Resources::addStyleFile() to append the code
      • Update Invoke::rebuildMenuAndCaches() to change the code

        Attachments

          Activity

            People

            • Assignee:
              timotten Tim Otten
              Reporter:
              timotten Tim Otten
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: