Commit | Line | Data |
---|---|---|
474d1f76 C |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
474d1f76 | 5 | | | |
bc77d7c0 TO |
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 | | |
474d1f76 C |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * Upgrade logic for FiveEleven */ | |
14 | class CRM_Upgrade_Incremental_php_FiveEleven 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 | // Example: Generate a pre-upgrade message. | |
29 | // if ($rev == '5.12.34') { | |
30 | // $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>'; | |
31 | // } | |
32 | } | |
33 | ||
34 | /** | |
35 | * Compute any messages which should be displayed after upgrade. | |
36 | * | |
37 | * @param string $postUpgradeMessage | |
38 | * alterable. | |
39 | * @param string $rev | |
40 | * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. | |
41 | */ | |
42 | public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { | |
43 | // Example: Generate a post-upgrade message. | |
44 | // if ($rev == '5.12.34') { | |
45 | // $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'."); | |
46 | // } | |
47 | } | |
48 | ||
49 | /* | |
50 | * Important! All upgrade functions MUST add a 'runSql' task. | |
51 | * Uncomment and use the following template for a new upgrade version | |
52 | * (change the x in the function name): | |
53 | */ | |
54 | ||
7015248a | 55 | /** |
56 | * Upgrade function. | |
57 | * | |
58 | * @param string $rev | |
59 | */ | |
60 | public function upgrade_5_11_alpha1($rev) { | |
be2fb01f | 61 | $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); |
ac241c34 CW |
62 | $this->addTask('Update smart groups where jcalendar fields have been converted to datepicker', 'updateSmartGroups', [ |
63 | 'datepickerConversion' => [ | |
64 | 'grant_application_received_date', | |
65 | 'grant_decision_date', | |
66 | 'grant_money_transfer_date', | |
3655bea4 SL |
67 | 'grant_due_date', |
68 | ], | |
ac241c34 | 69 | ]); |
b4d67eb2 | 70 | if (Civi::settings()->get('civimail_multiple_bulk_emails')) { |
71 | $this->addTask('Update any on hold groups to reflect field change', 'updateOnHold', $rev); | |
72 | } | |
73 | } | |
74 | ||
75 | /** | |
76 | * Upgrade function. | |
77 | * | |
78 | * @param string $rev | |
79 | */ | |
80 | public function upgrade_5_11_beta1($rev) { | |
81 | if (Civi::settings()->get('civimail_multiple_bulk_emails')) { | |
82 | $this->addTask('Update any on hold groups to reflect field change', 'updateOnHold', $rev); | |
83 | } | |
84 | } | |
85 | ||
86 | /** | |
87 | * Update on hold groups -note the core function layout for this sort of upgrade changed in 5.12 - don't copy this. | |
88 | */ | |
89 | public function updateOnHold($ctx, $version) { | |
90 | $groupUpdateObject = new CRM_Upgrade_Incremental_SmartGroups($version); | |
91 | $groupUpdateObject->convertEqualsStringToInArray('on_hold'); | |
92 | return TRUE; | |
7015248a | 93 | } |
474d1f76 C |
94 | |
95 | } |