/[drupal]/contributions/modules/advcache/advcache.install
ViewVC logotype

Diff of /contributions/modules/advcache/advcache.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5 by mikejoconnor, Thu Feb 26 13:39:12 2009 UTC revision 1.5.2.1 by mikejoconnor, Thu Feb 26 14:07:09 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    function advcache_schema() {
 function advcache_install() {  
3    $tables = array('node', 'comment', 'taxonomy', 'path', 'search', 'forum', 'advcache_block');    $tables = array('node', 'comment', 'taxonomy', 'path', 'search', 'forum', 'advcache_block');
4    switch ($GLOBALS['db_type']) {    $schema = array();
5      case 'mysql':    foreach ($tables as $table) {
6      case 'mysqli':      $schema['cache_'.$table] = array(
7        foreach ($tables as $table) {      'description' => t('!table cache table.', array('table' => $table)),
8          db_query("CREATE TABLE {cache_$table} (      'fields' => array(
9            cid varchar(255) NOT NULL default '',        'cid' => array(
10            data longblob,          'description' => t('Primary Key: Unique cache ID.'),
11            expire int NOT NULL default '0',          'type' => 'varchar',
12            created int NOT NULL default '0',          'length' => 255,
13            headers text,          'not null' => TRUE,
14            serialized int(1) NOT NULL default '0',          'default' => ''),
15            PRIMARY KEY (cid),        'data' => array(
16            INDEX expire (expire)          'description' => t('A collection of data to cache.'),
17          ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");          'type' => 'blob',
18        }          'not null' => FALSE,
19        break;          'size' => 'big'),
20          'expire' => array(
21      case 'pgsql':          'description' => t('A Unix timestamp indicating when the cache entry should expire, or 0 for never.'),
22        foreach ($tables as $table) {          'type' => 'int',
23          db_query("CREATE TABLE {cache_$table} (          'not null' => TRUE,
24            cid varchar(255) NOT NULL default '',          'default' => 0),
25            data bytea,        'created' => array(
26            expire int NOT NULL default '0',          'description' => t('A Unix timestamp indicating when the cache entry was created.'),
27            created int NOT NULL default '0',          'type' => 'int',
28            headers text,          'not null' => TRUE,
29            serialized int NOT NULL default '0',          'default' => 0),
30            PRIMARY KEY (cid)        'headers' => array(
31          )");          'description' => t('Any custom HTTP headers to be added to cached data.'),
32        db_query("CREATE INDEX {cache_$table}_expire_idx ON {cache_$table} (expire)");          'type' => 'text',
33        }          'not null' => FALSE),
34        break;        'serialized' => array(
35            'description' => t('A flag to indicate whether content is serialized (1) or not (0).'),
36            'type' => 'int',
37            'size' => 'small',
38            'not null' => TRUE,
39            'default' => 0)
40          ),
41        'indexes' => array('expire' => array('expire')),
42        'primary key' => array('cid'),
43        );
44    }    }
45      return $schema;
46    }
47    
48    function advcache_install() {
49      drupal_install_schema('advcache');
50  }  }
51    
52  function advcache_uninstall() {  function advcache_uninstall() {
53    $tables = array('node', 'comment', 'taxonomy', 'path', 'search', 'forum', 'advcache_block');    drupal_uninstall_schema('advcache');
   foreach ($tables as $table) {  
     if (db_table_exists("cache_$table")) {  
       db_query("DROP TABLE {cache_$table}");  
     }  
   }  
54  }  }
55    
56    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.5.2.1

  ViewVC Help
Powered by ViewVC 1.1.3