flag_update_6001

Versions
6
flag_update_6001()

Move flag messages and link titles into the options array.

Code

contributions/flag/flag.install, line 401

<?php
function flag_update_6001() {
  $ret = array();

  if (db_column_exists('flags', 'flag_short')) {
    $result = db_query("SELECT * FROM {flags}");
    while ($flag = db_fetch_object($result)) {
      $options = unserialize($flag->options);
      $options['flag_short'] = $flag->flag_short;
      $options['flag_long'] = $flag->flag_long;
      $options['flag_message'] = $flag->flag_message;
      $options['unflag_short'] = $flag->unflag_short;
      $options['unflag_long'] = $flag->unflag_long;
      $options['unflag_message'] = $flag->unflag_message;
      db_query("UPDATE {flags} SET options = '%s' WHERE fid = %d", serialize($options), $flag->fid);
    }

    db_drop_field($ret, 'flags', 'flag_short');
    db_drop_field($ret, 'flags', 'flag_long');
    db_drop_field($ret, 'flags', 'flag_message');
    db_drop_field($ret, 'flags', 'unflag_short');
    db_drop_field($ret, 'flags', 'unflag_long');
    db_drop_field($ret, 'flags', 'unflag_message');
  }
  return $ret;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.