drupal-8.language-enabled.php in Drupal 8
File
core/modules/system/tests/fixtures/update/drupal-8.language-enabled.php
View source
<?php
use Drupal\Core\Database\Database;
use Symfony\Component\Yaml\Yaml;
$connection = Database::getConnection();
$connection
->merge('key_value')
->fields([
'value' => 'i:8000;',
'name' => 'language',
'collection' => 'system.schema',
])
->condition('collection', 'system.schema')
->condition('name', 'language')
->execute();
$extensions = $connection
->select('config')
->fields('config', [
'data',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['language'] = 8000;
$connection
->update('config')
->fields([
'data' => serialize($extensions),
'collection' => '',
'name' => 'core.extension',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
$config_directory = new DirectoryIterator(__DIR__ . '/../../../../language/config/install');
foreach ($config_directory as $file_info) {
if ($file_info
->getExtension() == 'yml') {
$config = Yaml::parse(file_get_contents($file_info
->getRealPath()));
$connection
->merge('config')
->condition('name', $file_info
->getBasename('.yml'))
->condition('collection', '')
->fields([
'data' => serialize($config),
'name' => $file_info
->getBasename('.yml'),
'collection' => '',
])
->execute();
}
}
$connection
->merge('key_value')
->condition('collection', 'entity.definitions.installed')
->condition('name', 'configurable_language.entity_type')
->fields([
'value' => 'O:42:"Drupal\\Core\\Config\\Entity\\ConfigEntityType":35:{s:16:"