public function import() { $projects = $this->projectEntity->fetchPairs("name", null); $statusNewRow = $this->lstErrorStatus->findOneBy(array("status" => "New")); foreach ($projects as $projectName => $index) { $fileList = $this->dataSource->getFileList("{$projectName}/exception"); foreach ($fileList as $file) { if (pathinfo($file->name, PATHINFO_EXTENSION) != "html") { continue; } $errorRow = $this->errorEntity->findOneBy(array("source_file" => $file->name)); if (!$errorRow) { try { $errorFileContent = $this->dataSource->getFileContent($file->name); $archiveFilePath = $this->dataSource->moveToArchive($file->name); $this->exceptionParser->parse($errorFileContent); $errorMessage = $this->exceptionParser->getMessage(); $title = $this->exceptionParser->getTitle(); $errorRow = $this->errorEntity->insert(array("project_id" => $projects[$projectName]->id, "error_status_id" => $statusNewRow->id, "title" => $title, "message" => $this->exceptionParser->getMessage(), "source_file" => $this->exceptionParser->getSourceFile(), "remote_file" => $archiveFilePath, "error_dt" => $file->lastModified, "ins_process_id" => __METHOD__)); $link = "http://" . $_SERVER["HTTP_HOST"] . "/error-list/display/" . $errorRow->id; $this->hipChat->sendMessage("<b>{$projectName}</b> - {$title} - {$errorMessage} <a href=\"{$link}\">Show!</a>"); } catch (InvalidArgumentException $e) { // file does not exists in source, how it can happen? That's the question, he? } } } } $this->cache->save("lastUpdate", new \DateTime()); }
public function handleUnArchive($items) { foreach ($items as $id) { $this->errorEntity->unarchive($id); } $this->redrawControl(); }
public function createComponentErrorGrid() { $selection = $this->errorEntity->findAll(); return new \FrontendModule\Components\Grids\ErrorGrid($selection, $this->projectEntity, $this->lstErrorStatus, $this->errorEntity); }