protected function createCsv(KalturaBatchJob $job, KalturaLiveReportExportJobData $data) { $partnerId = $job->partnerId; $type = $job->jobSubType; // Create local path for report generation $data->outputPath = self::$taskConfig->params->localTempPath . DIRECTORY_SEPARATOR . $partnerId; KBatchBase::createDir($data->outputPath); // Generate report KBatchBase::impersonate($job->partnerId); $exporter = LiveReportFactory::getExporter($type, $data); $reportFile = $exporter->run(); $this->setFilePermissions($reportFile); KBatchBase::unimpersonate(); // Copy the report to shared location. $this->moveFile($job, $data, $partnerId); return $job; }