-
Notifications
You must be signed in to change notification settings - Fork 0
/
revisioning.install
executable file
·60 lines (55 loc) · 1.84 KB
/
revisioning.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
<?php
// $Id$
/**
* @file
* Install and uninstall hooks for Revisioning module.
*/
/**
* Implementation of hook_install().
*/
function revisioning_install() {
// Panels override fix, see http://drupal.org/node/519924.
variable_set('page_manager_override_anyway', TRUE);
}
/**
* Implementation of hook_update_N().
*/
function revisioning_update_6307() {
$ret = array();
// Panels override fix, see http://drupal.org/node/519924.
variable_set('page_manager_override_anyway', TRUE);
return $ret;
}
/**
* Implementation of hook_update_N().
*
* Place ourselves after Workflow so that we can alter some of the forms created
* by Workflow.
* If Workflow isn't installed at the time that Revisioning is installed, set
* Revisioning weight to 1, which is higher than the default.
*/
function revisioning_update_6310() {
$ret = array();
$weight = 1 + (int)db_result(db_query("SELECT weight FROM {system} WHERE name = 'workflow'"));
$ret[] = update_sql("UPDATE {system} SET weight = $weight WHERE name = 'revisioning'");
return $ret;
}
/**
* Implementation of hook_uninstall().
*/
function revisioning_uninstall() {
// Delete all revisioning_* variables at once
db_query("DELETE FROM {variable} WHERE name LIKE 'revisioning_%%'");
variable_del('page_manager_override_anyway'); // see above
foreach (node_get_types() as $type) {
// Maybe revisioning_auto_publish_<type> and new_revisions_<type>
// should be used in array, like 'revision_moderation' below?
variable_del('new_revisions_'. $type->type);
// Remove 'revision_moderation' from all node_options_<content_type> variables
$variable_name = 'node_options_'. $type->type;
if ($node_options = variable_get($variable_name, NULL)) {
$node_options = array_diff($node_options, array('revision_moderation'));
variable_set($variable_name, $node_options);
}
}
}