View source
<?php
function top_searches_install() {
variable_set('top_searches_show_counters', 0);
variable_set('top_searches_block_items', 50);
drupal_set_message(t('Top searches module installed successfully.'));
}
function top_searches_uninstall() {
switch (db_driver()) {
case 'mysql':
case 'mysqli':
db_delete('variable')
->condition('name', 'top_searches%', 'like')
->execute();
cache_clear_all('variables', 'cache');
break;
}
}
function top_searches_schema() {
$schema['top_searches'] = array(
'fields' => array(
'qid' => array(
'type' => 'serial',
'length' => 11,
'not null' => TRUE,
'unsigned' => TRUE,
),
'q' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'counter' => array(
'type' => 'int',
'length' => 11,
'not null' => FALSE,
'default' => 0,
'unsigned' => TRUE,
),
),
'unique keys' => array(
'q' => array(
'q',
),
),
'primary key' => array(
'qid',
),
);
return $schema;
}