diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -45,7 +45,6 @@ function xmldb_main_upgrade($oldversion=0) {
                 set_field('course_modules', 'visible', '0', 'module', $module->id);
     
                 require_once($CFG->dirroot.'/course/lib.php');
-                rebuild_course_cache();  // Rebuld cache for all modules because they might have changed
             }
         }
     }
