-
-
Notifications
You must be signed in to change notification settings - Fork 824
/
Copy pathFiveThirty.php
58 lines (53 loc) · 1.96 KB
/
FiveThirty.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* Upgrade logic for FiveThirty
*/
class CRM_Upgrade_Incremental_php_FiveThirty extends CRM_Upgrade_Incremental_Base {
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_5_30_alpha1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask('Add core (required) extension Financial ACLs', 'installFinancialAcls');
}
/**
* Install financialacls extension.
*
* This feature is restructured as a core extension - which is primarily a code cleanup step.
*
* @param \CRM_Queue_TaskContext $ctx
*
* @return bool
*
* @throws \CRM_Core_Exception
*/
public static function installFinancialAcls(CRM_Queue_TaskContext $ctx) {
// Install via direct SQL manipulation. Note that:
// (1) This extension has no activation logic.
// (2) On new installs, the extension is activated purely via default SQL INSERT.
// (3) Caches are flushed at the end of the upgrade.
// ($) Over long term, upgrade steps are more reliable in SQL. API/BAO sometimes don't work mid-upgrade.
$insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([
'type' => 'module',
'full_name' => 'financialacls',
'name' => 'financialacls',
'label' => 'Financial ACLs',
'file' => 'financialacls',
'schema_version' => NULL,
'is_active' => 1,
]);
CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL());
return TRUE;
}
}