g names are special cases, so encode them. if (strpos($tag, ',') !== FALSE || strpos($tag, '"') !== FALSE) { $tag = '"'. str_replace('"', '""', $tag) .'"'; } $encoded_tags[] = $tag; } return implode(', ', $encoded_tags); } /** * Flush all cached data on the site. * * Empties cache tables, rebuilds the menu cache and theme registries, and * invokes a hook so that other modules' cache data can be cleared as well. */ function drupal_flush_all_caches() { // Change query-strings on css/js files to enforce reload for all users. _drupal_flush_css_js(); drupal_clear_css_cache(); drupal_clear_js_cache(); system_theme_data(); drupal_rebuild_theme_registry(); menu_rebuild(); node_types_rebuild(); // Don't clear cache_form - in-progress form submissions may break. // Ordered so clearing the page cache will always be the last action. $core = array('cache', 'cache_block', 'cache_filter', 'cache_page'); $cache_tables = array_merge(module_invoke_all('flush_caches'), $core); foreach ($cache_tables as $table) { cache_clear_all('*', $table, TRUE); } } /** * Helper function to change query-strings on css/js files. * * Changes the character added to all css/js files as dummy query-string, * so that all browsers are forced to reload fresh files. We keep * 20 characters history (FIFO) to avoid repeats, but only the first * (newest) character is actually used on urls, to keep them short. * This is also called from update.php. */ function _drupal_flush_css_js() { $string_history = variable_get('css_js_query_string', '00000000000000000000'); $new_character = $string_history[0]; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; while (strpos($string_history, $new_character) !== FALSE) { $new_character = $characters[mt_rand(0, strlen($characters) - 1)]; } variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); }