function generateSiteUUIDFile in Content Synchronization 8
Generate UUID YAML file To use for site UUID validation.
Parameters
$data: The batch content to persist.
array $context: The batch context.
2 string references to 'generateSiteUUIDFile'
- ContentExportForm::submitForm in src/
Form/ ContentExportForm.php - Form submission handler.
- content_sync_install in ./
content_sync.install - Implements hook_install().
File
- ./
content_sync.batch.inc, line 751
Code
function generateSiteUUIDFile($data, &$context) {
//Initialize ArchiverTar
$archiver = new ArchiveTar(file_directory_temp() . '/content.tar.gz', 'gz');
//Include Site UUID to YML file
$site_config = \Drupal::config('system.site');
$site_uuid_source = $site_config
->get('uuid');
$entity['site_uuid'] = $site_uuid_source;
// Set the name
$name = "site.uuid";
// Create the file.
$archiver
->addString("{$name}.yml", Yaml::encode($entity));
//Save to cs_db_snapshot if being called from installer.
if ($data == 'snapshot') {
// Insert Data
$activeStorage = new Drupal\Core\Config\DatabaseStorage(\Drupal::database(), 'cs_db_snapshot');
$activeStorage
->write($name, $entity);
}
$context['message'] = $name;
$context['results'][] = $name;
$context['finished'] = 1;
}