function bootstrap_tour_update_7201 in Bootstrap Tour 7.2
Remove orphaned steps.
File
- ./
bootstrap_tour.install, line 95
Code
function bootstrap_tour_update_7201() {
$subquery = ' NOT in (SELECT bootstrap_tour_step_reference_target_id FROM {field_revision_bootstrap_tour_step_reference})';
foreach (array_keys(field_info_instances('bootstrap_tour_step', 'bootstrap_tour_step')) as $field_name) {
db_query("DELETE from {field_data_" . $field_name . "} WHERE entity_type = 'bootstrap_tour_step' AND entity_id " . $subquery);
db_query("DELETE from {field_revision_" . $field_name . "} WHERE entity_type = 'bootstrap_tour_step' AND entity_id " . $subquery);
}
db_query('DELETE from {bootstrap_tour_step} WHERE bootstrap_tour_step_id ' . $subquery);
}