<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6.alpha1 |
+ | CiviCRM version 4.7.alpha1 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
*/
/**
- *
- * @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.
* alterable.
* @param string $rev
* an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
- * @return void
*/
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.6.alpha1') {
}
}
-
- /**
- * (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.
*
// 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_runOnlySql', '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);
}
/**
}
return TRUE;
}
-
+
/**
* Queue Task Callback for CRM-16846
*
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('domainID', CRM_Core_Config::domainID());
- $fileName = "CRM/Upgrade/Incremental/sql/$rev.mysql.tpl";
+ $fileName = dirname(__DIR__) . "/sql/$rev.mysql.tpl";
$upgrade->source($smarty->fetch($fileName), TRUE);