agenda.install in Agenda 6
Same filename and directory in other branches
Install, uninstall and scheme functions for the agenda module.
File
agenda.installView source
<?php
/**
* @file
* Install, uninstall and scheme functions for the agenda module.
*/
/**
* Implementation of hook_uninstall().
*/
function agenda_uninstall() {
drupal_uninstall_schema('agenda');
}
/**
* Implementation of hook_install().
*/
function agenda_install() {
drupal_install_schema('agenda');
agenda_install_example_block();
}
/**
*
*/
function agenda_update_6001() {
$updates = array();
agenda_install();
db_query("DELETE FROM {variable} WHERE name LIKE 'agenda_%'");
return $updates;
}
/**
* Install an example block
*/
function agenda_install_example_block() {
db_query("\n INSERT INTO {agenda} (bid, name, value)\n VALUES\n \t(1,'noeventstext','<p>No upcoming events</p>'),\n \t(1,'timeformat','h:ia'),\n \t(1,'customdate','l, F jS'),\n \t(1,'dateformat','custom'),\n \t(1,'maxevents','60'),\n \t(1,'datelimit','60'),\n \t(1,'start','Feb 1st, 2009'),\n \t(1,'end','April 1st, 2009'),\n \t(1,'title','Example agenda block'),\n \t(1,'linktext','View this event in Google Calendar'),\n \t(1,'cachetime','3600'),\n \t(1,'display_keys','start time, end date, end time, published, description, link'),\n \t(1,'hide_labels','description, link'),\n \t(1,'calendars','drupalagenda@gmail.com')");
}
/**
* Implementation of hook_schema().
*/
function agenda_schema() {
$schema['agenda'] = array(
'description' => t('Hold agenda settings'),
'fields' => array(
'id' => array(
'description' => t('ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '11',
),
'bid' => array(
'description' => t('Block ID'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'disp-width' => '11',
),
'name' => array(
'description' => t('Name of the setting'),
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'value' => array(
'description' => t('Value of the setting'),
'type' => 'varchar',
'length' => 1024,
'not null' => FALSE,
),
),
'primary key' => array(
'id',
),
'unique keys' => array(
'kvp' => array(
'bid',
'name',
),
),
'indexes' => array(
'bid' => array(
'bid',
),
),
);
return $schema;
}
Functions
Name | Description |
---|---|
agenda_install | Implementation of hook_install(). |
agenda_install_example_block | Install an example block |
agenda_schema | Implementation of hook_schema(). |
agenda_uninstall | Implementation of hook_uninstall(). |
agenda_update_6001 |