-
-
Notifications
You must be signed in to change notification settings - Fork 168
/
civicrm.install
106 lines (91 loc) · 2.79 KB
/
civicrm.install
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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 |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* Enable CiviCRM.
*/
function civicrm_enable() {
db_query("UPDATE {system} SET weight = 100 WHERE name = 'civicrm'");
menu_rebuild();
menu_link_maintain('civicrm', 'delete', 'civicrm', 'CiviCRM');
$options = array(
'link_title' => 'CiviCRM',
'link_path' => 'civicrm/dashboard',
'module' => 'civicrm',
'options' => array('alter' => TRUE),
);
menu_link_save($options);
if (!civicrm_initialize()) {
$installLink = url('civicrm/setup');
$message = t('<p class="error"><strong>CiviCRM is almost ready.</strong> You must <a href="@url">configure CiviCRM</a> for it to work.</p>', [
'@url' => $installLink,
]);
drupal_set_message($message);
return;
}
// also invoke civicrm menu rebuild
CRM_Core_Menu::store();
// Update the 'blocks' DB table with the blocks.
if (module_exists('block')) {
_block_rehash();
}
}
/**
* Implements hook_uninstall().
*/
function civicrm_uninstall() {
require_once 'civicrm.module';
if (!civicrm_initialize()) {
return;
}
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
require_once 'CRM/Core/DAO.php';
CRM_Core_DAO::dropAllTables();
}
function civicrm_requirements($phase) {
$requirements = array();
$t = get_t();
switch ($phase) {
case 'runtime':
if (!civicrm_initialize()) {
$installLink = url('civicrm/setup');
$requirements['civicrm'] = array(
'title' => $t("CiviCRM"),
'severity' => REQUIREMENT_ERROR,
'value' => $t('<p class="error"><strong>CiviCRM is almost ready.</strong> You must <a href="@url">configure CiviCRM</a> for it to work.</p>', [
'@url' => $installLink,
]),
);
return $requirements;
}
break;
}
return $requirements;
}
/**
* Update CiviCRM module weight
*/
function civicrm_update_7400(&$sandbox) {
db_query("UPDATE {system} SET weight = 100 WHERE name = 'civicrm'");
}
/**
* Trigger cache clear to pick up TZ handling change from CRM-6877.
*/
function civicrm_update_7401($sandbox) {
// This is an empty hook_update_N() so that caches will be
// cleared when update_finished() is called.
return t('TZ changes in CiviCRM Views picked up.');
}