| 1 |
<?php |
<?php |
| 2 |
// $Id: coder.install,v 1.1.4.6 2008/09/20 16:01:09 douggreen Exp $ |
// $Id$ |
|
|
|
|
/** |
|
|
* @file |
|
|
* Installation file for the coder module. |
|
|
*/ |
|
|
|
|
|
/** |
|
|
* Implementation of hook_install(). |
|
|
*/ |
|
|
function coder_install() { |
|
|
drupal_install_schema('coder'); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Implementation of hook_uninstall(). |
|
|
*/ |
|
|
function coder_uninstall() { |
|
|
variable_del('coder_cache'); |
|
|
variable_del('coder_reviews'); |
|
|
variable_del('coder_severity'); |
|
|
variable_del('coder_active_modules'); |
|
|
variable_del('coder_core'); |
|
|
variable_del('coder_includes'); |
|
|
variable_del('coder_includes_exclusions'); |
|
|
variable_del('coder_modules'); |
|
|
variable_del('coder_themes'); |
|
|
|
|
|
drupal_uninstall_schema('coder'); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Implementation of hook_schema(). |
|
|
*/ |
|
|
function coder_schema() { |
|
|
// Use our own cache table because we can create lots of entries, that slow down and clutter the default cache. |
|
|
$schema['cache_coder'] = array( |
|
|
'description' => "Coder cache table for improving display of result sets that haven't changed", |
|
|
'fields' => array( |
|
|
'cid' => array( |
|
|
'description' => 'Primary Key: Unique cache ID.', |
|
|
'type' => 'varchar', |
|
|
'length' => 255, |
|
|
'not null' => TRUE, |
|
|
'default' => ''), |
|
|
'data' => array( |
|
|
'description' => 'A collection of data to cache.', |
|
|
'type' => 'blob', |
|
|
'not null' => FALSE, |
|
|
'size' => 'big'), |
|
|
'expire' => array( |
|
|
'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.', |
|
|
'type' => 'int', |
|
|
'not null' => TRUE, |
|
|
'default' => 0), |
|
|
'created' => array( |
|
|
'description' => 'A Unix timestamp indicating when the cache entry was created.', |
|
|
'type' => 'int', |
|
|
'not null' => TRUE, |
|
|
'default' => 0), |
|
|
'headers' => array( |
|
|
'description' => 'Any custom HTTP headers to be added to cached data.', |
|
|
'type' => 'text', |
|
|
'not null' => FALSE), |
|
|
'serialized' => array( |
|
|
'description' => 'A flag to indicate whether content is serialized (1) or not (0).', |
|
|
'type' => 'int', |
|
|
'size' => 'small', |
|
|
'not null' => TRUE, |
|
|
'default' => 0) |
|
|
), |
|
|
'indexes' => array('expire' => array('expire')), |
|
|
'primary key' => array('cid'), |
|
|
); |
|
|
return $schema; |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* Clear the cache. |
|
|
*/ |
|
|
function coder_update_1() { |
|
|
$ret = array(); |
|
|
// This update adds a theming function, so we need to clear the entire cache. |
|
|
$ret[] = update_sql("DELETE FROM {cache}"); |
|
|
return $ret; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Create the cache_coder table. |
|
|
*/ |
|
|
function coder_update_2() { |
|
|
$ret = array(); |
|
|
// Create the new coder cache table. |
|
|
db_create_table($ret, 'cache_coder', _coder_cache_schema()); |
|
|
// Clear coder entries from the default cache. |
|
|
cache_clear_all('coder:', 'cache', TRUE); |
|
|
return $ret; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Remove deprecated coder variables from the 'variable' table. |
|
|
*/ |
|
|
function coder_update_3() { |
|
|
$ret = array(); |
|
|
$ret[] = update_sql("DELETE FROM {variable} WHERE name LIKE 'coder_modules-%' OR name LIKE 'coder_themes-%'"); |
|
|
cache_clear_all('variables', 'cache'); |
|
|
return $ret; |
|
|
} |
|