protected function MigrationBase::saveHighwater in Migrate 6.2
Same name and namespace in other branches
- 7.2 includes/base.inc \MigrationBase::saveHighwater()
Save the highwater mark for this migration (but not when using an idlist).
Parameters
mixed $highwater: Highwater mark to save
boolean $force: If TRUE, save even if it's lower than the previous value.
2 calls to MigrationBase::saveHighwater()
- Migration::import in includes/
migration.inc - Perform an import operation - migrate items from source to destination.
- Migration::rollback in includes/
migration.inc - Perform a rollback operation - remove migrated items from the destination.
File
- includes/
base.inc, line 647 - Defines the base class for migration processes.
Class
- MigrationBase
- The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…
Code
protected function saveHighwater($highwater, $force = FALSE) {
if (!isset($this->options['idlist'])) {
$query = db_update('migrate_status')
->fields(array(
'highwater' => $highwater,
))
->condition('machine_name', $this->machineName);
if (!$force) {
if (!empty($this->highwaterField['type']) && $this->highwaterField['type'] == 'int') {
// If the highwater is an integer type, we need to force the DB server
// to treat the varchar highwater field as an integer (otherwise it will
// think '5' > '10'). CAST(highwater AS INTEGER) would be ideal, but won't
// work in MySQL. This hack is thought to be portable.
$query
->where('(highwater+0) < :highwater', array(
':highwater' => $highwater,
));
}
else {
$query
->condition('highwater', $highwater, '<');
}
}
$query
->execute();
}
}