function comment_update_6002

Changed comment settings from global to per-node -- copy global settings to all node types.

Archivo

drupal-6.x/modules/comment/comment.install, line 35

Código

function comment_update_6002() {
  // Comment module might not be enabled when this is run, but we need the
  // constants defined by the module for this update.
  drupal_load('module', 'comment');
  $settings = array(
    'comment_default_mode' => COMMENT_MODE_THREADED_EXPANDED,
    'comment_default_order' => COMMENT_ORDER_NEWEST_FIRST,
    'comment_default_per_page' => 50,
    'comment_controls' => COMMENT_CONTROLS_HIDDEN,
    'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT,
    'comment_subject_field' => 1,
    'comment_preview' => COMMENT_PREVIEW_REQUIRED,
    'comment_form_location' => COMMENT_FORM_SEPARATE_PAGE,
  );
  $types = node_get_types();
  foreach ($settings as $setting => $default) {
    $value = variable_get($setting, $default);
    foreach ($types as $type => $object) {
      variable_set($setting . '_' . $type, $value);
    }
    variable_del($setting);
  }
  return array(array(
    'success' => TRUE,
    'query' => 'Global comment settings copied to all node types.',
  ));
}