public function MigrateDestinationTerm::rollback in Migrate 7.2
Same name and namespace in other branches
- 6.2 plugins/destinations/term.inc \MigrateDestinationTerm::rollback()
Delete a migrated term
Parameters
$ids: Array of fields representing the key (in this case, just tid).
File
- plugins/
destinations/ term.inc, line 105 - Support for taxonomy term destinations.
Class
- MigrateDestinationTerm
- Destination class implementing migration into terms.
Code
public function rollback(array $key) {
$tid = reset($key);
/*
* This load() happens soon delete() anyway. We load here in order to
* avoid notices when term has already been deleted. That is easily possible
* considering how deleting a term parent also deletes children in same call.
*/
migrate_instrument_start('taxonomy_term_load');
if (taxonomy_term_load($tid)) {
migrate_instrument_stop('taxonomy_term_load');
migrate_instrument_start('taxonomy_term_delete');
$this
->prepareRollback($tid);
$result = (bool) taxonomy_term_delete($tid);
$this
->completeRollback($tid);
migrate_instrument_stop('taxonomy_term_delete');
}
else {
migrate_instrument_stop('taxonomy_term_load');
// If it didn't exist, consider this a success
$result = TRUE;
}
return $result;
}