public function TripalFieldDownloader::writeInit

3.x TripalFieldDownloader.inc public TripalFieldDownloader::writeInit(TripalJob $job = NULL)

Parameters

TripalJob $job:

File

tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc, line 235

Class

TripalFieldDownloader

Code

public function writeInit(TripalJob $job = NULL) {

  $user = user_load($this->collection->uid);

  $this->fh = fopen(drupal_realpath($this->outfile), "w");
  if (!$this->fh) {
    throw new Exception("Cannout open collection file: " . $this->outfile);
  }

  // Add the headers to the file.
  $headers = $this->getHeader();
  if ($headers) {
    foreach ($headers as $line) {
      fwrite($this->fh, $line . "\r\n");
    }
  }
}