You are here

function date_api_update_6001 in Date 6.2

Rebuild the theme registry and all the caches. needed to pick up changes created by updated Views API.

File

./date_api.install, line 287

Code

function date_api_update_6001() {
  $ret = array();

  // don't attempt to upgrade if views is not yet upgraded.
  if (module_exists('views') && drupal_get_installed_schema_version('views', TRUE) < 6000) {
    $ret = array();
    drupal_set_message(t('date module cannot be updated until after Views has been updated. Please return to <a href="@update-php">update.php</a> and run the remaining updates.', array(
      '@update-php' => base_path() . 'update.php?op=selection',
    )), 'warning', FALSE);
    $ret['#abort'] = array(
      'success' => FALSE,
      'query' => t('date.module has updates, but cannot be updated until views.module is updated first.'),
    );
    return $ret;
  }
  if (db_table_exists('cache_content')) {
    db_query('DELETE FROM {cache_content}');
  }
  if (db_table_exists('cache_views')) {
    db_query('DELETE FROM {cache_views}');
  }
  if (db_table_exists('views_object_cache')) {
    db_query('DELETE FROM {views_object_cache}');
  }
  db_query("DELETE FROM {cache} where cid LIKE 'theme_registry%'");
  return $ret;
}