You are here

public function MigrateSourceXML::getNextSource in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/xml.inc \MigrateSourceXML::getNextSource()

Advances the reader to the next source from source_urls.

Return value

bool TRUE if a valid source was loaded

1 call to MigrateSourceXML::getNextSource()
MigrateSourceXML::getNextRow in plugins/sources/xml.inc
Implementation of MigrationSource::getNextRow().

File

plugins/sources/xml.inc, line 1360
Support for migration from XML sources.

Class

MigrateSourceXML
Implementation of MigrateSource, to handle imports from XML files.

Code

public function getNextSource() {
  migrate_instrument_start('MigrateSourceXML::nextSource');

  // Return value.
  $status = FALSE;
  while ($this->activeUrl === NULL || count($this->sourceUrls) - 1 > $this->activeUrl) {
    if (is_null($this->activeUrl)) {
      $this->activeUrl = 0;
    }
    else {

      // Increment the activeUrl so we try to load the next source.
      $this->activeUrl = $this->activeUrl + 1;
    }
    $this->reader = new $this->readerClass($this->sourceUrls[$this->activeUrl], $this->elementQuery, $this->idQuery);
    $this->reader
      ->rewind();
    if ($this->reader
      ->valid()) {

      // We have a valid source.
      $status = TRUE;
      break;
    }
  }
  migrate_instrument_stop('MigrateSourceXML::nextSource');
  return $status;
}