forked from DBCDK/alma
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalma.install
More file actions
65 lines (51 loc) · 1.34 KB
/
alma.install
File metadata and controls
65 lines (51 loc) · 1.34 KB
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
<?php
// Installation and update hooks for Openruth.
/**
* Implements hook_update_N.
* update system table set alma weight=10
* to ensure form_alter hooks are called AFTER ding_user and ding_provider
*/
function alma_update_7001() {
$num_upd = db_update('system')
->fields(array(
'weight' => 10,
))
->condition('name', 'alma', '=')
->execute();
echo $num_upd;
return t('system weight for alma updated to 10');
}
/**
* Expands the limit length for the phone field.
*/
function alma_update_7002() {
$field_name = 'field_alma_mobile_phone';
// Get the current settings
$result = db_query('SELECT data FROM {field_config} WHERE field_name = :name', array(':name' => $field_name))->fetchField();
// Change the settings
$data = unserialize($result);
$data['settings']['max_length'] = '255';
// Write settings back to the database.
db_update('field_config')
->fields(array('data' => serialize($data)))
->condition('field_name', $field_name)
->execute();
$definition = array(
'type' => 'varchar',
'length' => 255,
);
$col_name = $field_name. '_value';
db_change_field(
"field_data_$field_name",
$col_name,
$col_name,
$definition
);
db_change_field(
"field_revision_$field_name",
$col_name,
$col_name,
$definition
);
drupal_flush_all_caches();
}