You are here

function memcache_install in Memcache API and Integration 5

Same name and namespace in other branches
  1. 5.2 memcache.install \memcache_install()

Add serialized field to cache tables.

File

./memcache.install, line 6

Code

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':
      foreach ($alltables as $table) {
        db_query("DELETE FROM {{$table}}");
        db_query("ALTER TABLE {{$table}} ADD serialized smallint NOT NULL default '0'");
      }
      break;
    case 'mysql':
    case 'mysqli':
      foreach ($alltables as $table) {
        db_query("DELETE FROM {{$table}}");
        db_query("ALTER TABLE {{$table}} ADD serialized int(1) NOT NULL default '0'");
      }
      break;
  }
}