diff --git includes/cache.inc includes/cache.inc index c0020d6..355c98f 100644 --- includes/cache.inc +++ includes/cache.inc @@ -24,9 +24,9 @@ function _views_include_default_views() { /** * Fetch Views' data from the cache */ -function _views_fetch_data($table = NULL) { +function _views_fetch_data($table = NULL, $reset = FALSE) { static $cache = NULL; - if (!isset($cache)) { + if (!isset($cache) || $reset) { $start = views_microtime(); // NOTE: This happens whether we retrieve them from cache or otherwise. views_include_handlers(); @@ -63,9 +63,9 @@ function _views_fetch_data($table = NULL) { /** * Fetch the plugin data from cache. */ -function _views_fetch_plugin_data($type = NULL, $plugin = NULL) { +function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) { static $cache = NULL; - if (!isset($cache)) { + if (!isset($cache) || $reset) { $start = views_microtime(); views_include_handlers(); diff --git views.module views.module index ebe7df4..65b964e 100644 --- views.module +++ views.module @@ -560,8 +560,8 @@ function views_include($file) { /** * Load views files on behalf of modules. */ -function views_module_include($file) { - foreach (views_get_module_apis() as $module => $info) { +function views_module_include($file, $reset = FALSE) { + foreach (views_get_module_apis($reset) as $module => $info) { if (file_exists("./$info[path]/$module.$file")) { require_once "./$info[path]/$module.$file"; } @@ -571,9 +571,9 @@ function views_module_include($file) { /** * Get a list of modules that support the current views API. */ -function views_get_module_apis() { +function views_get_module_apis($reset = FALSE) { static $cache = NULL; - if (!isset($cache)) { + if (!isset($cache) || $reset) { $cache = array(); foreach (module_implements('views_api') as $module) { $function = $module . '_views_api'; @@ -622,10 +622,10 @@ function views_add_js($file) { /** * Load views files on behalf of modules. */ -function views_include_handlers() { +function views_include_handlers($reset = FALSE) { static $finished = FALSE; // Ensure this only gets run once. - if ($finished) { + if ($finished && !$reset) { return; } @@ -640,19 +640,19 @@ function views_include_handlers() { /** * Load default views files on behalf of modules. */ -function views_include_default_views() { +function views_include_default_views($reset = FALSE) { static $finished = FALSE; // Ensure this only gets run once. - if ($finished) { + if ($finished && !$reset) { return; } // Default views hooks may be in the normal handler file, // or in a separate views_default file at the discretion of // the module author. - views_include_handlers(); + views_include_handlers($reset); - _views_include_default_views(); + _views_include_default_views($reset); $finished = TRUE; } @@ -711,9 +711,9 @@ function views_get_handler($table, $field, $key, $override = NULL) { /** * Fetch Views' data from the cache */ -function views_fetch_data($table = NULL) { +function views_fetch_data($table = NULL, $reset = FALSE) { views_include('cache'); - return _views_fetch_data($table); + return _views_fetch_data($table, $reset); } // ----------------------------------------------------------------------- @@ -722,16 +722,16 @@ function views_fetch_data($table = NULL) { /** * Fetch the plugin data from cache. */ -function views_fetch_plugin_data($type = NULL, $plugin = NULL) { +function views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) { views_include('cache'); - return _views_fetch_plugin_data($type, $plugin); + return _views_fetch_plugin_data($type, $plugin, $reset); } /** * Get a handler for a plugin */ -function views_get_plugin($type, $plugin) { - $definition = views_fetch_plugin_data($type, $plugin); +function views_get_plugin($type, $plugin, $reset = FALSE) { + $definition = views_fetch_plugin_data($type, $plugin, $reset); if (!empty($definition)) { return _views_create_handler($definition, $type); }