You are here

function _node_gallery_check_field_upgrades in Node Gallery 7

Check to make sure user has upgraded CCK fields from D6 for all relationship types.

Throws

DrupalUpdateException

1 call to _node_gallery_check_field_upgrades()
node_gallery_update_7001 in ./node_gallery.install
Enable the node_gallery_api module to create its database tables.

File

./node_gallery.install, line 223
Install, update and uninstall functions for the node_gallery module.

Code

function _node_gallery_check_field_upgrades() {
  $result = db_query("SELECT * FROM {node_gallery_relationships_d6}");
  $missing_fields = array();
  foreach ($result as $row) {
    $field = field_info_field($row->imagefield_name);
    if (is_null($field)) {
      $missing_fields[] = $row->imagefield_name;
    }
  }
  if (!empty($missing_fields)) {
    $t = get_t();
    throw new DrupalUpdateException($t('The following fields need to be upgraded with CCK Content Migrate before Node Gallery can be upgraded: @fields.', array(
      '@fields' => implode(', ', $missing_fields),
    )));
  }
}