You are here

function event_update_4 in Event 5.2

Replace basicevent module if installed

File

./event.install, line 241

Code

function event_update_4() {
  $is_existing = db_num_rows(db_query("SELECT * FROM {node_type} WHERE type = '%s'", 'event'));
  if ($is_existing != 1) {

    // Create default event type
    $type = array(
      'type' => 'event',
      'name' => t('Event'),
      'module' => 'node',
      'description' => t('Events have a start date and an optional end date as well as a teaser and a body. They can be extended by other modules, too.'),
      'custom' => TRUE,
      'modified' => TRUE,
      'locked' => FALSE,
    );
    $type = (object) _node_type_set_defaults($type);
    node_type_save($type);
    variable_set('event_nodeapi_event', 'all');
    drupal_set_message('A content type "event" was created.');
  }
  $basicevent = db_num_rows(db_query("SELECT * FROM {system} WHERE name = '%s' AND status = 1", 'basicevent'));
  if ($basicevent) {
    db_query("UPDATE {system} SET status = 0 WHERE name = '%s'", 'basicevent');
    drupal_set_message(t('The basicevent module is no longer supported, it was disabled during the upgrade process.'));
  }
  $basicevent = db_num_rows(db_query("SELECT * FROM {node_type} WHERE module = '%s'", 'basicevent'));
  if ($basicevent) {
    db_query("UPDATE {node_type} SET module = 'node' WHERE module = '%s'", 'basicevent');
  }
  return array();
}