Hi,

I have written markup_update_6000() in a way that can provide feedback when executed by update.php

Also, rebuilds content caches if any field has been updated.

/**
 * Convert text_markup setting to markup since form_markup module no longer
 * uses markup setting in D6.
 */
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;
}

Please, let me know if you wish a proper patch.

Comments

markus_petrux’s picture

Title: Provide feedback on markup_update_6000() » Provide feedback on markup_update_6000() and rebuild content cache if necessary
cyu’s picture

Status: Needs review » Fixed

Thank you markus, should show up in next packaged dev: http://drupal.org/cvs?commit=240810

And thank you also for debugging this field with multigroup. I'll give it a try with the latest CCK dev and look at that related CCK issue you've linked.

markus_petrux’s picture

Status: Fixed » Active

It seems like markup.install has gone. ¿?

cyu’s picture

Status: Active » Fixed

Hmm...should be there now. Not sure what happened there.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.