From 7fb9179d6647c1a76839559e742a220f90588fe6 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 11 Apr 2018 07:31:30 +1000 Subject: [PATCH] dev/translation#9 Create API Action to rebuild Multilingual Schema --- api/v3/System.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/api/v3/System.php b/api/v3/System.php index 00f3f71426..41646c5ef3 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -427,3 +427,21 @@ function civicrm_api3_system_createmissinglogtables() { } return civicrm_api3_create_success(1); } + +/** + * Rebuild Multilingual Schema + * + */ +function civicrm_api3_system_rebuildmultilingualschema() { + $domain = new CRM_Core_DAO_Domain(); + $domain->find(TRUE); + + if ($domain->locales) { + $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); + CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales); + return civicrm_api3_create_success(1); + } + else { + throw new API_Exception('Cannot call rebuild Multilingual schema on non Multilingual database'); + } +} -- 2.25.1