You are here

public function MigrateSourceCSV::performRewind in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/csv.inc \MigrateSourceCSV::performRewind()

Implementation of MigrateSource::performRewind().

Return value

void

File

plugins/sources/csv.inc, line 392
Define a MigrateSource for importing from comma separated values files.

Class

MigrateSourceCSV
Implementation of MigrateSource, to handle imports from CSV files.

Code

public function performRewind() {

  // Close any previously-opened handle
  if (!is_null($this->csvHandle)) {
    fclose($this->csvHandle);
    $this->csvHandle = NULL;
  }

  // Load up the first row, skipping the header(s) if necessary
  $this->csvHandle = fopen($this->file, 'r');
  if (!$this
    ->validResource()) {
    return;
  }
  for ($i = 0; $i < $this->headerRows; $i++) {
    $this
      ->getNextLine();
  }
  $this->rowNumber = 1;
}