-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenforce_revlog.install
42 lines (37 loc) · 1.3 KB
/
enforce_revlog.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
<?php
/**
* @file
* Installation routines for enforce_revlog
*/
/**
* Implements hook_install().
*/
function enforce_revlog_install() {
$t = get_t();
backdrop_set_message($t('Go to the <a href="@settings">settings page</a> to configure Enforce Revision Log. You will need to enable for each content type you want to enforce revision logs for.', array(
'@settings' => url('admin/config/content/enforce-revlog'),
)));
}
/**
* Migrate enforce_revlog variables to config.
*/
function enforce_revlog_update_1000() {
$config = config('enforce_revlog.settings');
// Set the fixed config. We don't need 'enforce_revlog_user1' as it didn't
// exist in Drupal 7.
$config->set('enforce_revlog_revision_revert', update_variable_get('enforce_revlog_revision_revert', '0'));
// Set the config for each node type.
$node_types = node_type_get_names();
foreach ($node_types as $type => $name) {
$setting_name = 'enforce_revlog_node_type_' . $type;
$config->set($setting_name, update_variable_get($setting_name));
}
// Save the config.
$config->save();
// Remove fixed Drupal 7 variable.
update_variable_del('enforce_revlog_revision_revert');
// Remove variable for each node type.
foreach ($node_types as $type => $name) {
update_variable_del('enforce_revlog_node_type_' . $type);
}
}