On a site where CCK is not installed, update 6105 fails because the functions called do not exist.

Here is a replacement function that fixes it, by checking if content module is installed first.

/**
 * Belated update for Drupal 6: Re-enable Fivestar CCK fields.
 */
function fivestar_update_6105() {
  $ret = array();

  if (!module_exists('content')) {
    $ret[] = array('success' => TRUE, 'query' => t('CCK is not installed. No need to update.'));
  }
  else {
    if ($abort = content_check_update('fivestar')) {
      return $abort;
    }

    // All CCK fields are disabled by Content module during the D6 upgrade.
    // Re-enable the Fivestar fields.
    module_load_include('inc', 'fivestar', 'fivestar_field');
    content_associate_fields('fivestar');

    $ret[] = array('success' => TRUE, 'query' => t('Re-enabled Fivestar CCK fields.'));
  }

  return $ret;
}
CommentFileSizeAuthor
#2 fivestar_content_update_fix.patch917 bytesquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Dohh. Thanks kbahey. :P

On top of this I realize now that my release notes are incorrect in saying an update isn't needed.

quicksketch’s picture

Status: Needs review » Fixed
FileSize
917 bytes

I shortened up the changes by just returning $ret early. Let me know if this requires any further changes. Thanks!

kbahey’s picture

Looks OK. Functionally the same.

Can't test it since I ran my version already on the site in question.

quicksketch’s picture

Title: update.php fails in 6.x-1.14 » Ipdate.php fails in 6.x-1.14, Call to undefined function content_check_update()

Updating title for completeness. Anyone affected by this issue, do not worry. If you don't have CCK installed you'll get this error, but it doesn't do any harm since there is nothing needed to update. I've released the 1.15 release to fix this update problem. Download the new version and try running the update again.

quicksketch’s picture

Title: Ipdate.php fails in 6.x-1.14, Call to undefined function content_check_update() » Update.php fails in 6.x-1.14, Call to undefined function content_check_update()

Status: Fixed » Closed (fixed)

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