/** * xmldb_hotpot_fix_previous_field * * @param xxx $dbman * @param xmldb_table $table * @param xmldb_field $field (passed by reference) * @return void, but may update $field->previous */ function xmldb_hotpot_fix_previous_field($dbman, $table, &$field) { $previous = $field->getPrevious(); if (empty($previous) || $dbman->field_exists($table, $previous)) { // $previous field exists - do nothing } else { // $previous field does not exist, so remove it $field->setPrevious(null); } }