[177a560] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * @file |
---|
| 5 | * Install and uninstall hooks for Revisioning module. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * Implementation of hook_install(). |
---|
| 10 | */ |
---|
| 11 | function revisioning_install() { |
---|
| 12 | // Panels override fix, see http://drupal.org/node/519924. |
---|
| 13 | variable_set('page_manager_override_anyway', TRUE); |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * Implementation of hook_update_N(). |
---|
| 18 | */ |
---|
| 19 | function revisioning_update_6307() { |
---|
| 20 | $ret = array(); |
---|
| 21 | // Panels override fix, see http://drupal.org/node/519924. |
---|
| 22 | variable_set('page_manager_override_anyway', TRUE); |
---|
| 23 | return $ret; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * Implementation of hook_update_N(). |
---|
| 28 | * |
---|
| 29 | * Alteration of Workflow form is realised through Workflow Extensions module, |
---|
| 30 | * removing the need to change weights. |
---|
| 31 | * In fact change of weight is related to the trouble described in [#482126], |
---|
| 32 | * comment #9, |
---|
| 33 | */ |
---|
| 34 | function revisioning_update_6313() { |
---|
| 35 | $ret = array(); |
---|
| 36 | $ret[] = update_sql("UPDATE {system} SET weight = 0 WHERE name = 'revisioning'"); |
---|
| 37 | return $ret; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * Implementation of hook_uninstall(). |
---|
| 42 | */ |
---|
| 43 | function revisioning_uninstall() { |
---|
| 44 | // Delete all revisioning_* variables at once |
---|
| 45 | db_query("DELETE FROM {variable} WHERE name LIKE 'revisioning_%%'"); |
---|
| 46 | variable_del('page_manager_override_anyway'); // see above |
---|
| 47 | foreach (node_get_types() as $type) { |
---|
| 48 | // Maybe revisioning_auto_publish_<type> and new_revisions_<type> |
---|
| 49 | // should be used in array, like 'revision_moderation' below? |
---|
| 50 | variable_del('new_revisions_'. $type->type); |
---|
| 51 | // Remove 'revision_moderation' from all node_options_<content_type> variables |
---|
| 52 | $variable_name = 'node_options_'. $type->type; |
---|
| 53 | if ($node_options = variable_get($variable_name, NULL)) { |
---|
| 54 | $node_options = array_diff($node_options, array('revision_moderation')); |
---|
| 55 | variable_set($variable_name, $node_options); |
---|
| 56 | } |
---|
| 57 | } |
---|
| 58 | } |
---|