Commit 1409f57d authored by robertDouglass's avatar robertDouglass
Browse files

rob discovers hook_devel_cache and promptly simplifies the install and...

rob discovers hook_devel_cache and promptly simplifies the install and uninstall hooks for memcache.
parent f5dbe3fb
......@@ -5,30 +5,19 @@
* Add serialized field to cache tables.
*/
function memcache_install() {
$core = array('cache', 'cache_filter', 'cache_menu', 'cache_page');
$alltables = array_merge($core, module_invoke_all('devel_caches'));
switch ($GLOBALS['db_type']) {
case 'pgsql':
//db_add_column($ret, 'cache', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_filter', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_page', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_menu', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
foreach ($alltables as $table) {
db_add_column($ret, $table, 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
}
break;
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {cache} ADD serialized int(1) NOT NULL default '0'");
db_query("ALTER TABLE {cache_filter} ADD serialized int(1) NOT NULL default '0'");
db_query("ALTER TABLE {cache_page} ADD serialized int(1) NOT NULL default '0'");
db_query("ALTER TABLE {cache_menu} ADD serialized int(1) NOT NULL default '0'");
if (db_table_exists('cache_views')) {
db_query("ALTER TABLE {cache_views} ADD serialized int(1) NOT NULL default '0'");
}
if (db_table_exists('cache_blocks')) {
db_query("ALTER TABLE {cache_blocks} ADD serialized int(1) NOT NULL default '0'");
}
if (db_table_exists('cache_content')) {
db_query("ALTER TABLE {cache_content} ADD serialized int(1) NOT NULL default '0'");
}
if (db_table_exists('cache_reptag')) {
db_query("ALTER TABLE {cache_reptag} ADD serialized int(1) NOT NULL default '0'");
foreach ($alltables as $table) {
db_query("ALTER TABLE {$table} ADD serialized int(1) NOT NULL default '0'");
}
break;
}
......@@ -38,32 +27,17 @@ function memcache_install() {
* Remove serialized field from cache tables
*/
function memcache_uninstall() {
$core = array('cache', 'cache_filter', 'cache_menu', 'cache_page');
$alltables = array_merge($core, module_invoke_all('devel_caches'));
switch ($GLOBALS['db_type']) {
case 'pgsql':
//db_add_column($ret, 'cache', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_filter', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_page', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
//db_add_column($ret, 'cache_menu', 'serialized', 'int(1)', array('default' => "'0'", 'not null' => TRUE));
break;
break;
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {cache} DROP serialized");
db_query("ALTER TABLE {cache_filter} DROP serialized");
db_query("ALTER TABLE {cache_page} DROP serialized");
db_query("ALTER TABLE {cache_menu} DROP serialized");
if (db_table_exists('cache_views')) {
db_query("ALTER TABLE {cache_views} DROP serialized");
foreach ($alltables as $table) {
db_query("ALTER TABLE {$table} DROP serialized");
}
if (db_table_exists('cache_blocks')) {
db_query("ALTER TABLE {cache_blocks} DROP serialized");
}
if (db_table_exists('cache_content')) {
db_query("ALTER TABLE {cache_content} DROP serialized");
}
if (db_table_exists('cache_reptag')) {
db_query("ALTER TABLE {cache_reptag} DROP serialized");
}
break;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment