public function GetWineFile($Command, $DownloadFileName) { echo "Getting file {$DownloadFileName} via wine at " . date("Y-m-d H:i:s") . "\n"; $command = "cd " . Config::getTmpDir() . "; " . Config::GetWine() . " " . $Command; $NewFile = tempnam(Config::getTmpDir(), "{$this->PartyID}-"); $error = exec($command, $output, $status); if ($status != 0) { trigger_error("Wine download failed on command {$command}", E_USER_ERROR); } $DownloadedFileName = Config::getTmpDir() . "/" . $DownloadFileName; if (@rename($DownloadedFileName, $NewFile) === FALSE) { trigger_error("Could not rename {$DownloadFileName} to {$NewFile}", E_USER_ERROR); } $this->FilesToPurge[$DownloadFileName] = NULL; echo "End file {$DownloadFileName} via wine at " . date("Y-m-d H:i:s") . "\n"; return $NewFile; }