function event_install in Event 5
Same name and namespace in other branches
- 5.2 event.install \event_install()
1 call to event_install()
- event_update_2 in ./
event.install - The database tables were altered slightly in the first few months of the 4.6 branch of the module. This update checks to see which version of the event table is installed on the site, and updates the necessary columns.
File
- ./
event.install, line 3
Code
function event_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {event} (nid int(10) unsigned NOT NULL default '0',\n event_start int(10) unsigned NOT NULL default '0',\n event_end int(10) unsigned NOT NULL default '0',\n timezone int(10) NOT NULL default '0',\n PRIMARY KEY (nid),\n KEY event_start (event_start)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
db_query("CREATE TABLE {event} (\n nid int NOT NULL default '0',\n event_start int NOT NULL default '0',\n event_end int NOT NULL default '0',\n timezone int NOT NULL default '0',\n PRIMARY KEY (nid));");
break;
}
// Enable basicevent by default
db_query("UPDATE {system} SET status = 1 WHERE name = 'basicevent'");
// Enable event view and location on basicevent
variable_set('event_nodeapi_event', 'all');
if (module_exists('location')) {
variable_set('location_event', 1);
variable_set('location_collapsible_event', 1);
variable_set('location_collapsed_event', 0);
variable_set('location_name_event', 1);
variable_set('location_street_event', 1);
variable_set('location_city_event', 1);
variable_set('location_province_event', 1);
variable_set('location_postal_code_event', 1);
}
// Notify of changes
drupal_set_message(t('Event module was successfully installed with default options. To customize event and/or location settings for events, please view the <a href="!settings">event content type settings page</a>.', array(
'!settings' => url('admin/content/types/event'),
)));
}