You are here

function og_update_5703 in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og.install \og_update_5703()
  2. 5.3 og.install \og_update_5703()
  3. 6.2 og.install \og_update_5703()

Notifications upgrade: Set flag to indicate that this is an upgraded installation.

File

./og.install, line 333

Code

function og_update_5703() {

  // Remove mail / no mail options from OG group types and move preferences to
  // og_notifications.
  drupal_load('module', 'og');
  $types = og_get_types('group_post');
  $mail_types = array();
  foreach ($types as $type) {
    $variable = 'og_content_type_usage_' . $type;
    $usage = variable_get($variable, '');
    switch ($usage) {
      case 'group_post_standard_mail':
        $mail_types[$type] = $type;
      case 'group_post_standard_nomail':
        variable_set($variable, 'group_post_standard');
        break;
      case 'group_post_wiki_mail':
        $mail_types[$type] = $type;
      case 'group_post_wiki_nomail':
        variable_set($variable, 'group_post_wiki');
        break;
    }
  }

  // Set variable for og_notifications. If it is never enabled, this variable
  // is also deleted in og_uninstall.
  variable_set('og_notifications_content_types', $mail_types);

  // Vestigial variable.
  variable_del('og_omitted_email_node_types');

  // Set update flag for og_notifications.
  variable_set('og_notifications_update_required', 1);
  return array();
}