Created
January 28, 2017 15:27
-
-
Save webflo/f9d125b59ce5ab9e667542e878587625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_install(). | |
* | |
* Performs actions to set up the site for this profile. | |
* | |
* @see system_install() | |
*/ | |
function blubb_install() { | |
global $config_directories; | |
$sync_directory = '../config/sync'; | |
// Create a source storage that reads from sync. | |
$file_storage = new \Drupal\Core\Config\FileStorage($sync_directory); | |
// Match up the site uuids. | |
$system_site = $file_storage->read('system.site'); | |
if (isset($system_site['uuid'])) { | |
\Drupal::configFactory() | |
->getEditable('system.site') | |
->set('uuid', $system_site['uuid']) | |
->save(); | |
} | |
// Update settings.php. | |
$settings['config_directories']['sync'] = (object) [ | |
'value' => $sync_directory, | |
'required' => TRUE, | |
]; | |
drupal_rewrite_settings($settings); | |
$config_directories['sync'] = $sync_directory; | |
$languages = $file_storage->listAll('language.entity.'); | |
foreach ($languages as $id) { | |
$language = $file_storage->read($id); | |
$config = \Drupal::configFactory()->getEditable($id); | |
$config->setData($language); | |
$config->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
./vendor/bin/drush site-install --yes blubb --db-url="$SIMPLETEST_DB" --config-dir=$(pwd)/config/sync