/** * Invalidates browser caches and cached data in temp * @return void */ function purge_all_caches() { global $CFG; reset_text_filters_cache(); js_reset_all_caches(); theme_reset_all_caches(); get_string_manager()->reset_caches(); // purge all other caches: rss, simplepie, etc. remove_dir($CFG->dataroot . '/cache', true); // make sure cache dir is writable, throws exception if not make_upload_directory('cache'); clearstatcache(); }
/** * Invalidates browser caches and cached data in temp. * * IMPORTANT - If you are adding anything here to do with the cache directory you should also have a look at * {@link phpunit_util::reset_dataroot()} * * @return void */ function purge_all_caches() { global $CFG, $DB; reset_text_filters_cache(); js_reset_all_caches(); theme_reset_all_caches(); get_string_manager()->reset_caches(); core_text::reset_caches(); if (class_exists('core_plugin_manager')) { core_plugin_manager::reset_caches(); } // Bump up cacherev field for all courses. try { increment_revision_number('course', 'cacherev', ''); } catch (moodle_exception $e) { // Ignore exception since this function is also called before upgrade script when field course.cacherev does not exist yet. } $DB->reset_caches(); cache_helper::purge_all(); // Purge all other caches: rss, simplepie, etc. clearstatcache(); remove_dir($CFG->cachedir . '', true); // Make sure cache dir is writable, throws exception if not. make_cache_directory(''); // This is the only place where we purge local caches, we are only adding files there. // The $CFG->localcachedirpurged flag forces local directories to be purged on cluster nodes. remove_dir($CFG->localcachedir, true); set_config('localcachedirpurged', time()); make_localcache_directory('', true); \core\task\manager::clear_static_caches(); }
/** * Invalidates browser caches and cached data in temp * @return void */ function purge_all_caches() { global $CFG; reset_text_filters_cache(); js_reset_all_caches(); theme_reset_all_caches(); get_string_manager()->reset_caches(); textlib::reset_caches(); // purge all other caches: rss, simplepie, etc. remove_dir($CFG->cachedir . '', true); // make sure cache dir is writable, throws exception if not make_cache_directory(''); // hack: this script may get called after the purifier was initialised, // but we do not want to verify repeatedly this exists in each call make_cache_directory('htmlpurifier'); }