You are here

function s3fs_install in S3 File System 7

Same name and namespace in other branches
  1. 8.3 s3fs.install \s3fs_install()
  2. 8.2 s3fs.install \s3fs_install()
  3. 7.3 s3fs.install \s3fs_install()
  4. 7.2 s3fs.install \s3fs_install()
  5. 4.0.x s3fs.install \s3fs_install()

Implements hook_install().

Because hook_schema() doesn't respect the 'collation' setting, we have to set the collation manually. This hook is run after the table is created.

File

./s3fs.install, line 199
Install, update and uninstall functions for the S3 File System module.

Code

function s3fs_install() {
  $options = Database::getConnectionInfo('default');
  switch ($options['default']['driver']) {
    case 'pgsql':

      // Postgres uses binary collation by default
      break;
    case 'sqlite':

      // SQLite uses binary collation by default
      break;
    case 'mysql':

      // As stated here: http://forums.mysql.com/read.php?103,19380,200971#msg-200971
      // MySQL doesn't directly support case sensitive UTF8 collation. Fortunately,
      // 'utf8_bin' collation fulfills our case-sensitivity requirement.
      db_query("ALTER TABLE {s3fs_file} CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin");
      break;
  }
}