/** * End the export and close the export file. * * This method must be called if BeginExport() has been called or else the export file will not be closed. */ public function EndExport() { $this->EndTime = microtime(true); $this->TotalTime = $this->EndTime - $this->BeginTime; $this->Comment($this->Path); $this->Comment('Export Completed: ' . date('Y-m-d H:i:s')); $this->Comment(sprintf('Elapsed Time: %s', self::FormatElapsed($this->TotalTime))); if ($this->TestMode || $this->Controller->Param('dumpsql') || $this->CaptureOnly) { $Queries = implode("\n\n", $this->Queries); if ($this->Destination == 'database') { fwrite($this->File, $Queries); } else { $this->Comment($Queries, true); } } if ($this->UseCompression() && function_exists('gzopen')) { gzclose($this->File); } else { fclose($this->File); } }