function flag_update_5001 in Flag 5
Move flag messages and link titles into the options array.
File
- ./
flag.install, line 316 - Flag module install/update hooks.
Code
function flag_update_5001() {
$ret = array();
if (_flag_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);
}
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN flag_short');
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN flag_long');
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN flag_message');
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN unflag_short');
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN unflag_long');
$ret[] = update_sql('ALTER TABLE {flags} DROP COLUMN unflag_message');
}
return $ret;
}