public function S3fsService::setupTempTable in S3 File System 8.3
Same name and namespace in other branches
- 4.0.x src/S3fsService.php \Drupal\s3fs\S3fsService::setupTempTable()
Setup the temporary table.
Overrides S3fsServiceInterface::setupTempTable
1 call to S3fsService::setupTempTable()
- S3fsService::refreshCache in src/
S3fsService.php - Refreshes the metadata cache.
File
- src/
S3fsService.php, line 557
Class
- S3fsService
- Defines a S3fsService service.
Namespace
Drupal\s3fsCode
public function setupTempTable() {
// Create the temp table, into which all the refreshed data will be written.
// After the full refresh is complete, the temp table will be swapped with
// the real one.
module_load_install('s3fs');
$schema = s3fs_schema();
try {
\Drupal::database()
->schema()
->dropTable('s3fs_file_temp');
\Drupal::database()
->schema()
->createTable('s3fs_file_temp', $schema['s3fs_file']);
// Due to http://drupal.org/node/2193059, the temp table fails to pick up
// the primary key - fix things up manually.
s3fs_fix_table_indexes('s3fs_file_temp');
} catch (SchemaObjectExistsException $e) {
// The table already exists, so we can simply truncate it to start fresh.
\Drupal::database()
->truncate('s3fs_file_temp')
->execute();
}
}