function markup_update_6000 in Markup 6
Convert text_markup setting to markup since form_markup module no longer uses markup setting in D6.
File
- ./
markup.install, line 48 - Install, update and uninstall functions for Markup module.
Code
function markup_update_6000() {
$ret = array();
$rebuild_cache = FALSE;
$result = db_query("SELECT * FROM {content_node_field} WHERE type = 'markup'");
while ($markup = db_fetch_object($result)) {
$global_settings = unserialize($markup->global_settings);
if (isset($global_settings['text_markup'])) {
$global_settings['markup'] = $global_settings['text_markup'];
unset($global_settings['text_markup']);
// We can't use update_sql() here because of curly braces in serialized array.
db_query("UPDATE {content_node_field} SET global_settings = '%s' WHERE field_name = '%s'", serialize($global_settings), $markup->field_name);
$ret[] = array(
'success' => TRUE,
'query' => strtr('Settings updated for field %field', array(
'%field' => check_plain($markup->field_name),
)),
);
$rebuild_cache = TRUE;
}
}
// Rebuild content caches only if necessary.
if ($rebuild_cache) {
content_clear_type_cache();
}
return $ret;
}