From: Olaf Buddenhagen Date: Mon, 7 Oct 2013 12:18:03 +0000 (+0200) Subject: Add upgrade infrastructure for 4.5 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=296342b115f405588fe5aa0b712f84793c6bca43;p=civicrm-core.git Add upgrade infrastructure for 4.5 --- diff --git a/CRM/Upgrade/Incremental/php/FourFive.php b/CRM/Upgrade/Incremental/php/FourFive.php new file mode 100644 index 0000000000..0f354b709e --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FourFive.php @@ -0,0 +1,104 @@ +addTask(ts('Upgrade DB to 4.5.alpha1: SQL'), 'task_4_5_x_runSql', $rev); + + return TRUE; + } + + /** + * (Queue Task Callback) + */ + static function task_4_5_x_runSql(CRM_Queue_TaskContext $ctx, $rev) { + $upgrade = new CRM_Upgrade_Form(); + $upgrade->processSQL($rev); + + return TRUE; + } + + /** + * Syntatic sugar for adding a task which (a) is in this class and (b) has + * a high priority. + * + * After passing the $funcName, you can also pass parameters that will go to + * the function. Note that all params must be serializable. + */ + protected function addTask($title, $funcName) { + $queue = CRM_Queue_Service::singleton()->load(array( + 'type' => 'Sql', + 'name' => CRM_Upgrade_Form::QUEUE_NAME, + )); + + $args = func_get_args(); + $title = array_shift($args); + $funcName = array_shift($args); + $task = new CRM_Queue_Task( + array(get_class($this), $funcName), + $args, + $title + ); + $queue->createItem($task, array('weight' => -1)); + } +} diff --git a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl new file mode 100644 index 0000000000..3fd798cb0f --- /dev/null +++ b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 4.5.alpha1 during upgrade *}