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.

<?php
/**
* 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;
}
?>
Files: 
CommentFileSizeAuthor
#2 fivestar_content_update_fix.patch917 bytesquicksketch

Comments

Dohh. Thanks kbahey. :P

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

Status:Needs review» Fixed
StatusFileSize
new917 bytes

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

Looks OK. Functionally the same.

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

Title:update.php fails in 6.x-1.14Ipdate.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.

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.