diff --git a/app/Libraries/MyCrawler/YamapLibrary.php b/app/Libraries/MyCrawler/YamapLibrary.php index 25d9bc8..1bda72c 100644 --- a/app/Libraries/MyCrawler/YamapLibrary.php +++ b/app/Libraries/MyCrawler/YamapLibrary.php @@ -92,17 +92,16 @@ class YamapLibrary extends MyCrawlerLibrary } private function modifyBoard(BoardEntity $entity) { - $image_path = array_shift($this->_media_tags["image_path"]); - if ($image_path === null) { + $content = implode("\n", $this->_media_tags["content"]); + if ($content == "") { $this->getBoardModel()->delete([$this->getBoardModel()->getFieldPK() => $entity->getPK()]); - log_message("notice", __FUNCTION__ . " 내용이 없어서 삭제처리"); - } else { - $formDatas = [ - "image_path" => $image_path, - "content" => implode("\n", $this->_media_tags["content"]), - ]; - $this->getBoardModel()->modify($entity, $formDatas); + log_message(level: "warning", message: __FUNCTION__ . "내용이 없어 삭제처리 : {$entity->getPK()}=>{$entity->getTitle()}"); } + $formDatas = [ + "image_path" => array_shift($this->_media_tags["image_path"]), + "content" => $content + ]; + $this->getBoardModel()->modify($entity, $formDatas); log_message("notice", __FUNCTION__ . " 작업 완료"); } @@ -169,10 +168,11 @@ class YamapLibrary extends MyCrawlerLibrary __FUNCTION__, $content )); - if ($content !== "") { - $this->_media_tags["image_path"][] = sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName()); - $this->_media_tags["content"][] = $content; + if ($content === "") { + throw new \Exception(__FUNCTION__ . " Content의 내용없음"); } + $this->_media_tags["image_path"][] = sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName()); + $this->_media_tags["content"][] = $content; return $myStorageLibrary; }