*/
public function checkVersionRelease($version, $release) {
$versionParts = explode('.', $version);
- if ($versionParts[2] == $release) {
- return TRUE;
- }
- return FALSE;
+ return ($versionParts[2] == $release);
}
/**
}
}
- // sample test list
- /* $revList = array(
- '2.1.0', '2.2.beta2', '2.2.beta1', '2.2.alpha1', */
-
- /* '2.2.alpha3', '2.2.0', '2.2.2', '2.1.alpha1', '2.1.3'); */
-
usort($revList, 'version_compare');
return $revList;
}
CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
}
- // hack to make past ver compatible /w new incremental upgrade process
- $convertVer = array(
- '2.1' => '2.1.0',
- '2.2' => '2.2.alpha1',
- '2.2.alph' => '2.2.alpha3',
- // since 3.1.1 had domain.version set as 3.1.0
- '3.1.0' => '3.1.1',
- );
- if (isset($convertVer[$currentVer])) {
- $currentVer = $convertVer[$currentVer];
- }
-
return array($currentVer, $latestVer);
}
* @param string $postUpgradeMessageFile
* path of a modifiable file which lists the post-upgrade messages.
*
- * @return CRM_Queue
+ * @return CRM_Queue_Service
*/
public static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
$upgrade = new CRM_Upgrade_Form();
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6.alpha1 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Base class for incremental upgrades
+ */
+class CRM_Upgrade_Incremental_Base {
+ const BATCH_SIZE = 5000;
+
+ /**
+ * Verify DB state.
+ *
+ * @param $errors
+ *
+ * @return bool
+ */
+ public function verifyPreDBstate(&$errors) {
+ return TRUE;
+ }
+
+ /**
+ * Compute any messages which should be displayed before upgrade.
+ *
+ * Note: This function is called iteratively for each upcoming
+ * revision to the database.
+ *
+ * @param $preUpgradeMessage
+ * @param string $rev
+ * a version number, e.g. '4.8.alpha1', '4.8.beta3', '4.8.0'.
+ * @param null $currentVer
+ */
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ }
+
+ /**
+ * Compute any messages which should be displayed after upgrade.
+ *
+ * @param string $postUpgradeMessage
+ * alterable.
+ * @param string $rev
+ * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
+ * @return void
+ */
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ }
+
+
+ /**
+ * (Queue Task Callback)
+ */
+ public static function runSql(CRM_Queue_TaskContext $ctx, $rev) {
+ $upgrade = new CRM_Upgrade_Form();
+ $upgrade->processSQL($rev);
+
+ return TRUE;
+ }
+
+ /**
+ * Syntactic 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));
+ }
+
+}
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
+ * Upgrade logic for 4.5
*/
-class CRM_Upgrade_Incremental_php_FourFive {
- const BATCH_SIZE = 5000;
-
- /**
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
-
- /**
- * Compute any messages which should be displayed beforeupgrade.
- *
- * Note: This function is called iteratively for each upcoming
- * revision to the database.
- *
- * @param $preUpgradeMessage
- * @param string $rev
- * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
- * @param null $currentVer
- *
- * @return void
- */
- public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
- }
+class CRM_Upgrade_Incremental_php_FourFive extends CRM_Upgrade_Incremental_Base {
/**
* Compute any messages which should be displayed after upgrade.
public function upgrade_4_5_alpha1($rev) {
// task to process sql
$this->addTask(ts('Migrate honoree information to module_data'), 'migrateHonoreeInfo');
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.5.alpha1')), 'task_4_5_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.5.alpha1')), 'runSql', $rev);
$this->addTask(ts('Set default for Individual name fields configuration'), 'addNameFieldOptions');
// CRM-14522 - The below schema checking is done as foreign key name
* @return bool
*/
public function upgrade_4_5_beta9($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.5.beta9')), 'task_4_5_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.5.beta9')), 'runSql', $rev);
$entityTable = array(
'Participant' => 'civicrm_participant_payment',
* Upgrade function.
*
* @param string $rev
+ * @return bool
*/
public function upgrade_4_5_9($rev) {
// Task to process sql.
return TRUE;
}
-
- /**
- * (Queue Task Callback)
- */
- public static function task_4_5_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
- $upgrade = new CRM_Upgrade_Form();
- $upgrade->processSQL($rev);
-
- return TRUE;
- }
-
- /**
- * Syntactic 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));
- }
-
}
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
+ * Upgrade logic for 4.4
*/
-class CRM_Upgrade_Incremental_php_FourFour {
- const BATCH_SIZE = 5000;
-
+class CRM_Upgrade_Incremental_php_FourFour extends CRM_Upgrade_Incremental_Base {
const MAX_WORD_REPLACEMENT_SIZE = 255;
- /**
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
-
/**
* Compute any messages which should be displayed beforeupgrade.
*
*/
public function upgrade_4_4_alpha1($rev) {
// task to process sql
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.alpha1')), 'task_4_4_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.alpha1')), 'runSql', $rev);
// Consolidate activity contacts CRM-12274.
$this->addTask('Consolidate activity contacts', 'activityContacts');
* @param $rev
*/
public function upgrade_4_4_beta1($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.beta1')), 'task_4_4_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.beta1')), 'runSql', $rev);
// add new 'data' column in civicrm_batch
$query = 'ALTER TABLE civicrm_batch ADD data LONGTEXT NULL COMMENT "cache entered data"';
CRM_Core_DAO::executeQuery($sql, $p);
}
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.1')), 'task_4_4_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.1')), 'runSql', $rev);
$this->addTask('Patch word-replacement schema', 'wordReplacements_patch', $rev);
}
}
// task to process sql
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.4')), 'task_4_4_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.4.4')), 'runSql', $rev);
// CRM-13892 : add `name` column to dashboard schema
$query = "
$dashboard = new CRM_Core_DAO_Dashboard();
$dashboard->find();
- $values = '';
while ($dashboard->fetch()) {
$urlElements = explode('/', $dashboard->url);
if ($urlElements[1] == 'dashlet') {
return TRUE;
}
- /**
- * (Queue Task Callback)
- */
- public static function task_4_4_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.
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
+ * Upgrade logic for 4.7
*/
-class CRM_Upgrade_Incremental_php_FourSeven {
- const BATCH_SIZE = 5000;
-
- /**
- * Verify DB state.
- *
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
-
- /**
- * Compute any messages which should be displayed before upgrade.
- *
- * Note: This function is called iteratively for each upcoming
- * revision to the database.
- *
- * @param $preUpgradeMessage
- * @param string $rev
- * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
- * @param null $currentVer
- */
- public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
- }
+class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base {
/**
* Compute any messages which should be displayed after upgrade.
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.7.alpha1') {
$config = CRM_Core_Config::singleton();
+ // FIXME: Performing an upgrade step during postUpgrade message phase is probably bad
$editor_id = self::updateWysiwyg();
$msg = NULL;
$ext_href = 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1') . '"';
}
}
-
- /**
- * (Queue Task Callback)
- */
- public static function task_4_7_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
- $upgrade = new CRM_Upgrade_Form();
- $upgrade->processSQL($rev);
-
- return TRUE;
- }
-
- /**
- * Syntactic 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));
- }
-
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_4_7_alpha1($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_7_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
}
/**
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
+ * Upgrade logic for 4.6
*/
-class CRM_Upgrade_Incremental_php_FourSix {
- const BATCH_SIZE = 5000;
-
- /**
- * Verify DB state.
- *
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
-
- /**
- * Compute any messages which should be displayed before upgrade.
- *
- * Note: This function is called iteratively for each upcoming
- * revision to the database.
- *
- * @param $preUpgradeMessage
- * @param string $rev
- * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
- * @param null $currentVer
- */
- public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
- }
+class CRM_Upgrade_Incremental_php_FourSix extends CRM_Upgrade_Incremental_Base {
/**
* Compute any messages which should be displayed after upgrade.
}
}
-
- /**
- * (Queue Task Callback)
- */
- public static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
- $upgrade = new CRM_Upgrade_Form();
- $upgrade->processSQL($rev);
-
- return TRUE;
- }
-
- /**
- * Syntactic 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));
- }
-
/**
* CRM-16846 - This function incorrectly omits running the 4.6.alpha3 sql file.
*
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', 'runSql', '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', 'runSql', '4.4.7');
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_6_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
}
/**
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
+ * Upgrade logic for 4.3
*/
-class CRM_Upgrade_Incremental_php_FourThree {
- const BATCH_SIZE = 5000;
-
- /**
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
+class CRM_Upgrade_Incremental_php_FourThree extends CRM_Upgrade_Incremental_Base {
/**
* Compute any messages which should be displayed beforeupgrade.
// CRM-12141
$this->addTask('Check/Add indexes for civicrm_entity_financial_trxn', 'task_4_3_x_checkIndexes', $rev);
// task to process sql
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha1')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha1')), 'runSql', $rev);
//CRM-11636
$this->addTask('Populate financial type values for price records', 'assignFinancialTypeToPriceRecords');
if ($isColumnPresent) {
CRM_Core_DAO::executeQuery('ALTER TABLE civicrm_dedupe_rule_group DROP COLUMN is_default');
}
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha2')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha2')), 'runSql', $rev);
}
/**
* @param $rev
*/
public function upgrade_4_3_alpha3($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha3')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.alpha3')), 'runSql', $rev);
}
/**
* @param $rev
*/
public function upgrade_4_3_beta2($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta2')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta2')), 'runSql', $rev);
// CRM-12002
if (
* @param $rev
*/
public function upgrade_4_3_beta3($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta3')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta3')), 'runSql', $rev);
// CRM-12065
$query = "SELECT id, form_values FROM civicrm_report_instance WHERE form_values LIKE '%contribution_type%'";
$this->addTask('Replace contribution_type to financial_type in table civicrm_report_instance', 'replaceContributionTypeId', $query, 'reportInstance');
* @param $rev
*/
public function upgrade_4_3_beta4($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta4')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta4')), 'runSql', $rev);
// add indexes for civicrm_entity_financial_trxn
// CRM-12141
$this->addTask('Check/Add indexes for civicrm_entity_financial_trxn', 'task_4_3_x_checkIndexes', $rev);
";
CRM_Core_DAO::executeQuery($query, array(), TRUE, NULL, FALSE, FALSE);
}
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta5')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.beta5')), 'runSql', $rev);
}
/**
* @param $rev
*/
public function upgrade_4_3_4($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.4')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.4')), 'runSql', $rev);
}
/**
";
CRM_Core_DAO::executeQuery($query, array(), TRUE, NULL, FALSE, FALSE);
}
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.5')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.5')), 'runSql', $rev);
}
/**
$this->addTask(ts('Add missing constraints'), 'addMissingConstraints', $rev);
//CRM-13088
$this->addTask('Add ON DELETE Options for constraints', 'task_4_3_x_checkConstraints', $rev);
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.6')), 'task_4_3_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.3.6')), 'runSql', $rev);
// CRM-12844
// update line_item, financial_trxn and financial_item table for recurring contributions
$this->addTask('Update financial_account_id in financial_trxn table', 'updateFinancialTrxnData', $rev);
return TRUE;
}
- /**
- * (Queue Task Callback)
- */
- public static function task_4_3_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));
- }
-
}
*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
+ * Upgrade logic for 4.2
*/
-class CRM_Upgrade_Incremental_php_FourTwo {
- const BATCH_SIZE = 5000;
+class CRM_Upgrade_Incremental_php_FourTwo extends CRM_Upgrade_Incremental_Base {
const SETTINGS_SNIPPET_PATTERN = '/CRM_Core_ClassLoader::singleton\(\)-\>register/';
const SETTINGS_SNIPPET = "\nrequire_once 'CRM/Core/ClassLoader.php';\nCRM_Core_ClassLoader::singleton()->register();\n";
- /**
- * @param $errors
- *
- * @return bool
- */
- public function verifyPreDBstate(&$errors) {
- return TRUE;
- }
-
/**
* Compute any messages which should be displayed beforeupgrade.
*
// Some steps take a long time, so we break them up into separate
// tasks and enqueue them separately.
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.alpha1')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.alpha1')), 'runSql', $rev);
$this->addTask(ts('Upgrade DB to 4.2.alpha1: Price Sets'), 'task_4_2_alpha1_createPriceSets', $rev);
self::convertContribution();
$this->addTask(ts('Upgrade DB to 4.2.alpha1: Event Profile'), 'task_4_2_alpha1_eventProfile');
* @param $rev
*/
public function upgrade_4_2_beta3($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.beta3')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.beta3')), 'runSql', $rev);
$minParticipantId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_participant');
$maxParticipantId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_participant');
* @param $rev
*/
public function upgrade_4_2_0($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.0')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.0')), 'runSql', $rev);
}
/**
* @param $rev
*/
public function upgrade_4_2_2($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.2')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.2')), 'runSql', $rev);
//create line items for memberships and participants for api/import
self::convertContribution();
* @param $rev
*/
public function upgrade_4_2_3($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.3')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.3')), 'runSql', $rev);
// CRM-10953 Remove duplicate activity type for 'Reminder Sent' which is mistakenly inserted by 4.2.alpha1 upgrade script
$queryMin = "
SELECT coalesce(min(value),0) from civicrm_option_value ov
* @param $rev
*/
public function upgrade_4_2_5($rev) {
- $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.5')), 'task_4_2_x_runSql', $rev);
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => '4.2.5')), 'runSql', $rev);
//CRM-11077
$sql = " SELECT cpse.entity_id, cpse.price_set_id
FROM `civicrm_price_set_entity` cpse
return TRUE;
}
- /**
- * (Queue Task Callback)
- */
- public static function task_4_2_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
- $upgrade = new CRM_Upgrade_Form();
- $upgrade->processSQL($rev);
-
- // now rebuild all the triggers
- // CRM-9716
- // FIXME // CRM_Core_DAO::triggerRebuild();
-
- return TRUE;
- }
-
/**
*
* create price sets
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));
- }
-
/**
* @return array
*/
*/
/**
- * State machine for managing different states of the Import process.
- *
+ * State machine for managing different states of the upgrade process.
*/
class CRM_Upgrade_StateMachine extends CRM_Core_StateMachine {
/**
* Class constructor.
*
- * @param object $controller
- * @param const $pages
- * @param \const|int $action
+ * @param CRM_Upgrade_Controller $controller
+ * @param array $pages
+ * @param int $action
*
- * @internal param \CRM_Upgrade_Controller_base $object
- * @return \CRM_Upgrade_StateMachine CRM_Upgrade_StateMachine_Base
+ * @return CRM_Upgrade_StateMachine
*/
public function __construct(&$controller, &$pages, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);