You are here

function date_api_install in Date 6.2

Same name and namespace in other branches
  1. 8 date_api/date_api.install \date_api_install()
  2. 5.2 date_api.install \date_api_install()
  3. 6 date_api.install \date_api_install()
  4. 7.3 date_api/date_api.install \date_api_install()
  5. 7 date_api/date_api.install \date_api_install()
  6. 7.2 date_api/date_api.install \date_api_install()

Implementation of hook_install().

File

./date_api.install, line 152

Code

function date_api_install() {
  drupal_install_schema('date_api');

  // date_api_set_variables can install date_timezone and date_php4.  The
  // date_timezone_install() function does a module_enable('date_api').  This
  // means that date_api_enable() can be called before date_api_install()
  // finishes!  So the date_api schema needs to be installed before this line!
  date_api_set_variables();
  $ret = array();
  db_add_field($ret, "users", "timezone_name", array(
    'type' => 'varchar',
    'length' => 50,
    'not null' => TRUE,
    'default' => '',
  ));

  // Make sure MYSQL does not stupidly do case-insensitive
  // searches and indexes on our formats.
  // @see http://pure.rednoize.com/2006/11/26/mysql-collation-matters-when-using-unique-indexes/
  // @see http://jjinux.blogspot.com/2009/03/mysql-case-sensitivity-hell.html
  // @see http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html
  global $db_type;
  if ($db_type == 'mysql' || $db_type == 'mysqli') {
    $sql = "ALTER TABLE {date_formats} CHANGE format format VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL";
    $ret[] = update_sql($sql);
    $sql = "ALTER TABLE {date_format_locale} CHANGE format format VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL";
    $ret[] = update_sql($sql);
  }
  return $ret;
}