You are here

function date_api_update_5200 in Date 6

Same name and namespace in other branches
  1. 5.2 date_api.install \date_api_update_5200()

File

./date_api.install, line 102

Code

function date_api_update_5200() {
  $ret = array();
  include_once './includes/install.inc';
  $module_list = array();

  // When upgrading from previous versions that had no Date Timezone module
  // some previously-enabled modules that depend on it get turned off, so enable them here.
  $result = db_query("SELECT name FROM {system} WHERE status = 1 AND name IN ('date', 'date_copy', 'calendar', 'calendar_ical')");
  while ($row = db_fetch_object($result)) {
    $module_list[] = $row->name;
  }
  if (!empty($module_list)) {
    $module_list = array_merge(array(
      'date_timezone',
    ), $module_list);
  }
  if (!function_exists('date_create')) {
    $module_list[] = 'date_php4';
  }
  if (module_exists('jscalendar')) {
    $module_list[] = 'date_popup';
  }
  drupal_install_modules($module_list);
  module_rebuild_cache();
  $ret[] = array(
    'success' => TRUE,
    'query' => implode(', ', $module_list),
  );
  return $ret;
}