Instantiate CMS

CMS Site

drush -r ${drupal_root} site-install standard --sites-subdir="${domain}" --db-url="mysql://fis_${multisite_env}:${cms_db_pass}@localhost/${cms_db}"

CMS Config

rm -f ${config_dir}/settings.php
cp ${abs_callpath}/settings.tpl.php ${config_dir}/settings.php
cp ${abs_callpath}/instance.settings.tpl.php ${config_dir}/instance.settings.php
sed -i "s#'%CMS_DB%'#\'${cms_db}\'#" ${config_dir}/instance.settings.php
sed -i "s#'%CMS_SHARED_PREFIX%'#\'${cms_shared_prefix}\'#" ${config_dir}/instance.settings.php

User Framework Integration

# The civicrm_group_roles module cannot be installed in a traditional manner because its table is shared across multisites.
# Normal installation would result in a database error, as an attempt would be made to create the table in a database which
# already contains a table with that name. Instead, we manipulate the system table to tell Drupal it's already installed.
REPLACE INTO ${cms_db}.system (filename, name, type, owner, status, bootstrap, schema_version, weight, info) \
      SELECT filename, name, type, owner, status, bootstrap, schema_version, weight, info \
      FROM fis_${multisite_env}_cms.system main \
      WHERE = 'civicrm_group_roles';
echo "USE ${cms_db}; DROP TABLE users;" | mysql --login-path=root

Modules and Themes

drush_cmd="drush -r ${drupal_root} -l ${domain}"
${drush_cmd} -y dis toolbar overlay
${drush_cmd} -y en adaptivetheme_subtheme admin_menu admin_menu_toolbar admin_views bartik civicrm civicrmtheme nexus seven fis_enrollment clone imce_wysiwyg masquerade mailsystem composer_manager sparkpost

echo "Enabling site config module..."
${drush_cmd} -y en fis_multisite_config

CMS WYSIWYG settings

DELETE FROM `wysiwyg`;
INSERT INTO `wysiwyg` (`format`, `editor`, `settings`) \
SELECT `format`, `editor`, `settings` FROM `fis_${multisite_env}_cms`.`wysiwyg`;

IMCE settings

drush -r ${drupal_root} -l default vget --format=json imce_profiles \
        | php -r '$data = stream_get_contents(STDIN); $decodedData = json_decode($data); echo json_encode($decodedData->imce_profiles);' \
        | ${drush_cmd} vset --format=json imce_profiles -
drush -r ${drupal_root} -l default vget --format=json imce_roles_profiles \
        | php -r '$data = stream_get_contents(STDIN); $decodedData = json_decode($data); echo json_encode($decodedData->imce_roles_profiles);' \
        | ${drush_cmd} vset --format=json imce_roles_profiles -