3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Upgrade logic for FiveThree */
14 class CRM_Upgrade_Incremental_php_FiveThree
extends CRM_Upgrade_Incremental_Base
{
17 * Compute any messages which should be displayed beforeupgrade.
19 * Note: This function is called iteratively for each upcoming
20 * revision to the database.
22 * @param string $preUpgradeMessage
24 * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
25 * @param null $currentVer
27 public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
28 if ($rev == '5.3.0') {
30 1 => 'edit user-driven message templates',
31 2 => 'edit system workflow message templates',
32 3 => 'edit message templates',
34 $preUpgradeMessage .= '<p>' . ts('New granular permissions called %1 and %2 have been added for %3 permission. These permissions help to limit user access per template', $params) . '</p>';
36 // Example: Generate a pre-upgrade message.
37 // if ($rev == '5.12.34') {
38 // $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>';
43 * Compute any messages which should be displayed after upgrade.
45 * @param string $postUpgradeMessage
48 * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
50 public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
51 // Example: Generate a post-upgrade message.
52 // if ($rev == '5.12.34') {
53 // $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
62 public function upgrade_5_3_alpha1($rev) {
63 $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
64 $this->addTask('CRM-19948 - Add created_id column to civicrm_file', 'addFileCreatedIdColumn');
67 public static function addFileCreatedIdColumn(CRM_Queue_TaskContext
$ctx) {
68 self
::addColumn($ctx, 'civicrm_file', 'created_id', "int unsigned COMMENT 'FK to civicrm_contact, who uploaded this file'");
70 CRM_Core_BAO_SchemaHandler
::safeRemoveFK('civicrm_file', 'FK_civicrm_file_created_id');
72 CRM_Core_DAO
::executeQuery("
73 ALTER TABLE `civicrm_file`
74 ADD CONSTRAINT `FK_civicrm_file_created_id`
75 FOREIGN KEY (`created_id`)
76 REFERENCES `civicrm_contact`(`id`)
85 * Important! All upgrade functions MUST add a 'runSql' task.
86 * Uncomment and use the following template for a new upgrade version
87 * (change the x in the function name):
91 // * Upgrade function.
93 // * @param string $rev
95 // public function upgrade_5_0_x($rev) {
96 // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
97 // $this->addTask('Do the foo change', 'taskFoo', ...);
98 // // Additional tasks here...
99 // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
100 // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
103 // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {