CRM-16846 - run old sql without resetting locale to that version
authorColeman Watts <coleman@civicrm.org>
Mon, 3 Aug 2015 21:23:50 +0000 (17:23 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 3 Aug 2015 21:23:50 +0000 (17:23 -0400)
CRM/Upgrade/Incremental/php/FourSix.php

index f450153203202d7f7b76d92bdeb904517057ad2a..0e0eb81122c2c778ec58a30d881db90b502a1747 100644 (file)
@@ -205,10 +205,10 @@ class CRM_Upgrade_Incremental_php_FourSix {
   public function upgrade_4_6_6($rev) {
     // CRM-16846 - This sql file may have been previously skipped. Conditionally run it again if it doesn't appear to have run before.
     if (!CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_state_province WHERE abbreviation = '100' AND country_id = 1193")) {
-      $this->addTask('Update Slovenian municipalities', 'task_4_6_x_runSql', '4.6.alpha3');
+      $this->addTask('Update Slovenian municipalities', 'task_4_6_x_runOnlySql', '4.6.alpha3');
     }
     // CRM-16846 - This sql file may have been previously skipped. No harm in running it again because it's just UPDATE statements.
-    $this->addTask('State-province update from 4.4.7', 'task_4_6_x_runSql', '4.4.7');
+    $this->addTask('State-province update from 4.4.7', 'task_4_6_x_runOnlySql', '4.4.7');
 
     $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_6_x_runSql', $rev);
   }
@@ -240,5 +240,22 @@ class CRM_Upgrade_Incremental_php_FourSix {
     }
     return TRUE;
   }
+  
+  /**
+   * Queue Task Callback for CRM-16846
+   *
+   * Run a sql file without resetting locale to that version
+   */
+  public static function task_4_6_x_runOnlySql(CRM_Queue_TaskContext $ctx, $rev) {
+    $upgrade = new CRM_Upgrade_Form();
+    $smarty = CRM_Core_Smarty::singleton();
+    $smarty->assign('domainID', CRM_Core_Config::domainID());
+
+    $fileName = "CRM/Upgrade/Incremental/sql/$rev.mysql.tpl";
+
+    $upgrade->source($smarty->fetch($fileName), TRUE);
+
+    return TRUE;
+  }
 
 }