diff --git a/CRM/Core/CodeGen/Schema.php b/CRM/Core/CodeGen/Schema.php index f91d5f962163..327b5c1087c4 100644 --- a/CRM/Core/CodeGen/Schema.php +++ b/CRM/Core/CodeGen/Schema.php @@ -10,18 +10,6 @@ */ class CRM_Core_CodeGen_Schema extends CRM_Core_CodeGen_BaseTask { - public $locales; - - /** - * CRM_Core_CodeGen_Schema constructor. - * - * @param \CRM_Core_CodeGen_Main $config - */ - public function __construct($config) { - parent::__construct($config); - $this->locales = $this->findLocales(); - } - public function run() { CRM_Core_CodeGen_Util_File::createDir($this->config->sqlCodePath); @@ -40,11 +28,6 @@ public function run() { echo "Generating sql drop tables file\n"; $put($this->generateDropSql()); - foreach ($this->locales as $locale) { - echo "Generating data files for $locale\n"; - $put($this->generateLocaleDataSql($locale)); - } - // also create the archive tables // $this->generateCreateSql('civicrm_archive.mysql' ); // $this->generateDropSql('civicrm_archive_drop.mysql'); @@ -81,44 +64,6 @@ public function generateNavigation() { return ['civicrm_navigation.mysql' => $template->fetch('civicrm_navigation.tpl')]; } - /** - * @param string $locale - * Ex: en_US, fr_FR - * @return array - */ - public function generateLocaleDataSql($locale) { - $template = new CRM_Core_CodeGen_Util_Template('sql'); - CRM_Core_CodeGen_Util_MessageTemplates::assignSmartyVariables($template->getSmarty()); - global $tsLocale; - $oldTsLocale = $tsLocale; - - try { - - $tsLocale = $locale; - $template->assign('locale', $locale); - $template->assign('db_version', $this->config->db_version); - - $sections = [ - 'civicrm_country.tpl', - 'civicrm_state_province.tpl', - 'civicrm_currency.tpl', - 'civicrm_data.tpl', - 'civicrm_navigation.tpl', - 'civicrm_version_sql.tpl', - ]; - - $ext = ($locale !== 'en_US' ? ".$locale" : ''); - - return [ - "civicrm_data$ext.mysql" => $template->fetchConcat($sections), - "civicrm_acl$ext.mysql" => $template->fetch('civicrm_acl.tpl'), - ]; - } - finally { - $tsLocale = $oldTsLocale; - } - } - /** * @return array * Array(string $fileName => string $fileContent). @@ -136,29 +81,4 @@ public function generateSample() { ]; } - /** - * @return array - */ - public function findLocales() { - require_once 'CRM/Core/Config.php'; - $config = CRM_Core_Config::singleton(FALSE); - $locales = []; - $localeDir = CRM_Core_I18n::getResourceDir(); - if (file_exists($localeDir)) { - $locales = preg_grep('/^[a-z][a-z]_[A-Z][A-Z]$/', scandir($localeDir)); - } - - $localesMask = getenv('CIVICRM_LOCALES'); - if (!empty($localesMask)) { - $mask = explode(',', $localesMask); - $locales = array_intersect($locales, $mask); - } - - if (!in_array('en_US', $locales)) { - array_unshift($locales, 'en_US'); - } - - return $locales; - } - }