Created
February 8, 2012 17:35
-
-
Save anonymous/1771515 to your computer and use it in GitHub Desktop.
Domain access find other cache bins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implementation of hook_flush_caches(). | |
*/ | |
function calarts_domain_specific_customizations_flush_caches() { | |
if (!module_exists('domain')) { | |
return array(); | |
} | |
global $db_url; | |
$connect_url = $db_url; | |
static $not_first_time; | |
if ($not_first_time) { | |
return array(); | |
} | |
$connect_url = parse_url($connect_url); | |
$connect_path = substr($connect_url['path'], 1); | |
$not_first_time = TRUE; | |
$core = array('cache', 'cache_block', 'cache_filter', 'cache_page'); | |
$cache_tables = array_merge(module_invoke_all('flush_caches'), $core); | |
$new_cache_tables = array(); | |
foreach ($cache_tables as $cache_table) { | |
// Until the db_table_exists issue is solved, use this method | |
if (db_fetch_object(db_query("SHOW TABLES FROM $connect_path LIKE '". db_escape_table($cache_table) ."'"))) { | |
$new_cache_tables[] = $connect_path .'.'. $cache_table; | |
} | |
} | |
$domains = domain_domains(); | |
foreach ($domains as $domain_id => $domain_values) { | |
foreach ($cache_tables as $cache_table) { | |
$domain_table = 'domain_'. $domain_id .'_'. $cache_table; | |
if (db_table_exists($domain_table)) { | |
$new_cache_tables[] = $domain_table; | |
} | |
} | |
} | |
return $new_cache_tables; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment