loadId = $loadId; $this->site = $site; } /** * Execute the job. */ public function handle(): void { // Move the archived file back to staging $filename = $this->loadId; $archiveFilePath = StatisticsHelper::getUsageStatsDirPath() . '/' . FileLoader::FILE_LOADER_PATH_ARCHIVE . '/' . $filename; $dispatchFilePath = StatisticsHelper::getUsageStatsDirPath() . '/' . FileLoader::FILE_LOADER_PATH_DISPATCH . '/' . $filename; if (!rename($dispatchFilePath, $archiveFilePath)) { $message = __( 'admin.job.archiveLogFile.error', [ 'file' => $filename, 'dispatchFilePath' => $dispatchFilePath, 'archiveFilePath' => $archiveFilePath ] ); throw new JobException($message); } if ($this->site->getData('compressStatsLogs')) { try { $fileMgr = new FileManager(); $fileMgr->gzCompressFile($archiveFilePath); } catch (Exception $e) { error_log($e); } } } }