<?php

/**
 * Set default wikis roles upon enable
 */
function commons_wikis_enable() {
  $revert = array(
    'commons_wikis' => array('og_features_permission'),
  );
  features_revert($revert);

  $groups = og_get_all_group();

  foreach ($groups AS $gid) {
    commons_groups_features_permission_rebuild('commons_wikis', $gid);
  }
}

/**
 * Disable summary on Wiki nodes.
 */
function commons_wikis_update_7000() {
  $revert = array(
    'commons_wikis' => array('field_instance'),
  );
  features_revert($revert);
  return array();
}

/**
 * Update Wiki message type to remove error messages.
 */
function commons_wikis_update_7001() {
  $revert = array(
    'commons_wikis' => array('message_type', 'variable'),
  );
  features_revert($revert);
  return array();
}

/**
 * Update Wiki message type to show user picture as 35x35 image style.
 */
function commons_wikis_update_7002() {
  $revert = array(
    'commons_wikis' => array('message_type'),
  );
  features_revert($revert);
  return array();
}

/**
 * Place Topics label above terms on Wiki pages.
 */
function commons_wikis_update_7003() {
  $revert = array(
    'commons_wikis' => array('field_instance'),
  );
  features_revert($revert);
  return array();
}

/**
 * Remove extra markup from message type for wikis.
 */
function commons_wikis_update_7004() {
  $revert = array(
    'commons_wikis' => array('message_type'),
  );
  features_revert($revert);
  return array();
}

/**
 * Clear views cache to have contributor view use new permission.
 */
function commons_wikis_update_7005() {
  cache_clear_all('*', 'cache_views', TRUE);
}

/**
 * Standardize Browsing Widget views.
 */
function commons_wikis_update_7006() {
  $revert = array(
    'commons_wikis' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Display sticky content at top of lists.
 */
function commons_wikis_update_7007() {
  $revert = array(
    'commons_wikis' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Improve the browsing widget empty text.
 */
function commons_wikis_update_7008() {
  $revert = array(
    'commons_wikis' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Replace the title attribute with the title field in view displays.
 */
function commons_wikis_update_7009() {
  $revert = array(
    'commons_wikis' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Standardize browsing widget field weights.
 */
function commons_wikis_update_7010() {
  $revert = array(
    'commons_wikis' => array('field_instance'),
  );
  features_revert($revert);
  return array();
}
