From 1523d508cdc9d3cdb51733aa3736519f6443e275 Mon Sep 17 00:00:00 2001 From: Tom Broughton Date: Wed, 14 Aug 2019 03:18:58 +0100 Subject: [PATCH] Issue #86: Fixed errors when loading generated data --- drush/civicrm.drush.inc | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drush/civicrm.drush.inc b/drush/civicrm.drush.inc index 6efde4f..9cdc6a9 100644 --- a/drush/civicrm.drush.inc +++ b/drush/civicrm.drush.inc @@ -384,29 +384,32 @@ function _civicrm_install_db($dbuser, $dbpass, $dbhost, $dbname, drush_log(dt("Loading CiviCRM database structure ..")); civicrm_source($dsn, $sqlPath . '/civicrm.mysql'); drush_log(dt("Loading CiviCRM database with required data ..")); - // testing the translated sql files availability - $data_file = $sqlPath . '/civicrm_data.mysql'; - $acl_file = $sqlPath . '/civicrm_acl.mysql'; - if ($lang != '') { - if (file_exists($sqlPath . '/civicrm_data.' . $lang . '.mysql') - and file_exists($sqlPath . '/civicrm_acl.' . $lang . '.mysql') - and $lang != '' - ) { - $data_file = $sqlPath . '/civicrm_data.' . $lang . '.mysql'; - $acl_file = $sqlPath . '/civicrm_acl.' . $lang . '.mysql'; - } - else { - drush_log(dt("No sql files could be retrieved for \"" . $lang . - "\", using default language." - ), 'warning'); - } - } - civicrm_source($dsn, $data_file); - civicrm_source($dsn, $acl_file); if ($loadGeneratedData) { + drush_log(dt("Loading in generated data ..")); civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm_generated.mysql', TRUE); } + else { + // testing the translated sql files availability + $data_file = $sqlPath . '/civicrm_data.mysql'; + $acl_file = $sqlPath . '/civicrm_acl.mysql'; + if ($lang != '') { + if (file_exists($sqlPath . '/civicrm_data.' . $lang . '.mysql') + and file_exists($sqlPath . '/civicrm_acl.' . $lang . '.mysql') + and $lang != '' + ) { + $data_file = $sqlPath . '/civicrm_data.' . $lang . '.mysql'; + $acl_file = $sqlPath . '/civicrm_acl.' . $lang . '.mysql'; + } + else { + drush_log(dt("No sql files could be retrieved for \"" . $lang . + "\", using default language." + ), 'warning'); + } + } + civicrm_source($dsn, $data_file); + civicrm_source($dsn, $acl_file); + } drush_log(dt("CiviCRM database loaded successfully."), 'ok'); }