Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't automatically rewind DirectoryScanner file handle #768

Merged
merged 2 commits into from
Jan 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions classes/ETL/DataEndpoint/DirectoryScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,6 @@ function ($current, $key, $iterator) use ($lmStartTs, $lmEndTs) {

$this->handle = $iterator;

// Rewind the handle so it is ready to use.
$this->handle->rewind();

return $this->handle;

} // connect()
Expand Down Expand Up @@ -781,9 +778,10 @@ public function valid()
// By default the key is the path and the value is an SplFileInfo object.
// http://php.net/manual/en/class.splfileinfo.php

$this->logger->debug("Initializing first file iterator");
$key = $this->handle->key();
$this->logger->debug(sprintf("Initializing first file iterator: %s", $key));

$this->initializeCurrentFileIterator($this->handle->key());
$this->initializeCurrentFileIterator($key);

// Save the first file iterator so we don't need to re-parse the first file on rewind

Expand Down Expand Up @@ -1035,6 +1033,7 @@ public function parse()
// If current file iterator is NULL then initialize it

if ( null === $this->currentFileIterator ) {
$this->rewind();
$this->valid();
}

Expand Down