You are here

function commons_content_moderation_update_7004 in Drupal Commons 7.3

Delete any copies of the Flag Abuse default flags stored in the database in order to allow alterations to take effect.

File

modules/commons/commons_content_moderation/commons_content_moderation.install, line 36

Code

function commons_content_moderation_update_7004() {

  // The Flag module automatically copies module-provided default flags into the
  // database for performance reasons.
  // Delete the Flag Abuse default flags from the database in order to have the
  // default flag alterations take effect.
  foreach (array(
    'abuse_user',
    'abuse_comment',
    'abuse_node',
    'abuse_whitelist_comment',
    'abuse_whitelist_node',
    'abuse_whitelist_user',
  ) as $abuse_flag) {
    $flag = flag_get_flag($abuse_flag);
    if ($flag) {
      $flag
        ->delete();
    }
  }
  return array();
}