General help

Cannot click the link "Add an activity or resource" after upgrading to Moodle 2.4

Picture of CP Lau
Cannot click the link "Add an activity or resource" after upgrading to Moodle 2.4

We are currently using Moodle 2.3.1. However, after upgrading it to Moodle 2.4, some users could not click the link "Add an activity or resource" in some computers. Some computers worked again after resetting the browser cache. Some did not have this problem at all. Unluckily, some computers continued to show this problem in different browsers (i.e. IE, FF and Chrome) and resetting browser cache did not fix the problem. After investigation, this problem was due to javascript problem as the clickable feature of this link was created by javascript. This javascript problem could be solved by resetting all caches by Moodle system administrator in "System administration > Development".

Very interestingly, this problem did not occur in our testing environment.

As a matter of fact, this problem was also reported by another user using Moodle 2.1 ( Thus, this should not be a problem specific to Moodle 2.4 only. Just we don't know how and when this problem is triggered. Is it a bug of Moodle? Nonetheless, may i suggest Moodle to add this important step into the upgrade procedure such that users know how to troubleshoot when this problem happens?

Thank you for your kind attention.

Average of ratings: -
Picture of Andrew Nicols
Re: Cannot click the link "Add an activity or resource" after upgrading to Moodle 2.4
Core developersMoodle HQParticularly helpful MoodlersPlugin developersTesters

Hi CP,

In addition to the browser cache, Moodle also caches a large amount of content. This is typically content which it transforms in some way before delivering it to you. One thing which happens to a lot of the JS content in moodle is that it is minified. Rather than being minified each time a user requests the file, the content is minified once, and then saved to the moodle cache directory for later use.

What I've seen happen, though only on sites with multiple servers, is this:

  1. files are upgraded on server A
  2. the upgrade script is run. During the upgrade script, the moodle cache is cleared
  3. after the cache has been cleared but whilst the upgrade is still ongoing, a user accesses some content on server B causing the cache to be filled with out-of-date content
  4. server B is upgraded at a later date
  5. users requesting the content are served the file created by server B because the cache itself is valid

I'd say that because of the nature in which this bug is reached that it's not actually a bug in Moodle. It would be interesting to know more about your architecture and how you may have hit this issue.

As you suggest, the correct fix is to clear the Moodle cache.

The related Moodle 2.1 is the same kind of issue (though not with the 'Add an activity or resource' link since this didn't exist in 2.1). Looking at the opening of that discussion they too are using multiple servers and hence are seeing this issue.

It may be worth updating our documentation to reflect these changes as you suggest.

Best wishes,


Average of ratings: Useful (1)
Picture of CP Lau
Re: Cannot click the link "Add an activity or resource" after upgrading to Moodle 2.4

Thank you for your reply Andrew. Yes, we are running multiple web servers. We first use version 2.1, then upgraded to 2.2 and 2.3. We did not encounter this problem in the previous versions although someone reported they did. We had this problem only after upgrading to 2.4 from 2.3. 

I understand Moodle has its cache mechanism for javascript and other static contents long before the MUC of 2.4. May i ask how should we setup the Moodle cache folder in the multiple web servers environment? a local cache folder or a shared cache folder? Based on our test findings and other's saying about MUC (, we believe it should be the first one. May i have your valuable advice?

Once again, thank you very much for your great help. 

Average of ratings: -