Merge pull request #11993 from jaapjansma/issue_66
[civicrm-core.git] / api / v3 / System.php
index 00f3f71426311330e217626a5ae478c9cbf3fa88..41646c5ef31a8ee0cf6bf1c50f496124721222d9 100644 (file)
@@ -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');
+  }
+}