remove never-used option value
[civicrm-core.git] / CRM / Upgrade / Incremental / php / FiveThree.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Upgrade logic for FiveThree */
14 class CRM_Upgrade_Incremental_php_FiveThree extends CRM_Upgrade_Incremental_Base {
15
16 /**
17 * Compute any messages which should be displayed beforeupgrade.
18 *
19 * Note: This function is called iteratively for each upcoming
20 * revision to the database.
21 *
22 * @param string $preUpgradeMessage
23 * @param string $rev
24 * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
25 * @param null $currentVer
26 */
27 public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
28 if ($rev == '5.3.0') {
29 $params = [
30 1 => 'edit user-driven message templates',
31 2 => 'edit system workflow message templates',
32 3 => 'edit message templates',
33 ];
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>';
35 }
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>';
39 // }
40 }
41
42 /**
43 * Compute any messages which should be displayed after upgrade.
44 *
45 * @param string $postUpgradeMessage
46 * alterable.
47 * @param string $rev
48 * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
49 */
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'.");
54 // }
55 }
56
57 /**
58 * Upgrade function.
59 *
60 * @param string $rev
61 */
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');
65 }
66
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'");
69
70 CRM_Core_BAO_SchemaHandler::safeRemoveFK('civicrm_file', 'FK_civicrm_file_created_id');
71
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`)
77 ON DELETE SET NULL
78 ON UPDATE CASCADE;
79 ");
80
81 return TRUE;
82 }
83
84 /*
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):
88 */
89
90 // /**
91 // * Upgrade function.
92 // *
93 // * @param string $rev
94 // */
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.
101 // }
102
103 // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
104 // return TRUE;
105 // }
106
107 }