Having done a D6 to D7 upgrade there are no longer any formatters listed and they are still in the formatters table.....any ideas what the issue might be?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chunty’s picture

I have no idea if doing this is a good move.....I'm probably about to find out but a bit of debugging has revealed the issue appears to be that the "mode" options have changed and the fields types are no-longer stored serialized so I wrote a quick update script which got all my formatters back.....now to find out if they still work!

Stick the following in a file in your drupal root and run it:

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$sql = "select * from formatters where mode in ('advanced','basic');";
$query = db_query($sql);

while($record = $query->fetchObject()) {
  $field_type = unserialize($record->field_types);
  $cs_field_type = implode(', ', $field_type);
  if (!empty($cs_field_type)) {
    db_query("UPDATE formatters SET field_types = '".$cs_field_type."' where name = '".$record->name."'");
  }
}

db_query("UPDATE formatters SET mode='token' where mode='basic'");
db_query("UPDATE formatters SET mode='php' where mode='advanced'");
unset($query);
?>
t0xicCode’s picture

Status: Active » Needs review
FileSize
1.53 KB

I've updated your code and added it to the 7000 update hook, which is automatically run when doing a d6 to d7 upgrade.

The patch is git aware and should apply cleanly with git am.

Deciphered’s picture

Status: Needs review » Postponed

Even if I add this upgrade path, the engines aren't compatible (IIRC) and as such it makes little sense to have an upgrade path at all. Instead, it makes more sense to enforce re-creation of formatters.

I'm postponing this for the moment but will re-visit and make my final verdict after 7.x-2.3 is released.

chunty’s picture

For what its worth. I get your point about needing to the re-create them and I after I ran my code I did have to revisit every formatter and modify it. BUT....From a developer point of view it was much simpler to have a list of them there that needed modifying than to try and remember what I had in place and re-create them.

Ta
Chris