public function TripalImporter::cleanFile

3.x TripalImporter.inc public TripalImporter::cleanFile()

Cleans up any temporary files that were created by the prepareFile().

This function should be called after a run() to remove any temporary files and keep them from building up on the server.

File

tripal/includes/TripalImporter.inc, line 499

Class

TripalImporter

Code

public function cleanFile() {
  try {
    // If a remote file was downloaded then remove it.
    for ($i = 0; $i < count($this->arguments['files']); $i++) {
      if (!empty($this->arguments['files'][$i]['file_remote']) and 
        file_exists($this->arguments['files'][$i]['file_path'])) {
        $this->logMessage('Removing downloaded file...');
        unlink($this->arguments['files'][$i]['file_path']);
        $this->is_prepared = FALSE;
      }
    }
  }
  catch (Exception $e) {
    throw new Exception('Cannot prepare the importer: ' . $e->getMessage());
  }
}