Merge pull request #19116 from eileenmcnaughton/pay_edit
[civicrm-core.git] / CRM / Upgrade / Incremental / Base.php
index 3f5393dc0c2b142e9212b09b6a9a918cb4f6c521..1a2e3b008c67ef454b8af4801daa5f03cd6e623a 100644 (file)
@@ -136,10 +136,11 @@ class CRM_Upgrade_Incremental_Base {
    * @param string $properties
    * @param bool $localizable is this a field that should be localized
    * @param string|null $version CiviCRM version to use if rebuilding multilingual schema
+   * @param bool $triggerRebuild should we trigger the rebuild of the multilingual schema
    *
    * @return bool
    */
-  public static function addColumn($ctx, $table, $column, $properties, $localizable = FALSE, $version = NULL) {
+  public static function addColumn($ctx, $table, $column, $properties, $localizable = FALSE, $version = NULL, $triggerRebuild = TRUE) {
     $locales = CRM_Core_I18n::getMultilingual();
     $queries = [];
     if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, $column, FALSE)) {
@@ -162,7 +163,7 @@ class CRM_Upgrade_Incremental_Base {
         CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
       }
     }
-    if ($locales) {
+    if ($locales && $triggerRebuild) {
       CRM_Core_I18n_Schema::rebuildMultilingualSchema($locales, $version, TRUE);
     }
     return TRUE;
@@ -243,12 +244,13 @@ class CRM_Upgrade_Incremental_Base {
    *
    * @param CRM_Queue_TaskContext $ctx
    * @param string $table
-   * @param string|array $column
+   * @param string|array $columns
+   * @param string $prefix
    * @return bool
    */
-  public static function addIndex($ctx, $table, $column) {
-    $tables = [$table => (array) $column];
-    CRM_Core_BAO_SchemaHandler::createIndexes($tables);
+  public static function addIndex($ctx, $table, $columns, $prefix = 'index') {
+    $tables = [$table => (array) $columns];
+    CRM_Core_BAO_SchemaHandler::createIndexes($tables, $prefix);
 
     return TRUE;
   }