function s3fs_install in S3 File System 8.2
Same name and namespace in other branches
- 8.3 s3fs.install \s3fs_install()
- 7.3 s3fs.install \s3fs_install()
- 7 s3fs.install \s3fs_install()
- 7.2 s3fs.install \s3fs_install()
- 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.
Also adds s3:// to the the core file module's list of public schema. See https://www.drupal.org/node/2305017 for more info.
File
- ./
s3fs.install, line 142 - 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 works for our purposes.
\Drupal::database()
->query("ALTER TABLE {s3fs_file} CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin");
\Drupal::database()
->query("ALTER TABLE {s3fs_file} ADD PRIMARY KEY (uri)");
break;
}
}