Automation init...3
This commit is contained in:
parent
3e2ff5b6c0
commit
5b20de9b8a
@ -24,4 +24,20 @@ class BoardEntity extends CommonEntity
|
|||||||
{
|
{
|
||||||
return $this->attributes['pid'];
|
return $this->attributes['pid'];
|
||||||
}
|
}
|
||||||
|
public function getImagePath(): string
|
||||||
|
{
|
||||||
|
return $this->attributes['image_path'];
|
||||||
|
}
|
||||||
|
public function setImagePath(string $image_path): void
|
||||||
|
{
|
||||||
|
$this->attributes['image_path'] = $image_path;
|
||||||
|
}
|
||||||
|
public function getContent(): string
|
||||||
|
{
|
||||||
|
return $this->attributes['content'];
|
||||||
|
}
|
||||||
|
public function setContent(string $content): void
|
||||||
|
{
|
||||||
|
$this->attributes['content'] = $content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,11 +12,11 @@ class BoardsEntity extends CommonEntity
|
|||||||
}
|
}
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return $this->attributes['title'];
|
return $this->attributes['board_name'];
|
||||||
}
|
}
|
||||||
public function setTitle(string $title): void
|
public function setTitle(string $board_name): void
|
||||||
{
|
{
|
||||||
$this->attributes['title'] = $title;
|
$this->attributes['board_name'] = $board_name;
|
||||||
}
|
}
|
||||||
//Common Function
|
//Common Function
|
||||||
|
|
||||||
|
|||||||
@ -2,17 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Libraries\MyCrawler;
|
namespace App\Libraries\MyCrawler;
|
||||||
|
|
||||||
use App\Entities\Mangboard\UserEntity;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
use App\Libraries\MySocket\WebLibrary as MySocketLibrary;
|
|
||||||
use App\Libraries\MyStorage\Mangboard\FileLibrary as MyStorageLibrary;
|
use App\Libraries\MyStorage\Mangboard\FileLibrary as MyStorageLibrary;
|
||||||
use App\Libraries\MyStorage\Mangboard\BoardsLibrary;
|
use App\Libraries\MyStorage\Mangboard\BoardsLibrary;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use App\Libraries\MyStorage\Mangboard\BoardLibrary;
|
||||||
|
use App\Libraries\MySocket\WebLibrary as MySocketLibrary;
|
||||||
|
use App\Entities\Mangboard\UserEntity;
|
||||||
|
|
||||||
class YamapLibrary extends MyCrawlerLibrary
|
class YamapLibrary extends MyCrawlerLibrary
|
||||||
{
|
{
|
||||||
private $_user_entity = null;
|
private $_user_entity = null;
|
||||||
private $_boards_library = null;
|
private $_boards_library = null;
|
||||||
private $_media_tags = [];
|
private $_board_library = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -28,7 +29,7 @@ class YamapLibrary extends MyCrawlerLibrary
|
|||||||
{
|
{
|
||||||
if ($this->_myStorage === null) {
|
if ($this->_myStorage === null) {
|
||||||
$this->_myStorage = new MyStorageLibrary(getenv('yamap.storage.upload.path'));
|
$this->_myStorage = new MyStorageLibrary(getenv('yamap.storage.upload.path'));
|
||||||
$this->_myStorage->setBoardsLibrary($this->getBoardsLibrary());
|
$this->_myStorage->setBoardsEntity($this->getBoardsLibrary()->getEntity());
|
||||||
$this->_myStorage->setUserEntity($this->getUserEntity());
|
$this->_myStorage->setUserEntity($this->getUserEntity());
|
||||||
}
|
}
|
||||||
return $this->_myStorage;
|
return $this->_myStorage;
|
||||||
@ -36,11 +37,23 @@ class YamapLibrary extends MyCrawlerLibrary
|
|||||||
public function getBoardsLibrary(): BoardsLibrary
|
public function getBoardsLibrary(): BoardsLibrary
|
||||||
{
|
{
|
||||||
if ($this->_boards_library === null) {
|
if ($this->_boards_library === null) {
|
||||||
$this->_boards_library = new BoardsLibrary(getenv('yamap.storage.board.name'));
|
$this->_boards_library = new BoardsLibrary(
|
||||||
$this->_boards_library->setUserEntity($this->getUserEntity());
|
getenv('yamap.storage.board.name'),
|
||||||
|
$this->getUserEntity()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return $this->_boards_library;
|
return $this->_boards_library;
|
||||||
}
|
}
|
||||||
|
public function getBoardLibrary(): BoardLibrary
|
||||||
|
{
|
||||||
|
if ($this->_board_library === null) {
|
||||||
|
$this->_board_library = new BoardLibrary(
|
||||||
|
$this->getBoardsLibrary()->getEntity(),
|
||||||
|
$this->getUserEntity()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $this->_board_library;
|
||||||
|
}
|
||||||
public function getUserEntity(): UserEntity
|
public function getUserEntity(): UserEntity
|
||||||
{
|
{
|
||||||
if ($this->_user_entity === null) {
|
if ($this->_user_entity === null) {
|
||||||
@ -88,8 +101,8 @@ class YamapLibrary extends MyCrawlerLibrary
|
|||||||
if ($content === "") {
|
if ($content === "") {
|
||||||
throw new \Exception(__FUNCTION__ . " Content의 내용없음");
|
throw new \Exception(__FUNCTION__ . " Content의 내용없음");
|
||||||
}
|
}
|
||||||
$this->_media_tags["image_path"][] = sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName());
|
//망보드 Content 추가
|
||||||
$this->_media_tags["content"][] = $content;
|
$this->getBoardLibrary()->addContent($content);
|
||||||
return $myStorageLibrary;
|
return $myStorageLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,17 +110,17 @@ class YamapLibrary extends MyCrawlerLibrary
|
|||||||
{
|
{
|
||||||
//1. Yamap ViewPage의 이미지나영상데이터가 있으면
|
//1. Yamap ViewPage의 이미지나영상데이터가 있으면
|
||||||
$response = $this->getMySocket()->getContent($listInfo['detail_url']);
|
$response = $this->getMySocket()->getContent($listInfo['detail_url']);
|
||||||
//1.망보드 일반게시판에 게시물 생성 처리
|
//1.망보드 게시판에 게시물 생성 처리
|
||||||
$this->getBoardsLibrary()->createBoard($listInfo);
|
$this->getMyStorage()->setBoardEntity($this->getBoardLibrary()->create($listInfo));
|
||||||
$this->_media_tags = ["image_path" => [], "content" => []];
|
//망보드 image_path설정
|
||||||
|
$this->getBoardLibrary()->setImagePath(sprintf("%s/%s", $this->getMyStorage()->getPath(), $this->getMyStorage()->getOriginName()));
|
||||||
$selector = $this->getSelector($response, getenv("yamap.view.content.tag"));
|
$selector = $this->getSelector($response, getenv("yamap.view.content.tag"));
|
||||||
//3. Image 처리
|
//3. Image 처리
|
||||||
log_message("debug", sprintf("\n-------------DetailPage------------\n%s\n--------------------------\n", $selector->html()));
|
log_message("debug", sprintf("\n-------------DetailPage------------\n%s\n--------------------------\n", $selector->html()));
|
||||||
$myStorageLibrarys = $this->download("image", $selector, ["tag" => "img", "attr" => "src"]);
|
$myStorageLibrarys = $this->download("image", $selector, ["tag" => "img", "attr" => "src"]);
|
||||||
//4. Video(mp4) 처리
|
//4. Video(mp4) 처리
|
||||||
$myStorageLibrarys = $this->download("video", $selector, ["tag" => "video", "attr" => "src"], $myStorageLibrarys);
|
//5.망보드 게시판에 게시물 수정 처리
|
||||||
//5.망보드 일반게시판에 게시물 수정 처리
|
$this->getBoardLibrary()->modify();
|
||||||
$this->getBoardsLibrary()->modifyBoard($this->_media_tags);
|
|
||||||
log_message("notice", __FUNCTION__ . " 작업 완료");
|
log_message("notice", __FUNCTION__ . " 작업 완료");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
82
app/Libraries/MyStorage/Mangboard/BoardLibrary.php
Normal file
82
app/Libraries/MyStorage/Mangboard/BoardLibrary.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Libraries\MyStorage\Mangboard;
|
||||||
|
|
||||||
|
use App\Models\Mangboard\BoardModel;
|
||||||
|
use App\Entities\Mangboard\UserEntity;
|
||||||
|
use App\Entities\Mangboard\BoardsEntity;
|
||||||
|
use App\Entities\Mangboard\BoardEntity;
|
||||||
|
|
||||||
|
class BoardLibrary
|
||||||
|
{
|
||||||
|
private $_model = null;
|
||||||
|
private $_entity = null;
|
||||||
|
private $_boards_entity = null;
|
||||||
|
private $_user_entity = null;
|
||||||
|
private $_mediaTags = ["image_path" => "", "content" => ""];
|
||||||
|
public function __construct(BoardsEntity $boards_entity, UserEntity $user_entity)
|
||||||
|
{
|
||||||
|
$this->_boards_entity = $boards_entity;
|
||||||
|
$this->_user_entity = $user_entity;
|
||||||
|
}
|
||||||
|
public function getModel(): BoardModel
|
||||||
|
{
|
||||||
|
if ($this->_model === null) {
|
||||||
|
$table_name = "mb_" . $this->_boards_entity->getTitle();
|
||||||
|
$this->_model = new BoardModel($table_name);
|
||||||
|
}
|
||||||
|
return $this->_model;
|
||||||
|
}
|
||||||
|
public function getEntity(): BoardEntity
|
||||||
|
{
|
||||||
|
return $this->_entity;
|
||||||
|
}
|
||||||
|
public function getBoardsEntity(): BoardsEntity
|
||||||
|
{
|
||||||
|
return $this->_boards_entity;
|
||||||
|
}
|
||||||
|
public function getUserEntity(): UserEntity
|
||||||
|
{
|
||||||
|
return $this->_user_entity;
|
||||||
|
}
|
||||||
|
public function setImagePath(string $image_path): void
|
||||||
|
{
|
||||||
|
$this->_mediaTags['image_path'] = $image_path;
|
||||||
|
}
|
||||||
|
public function addContent(string $content)
|
||||||
|
{
|
||||||
|
if ($content != "") {
|
||||||
|
$this->_mediaTags['content'] .= $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function create(array $listInfo): BoardEntity
|
||||||
|
{
|
||||||
|
//미디어관련정보 entity에 넣기
|
||||||
|
$formDatas = [];
|
||||||
|
$formDatas['title'] = $listInfo["title"];
|
||||||
|
$formDatas['user_pid'] = $this->getUserEntity()->getPK();
|
||||||
|
$formDatas['user_id'] = $this->getUserEntity()->getID();
|
||||||
|
$formDatas['user_name'] = $listInfo["nickname"] != "" ? $listInfo["nickname"] : $this->getUserEntity()->getTitle();
|
||||||
|
$formDatas['level'] = $this->getBoardsEntity()->getListLevel();
|
||||||
|
$formDatas['hit'] = $listInfo['hit'];
|
||||||
|
$formDatas['reg_date'] = date("Y-m-d H:i:s", strtotime($listInfo['date']));
|
||||||
|
$formDatas['data_type'] = "html";
|
||||||
|
$formDatas['editor_type'] = "S";
|
||||||
|
$formDatas['image_path'] = "";
|
||||||
|
$formDatas['content'] = "";
|
||||||
|
//망보드 게시판에 등록
|
||||||
|
$this->_entity = $this->getModel()->create($formDatas);
|
||||||
|
log_message("notice", message: __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 생성 작업 완료");
|
||||||
|
return $this->_entity;
|
||||||
|
}
|
||||||
|
public function modify(): void
|
||||||
|
{
|
||||||
|
if ($this->_mediaTags['content'] != "") {
|
||||||
|
$this->getModel()->modify($this->_entity, $this->_mediaTags);
|
||||||
|
log_message("notice", __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 수정 작업 완료");
|
||||||
|
} else {
|
||||||
|
$this->getModel()->delete([$this->getModel()->getPKField() => $$this->_entity->getPK()]);
|
||||||
|
log_message("warning", __FUNCTION__ . "=>{$this->_entity->getPK()}:{$this->_entity->getTitle()} 내용이 없어 삭제처리");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,63 +2,40 @@
|
|||||||
|
|
||||||
namespace App\Libraries\MyStorage\Mangboard;
|
namespace App\Libraries\MyStorage\Mangboard;
|
||||||
|
|
||||||
use App\Entities\Mangboard\BoardEntity;
|
|
||||||
use App\Entities\Mangboard\BoardsEntity;
|
|
||||||
use App\Entities\Mangboard\UserEntity;
|
|
||||||
use App\Models\Mangboard\BoardModel;
|
|
||||||
use App\Models\Mangboard\BoardsModel;
|
use App\Models\Mangboard\BoardsModel;
|
||||||
|
use App\Entities\Mangboard\UserEntity;
|
||||||
|
use App\Entities\Mangboard\BoardsEntity;
|
||||||
|
|
||||||
class BoardsLibrary
|
class BoardsLibrary
|
||||||
{
|
{
|
||||||
private $_boards_model = null;
|
private $_model = null;
|
||||||
private $_boards_entity = null;
|
private $_entity = null;
|
||||||
private $_board_name = null;
|
private $_board_name = null;
|
||||||
private $_board_model = null;
|
|
||||||
private $_board_entity = null;
|
|
||||||
private $_user_entity = null;
|
private $_user_entity = null;
|
||||||
public function __construct(string $board_name)
|
public function __construct(string $board_name, UserEntity $uer_entity)
|
||||||
{
|
{
|
||||||
$this->_board_name = $board_name;
|
$this->_board_name = $board_name;
|
||||||
$this->_boards_entity = $this->getBoardsModel()->getEntityByID($this->getBoardName());
|
$this->_user_entity = $uer_entity;
|
||||||
}
|
}
|
||||||
public function getBoardsModel(): BoardsModel
|
public function getModel(): BoardsModel
|
||||||
{
|
{
|
||||||
if ($this->_boards_model === null) {
|
if ($this->_model === null) {
|
||||||
$this->_boards_model = new BoardsModel();
|
$this->_model = new BoardsModel();
|
||||||
}
|
}
|
||||||
return $this->_boards_model;
|
return $this->_model;
|
||||||
}
|
}
|
||||||
public function getBoardsEntity(): BoardsEntity
|
public function getEntity(): BoardsEntity
|
||||||
{
|
{
|
||||||
return $this->_boards_entity;
|
if ($this->_entity === null) {
|
||||||
}
|
$this->_entity = $this->getModel()->getEntityByID($this->getBoardName());
|
||||||
public function setBoardsEntity(BoardsEntity $boards_entity): void
|
}
|
||||||
{
|
return $this->_entity;
|
||||||
$this->_boards_entity = $boards_entity;
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------//
|
//---------------------------------------------------------------------//
|
||||||
public function getBoardName(): string
|
public function getBoardName(): string
|
||||||
{
|
{
|
||||||
return $this->_board_name;
|
return $this->_board_name;
|
||||||
}
|
}
|
||||||
public function getBoardModel(): BoardModel
|
|
||||||
{
|
|
||||||
if ($this->_board_model === null) {
|
|
||||||
$this->_board_model = new BoardModel("mb_" . $this->getBoardName());
|
|
||||||
}
|
|
||||||
return $this->_board_model;
|
|
||||||
}
|
|
||||||
public function getBoardEntity(): BoardEntity
|
|
||||||
{
|
|
||||||
if ($this->_board_entity === null) {
|
|
||||||
throw new \Exception("{$this->getBoardName()} 게시판 정보가 없습니다.");
|
|
||||||
}
|
|
||||||
return $this->_board_entity;
|
|
||||||
}
|
|
||||||
public function setBoardEntity(BoardEntity $board_entity): void
|
|
||||||
{
|
|
||||||
$this->_board_entity = $board_entity;
|
|
||||||
}
|
|
||||||
public function getUserEntity(): UserEntity
|
public function getUserEntity(): UserEntity
|
||||||
{
|
{
|
||||||
if ($this->_user_entity === null) {
|
if ($this->_user_entity === null) {
|
||||||
@ -66,43 +43,4 @@ class BoardsLibrary
|
|||||||
}
|
}
|
||||||
return $this->_user_entity;
|
return $this->_user_entity;
|
||||||
}
|
}
|
||||||
public function setUserEntity(UserEntity $user_entity): void
|
|
||||||
{
|
|
||||||
$this->_user_entity = $user_entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function createBoard(array $listInfo): void
|
|
||||||
{
|
|
||||||
//미디어관련정보 entity에 넣기
|
|
||||||
$formDatas = [];
|
|
||||||
$formDatas['title'] = $listInfo["title"];
|
|
||||||
$formDatas['user_pid'] = $this->getUserEntity()->getPK();
|
|
||||||
$formDatas['user_id'] = $this->getUserEntity()->getID();
|
|
||||||
$formDatas['user_name'] = $listInfo["nickname"] != "" ? $listInfo["nickname"] : $this->getUserEntity()->getTitle();
|
|
||||||
$formDatas['level'] = $this->getBoardsEntity()->getListLevel();
|
|
||||||
$formDatas['hit'] = $listInfo['hit'];
|
|
||||||
$formDatas['reg_date'] = date("Y-m-d H:i:s", strtotime($listInfo['date']));
|
|
||||||
$formDatas['data_type'] = "html";
|
|
||||||
$formDatas['editor_type'] = "S";
|
|
||||||
$formDatas['image_path'] = "";
|
|
||||||
$formDatas['content'] = "";
|
|
||||||
//망보드 게시판에 등록
|
|
||||||
$this->setBoardEntity($this->getBoardModel()->create($formDatas));
|
|
||||||
log_message("notice", message: __FUNCTION__ . "=>{$this->getBoardName()} 생성 작업 완료");
|
|
||||||
}
|
|
||||||
public function modifyBoard(array $media_tags): void
|
|
||||||
{
|
|
||||||
$content = implode("\n", $media_tags["content"]);
|
|
||||||
if ($content !== "") {
|
|
||||||
$formDatas = [
|
|
||||||
"image_path" => array_shift($media_tags["image_path"]),
|
|
||||||
"content" => $content
|
|
||||||
];
|
|
||||||
$this->getBoardModel()->modify($this->getBoardEntity(), $formDatas);
|
|
||||||
log_message("notice", __FUNCTION__ . "=>{$this->getBoardEntity()->getPK()}:{$this->getBoardEntity()->getTitle()} 수정 작업 완료");
|
|
||||||
} else {
|
|
||||||
$this->getBoardModel()->delete([$this->getBoardModel()->getPKField() => $this->getBoardEntity()->getPK()]);
|
|
||||||
log_message("warning", __FUNCTION__ . "=>{$this->getBoardEntity()->getPK()}:{$this->getBoardEntity()->getTitle()} 내용이 없어 삭제처리");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,21 @@
|
|||||||
|
|
||||||
namespace App\Libraries\MyStorage\Mangboard;
|
namespace App\Libraries\MyStorage\Mangboard;
|
||||||
|
|
||||||
use App\Entities\Mangboard\FileEntity;
|
|
||||||
use App\Entities\Mangboard\UserEntity;
|
|
||||||
use App\Libraries\MyStorage\FileLibrary as MyStorageLibrary;
|
|
||||||
use App\Libraries\MyStorage\Mangboard\SmallImageLibrary;
|
|
||||||
use App\Models\Mangboard\FileModel;
|
use App\Models\Mangboard\FileModel;
|
||||||
|
use App\Libraries\MyStorage\Mangboard\SmallImageLibrary;
|
||||||
|
use App\Libraries\MyStorage\FileLibrary as MyStorageLibrary;
|
||||||
|
use App\Entities\Mangboard\UserEntity;
|
||||||
|
use App\Entities\Mangboard\FileEntity;
|
||||||
|
use App\Entities\Mangboard\BoardsEntity;
|
||||||
|
use App\Entities\Mangboard\BoardEntity;
|
||||||
|
|
||||||
class FileLibrary extends MyStorageLibrary
|
class FileLibrary extends MyStorageLibrary
|
||||||
{
|
{
|
||||||
private $_file_model = null;
|
private $_model = null;
|
||||||
|
private $_entity = null;
|
||||||
|
private $_boards_entity = null;
|
||||||
|
private $_board_entity = null;
|
||||||
private $_user_entity = null;
|
private $_user_entity = null;
|
||||||
private $_boards_library = null;
|
|
||||||
private $_file_entity = null;
|
|
||||||
private $_imageLibrary = null;
|
private $_imageLibrary = null;
|
||||||
public function __construct(string $path)
|
public function __construct(string $path)
|
||||||
{
|
{
|
||||||
@ -24,43 +27,50 @@ class FileLibrary extends MyStorageLibrary
|
|||||||
$this->_imageLibrary->setSourcePath($fullPath);
|
$this->_imageLibrary->setSourcePath($fullPath);
|
||||||
$this->_imageLibrary->setDestinationPath($fullPath);
|
$this->_imageLibrary->setDestinationPath($fullPath);
|
||||||
}
|
}
|
||||||
public function getFileModel(): FileModel
|
public function getModel(): FileModel
|
||||||
{
|
{
|
||||||
if ($this->_file_model === null) {
|
if ($this->_model === null) {
|
||||||
return $this->_file_model = new FileModel();
|
return $this->_model = new FileModel();
|
||||||
}
|
}
|
||||||
return $this->_file_model;
|
return $this->_model;
|
||||||
}
|
}
|
||||||
public function getFileEntity(): FileEntity
|
public function getEntity(): FileEntity
|
||||||
{
|
{
|
||||||
return $this->_file_entity;
|
return $this->_entity;
|
||||||
}
|
}
|
||||||
private function setFileEntity(FileEntity $file_entity): void
|
public function getBoardsEntity(): BoardsEntity
|
||||||
{
|
{
|
||||||
$this->_file_entity = $file_entity;
|
if ($this->_boards_entity === null) {
|
||||||
}
|
|
||||||
public function getBoardsLibrary(): BoardsLibrary
|
|
||||||
{
|
|
||||||
if ($this->_boards_library === null) {
|
|
||||||
throw new \Exception("Board Library가 정의되지 않았습니다.");
|
throw new \Exception("Board Library가 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
return $this->_boards_library;
|
return $this->_boards_entity;
|
||||||
}
|
}
|
||||||
public function setBoardsLibrary(BoardsLibrary $boards_library): void
|
public function setBoardsEntity(BoardsEntity $boards_entity): void
|
||||||
{
|
{
|
||||||
$this->_boards_library = $boards_library;
|
$this->_boards_entity = $boards_entity;
|
||||||
}
|
}
|
||||||
public function getUserEntity(): UserEntity
|
public function getBoardEntity(): BoardEntity
|
||||||
{
|
{
|
||||||
if ($this->_user_entity === null) {
|
if ($this->_board_entity === null) {
|
||||||
throw new \Exception("사용자정보가 없습니다.");
|
throw new \Exception("Board Entity가 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
return $this->_user_entity;
|
return $this->_board_entity;
|
||||||
}
|
}
|
||||||
public function setUserEntity(UserEntity $user_entity): void
|
public function setUserEntity(UserEntity $user_entity): void
|
||||||
{
|
{
|
||||||
$this->_user_entity = $user_entity;
|
$this->_user_entity = $user_entity;
|
||||||
}
|
}
|
||||||
|
public function getUserEntity(): UserEntity
|
||||||
|
{
|
||||||
|
if ($this->_user_entity === null) {
|
||||||
|
throw new \Exception("User Entity가 정의되지 않았습니다.");
|
||||||
|
}
|
||||||
|
return $this->_user_entity;
|
||||||
|
}
|
||||||
|
public function setBoardEntity(BoardEntity $board_entity): void
|
||||||
|
{
|
||||||
|
$this->_board_entity = $board_entity;
|
||||||
|
}
|
||||||
final public function getHTMLTag(string $content = ""): string
|
final public function getHTMLTag(string $content = ""): string
|
||||||
{
|
{
|
||||||
//Board 게시판 image_path , content용 데이터 배열에 추가 후 modifyBoard에서 처리
|
//Board 게시판 image_path , content용 데이터 배열에 추가 후 modifyBoard에서 처리
|
||||||
@ -101,7 +111,7 @@ class FileLibrary extends MyStorageLibrary
|
|||||||
//파일관리 table에 등록
|
//파일관리 table에 등록
|
||||||
$formDatas = [];
|
$formDatas = [];
|
||||||
//Board PID 넣기
|
//Board PID 넣기
|
||||||
$formDatas['board_pid'] = $this->getBoardsLibrary()->getBoardEntity()->getPk();
|
$formDatas['board_pid'] = $this->getBoardEntity()->getPk();
|
||||||
//작은이미지생성후 Path/파일명 넣기
|
//작은이미지생성후 Path/파일명 넣기
|
||||||
$fileInfos = pathinfo($this->_imageLibrary->getDestinationPath() . DIRECTORY_SEPARATOR . $this->getOriginName(), PATHINFO_ALL);
|
$fileInfos = pathinfo($this->_imageLibrary->getDestinationPath() . DIRECTORY_SEPARATOR . $this->getOriginName(), PATHINFO_ALL);
|
||||||
$dstFile = $fileInfos['filename'] . "_small." . $fileInfos['extension'];
|
$dstFile = $fileInfos['filename'] . "_small." . $fileInfos['extension'];
|
||||||
@ -114,8 +124,8 @@ class FileLibrary extends MyStorageLibrary
|
|||||||
|
|
||||||
$formDatas['user_pid'] = $this->getUserEntity()->getPK();
|
$formDatas['user_pid'] = $this->getUserEntity()->getPK();
|
||||||
$formDatas['user_name'] = $this->getUserEntity()->getTitle();
|
$formDatas['user_name'] = $this->getUserEntity()->getTitle();
|
||||||
$formDatas['board_name'] = $this->getBoardsLibrary()->getBoardName();
|
$formDatas['board_name'] = $this->getBoardsEntity()->getTitle();
|
||||||
$formDatas['table_name'] = $this->getBoardsLibrary()->getBoardModel()->getTable();
|
$formDatas['table_name'] = $this->getModel()->getTable();
|
||||||
$formDatas['file_name'] = $this->getOriginName();
|
$formDatas['file_name'] = $this->getOriginName();
|
||||||
$formDatas['file_type'] = $this->getMimeType();
|
$formDatas['file_type'] = $this->getMimeType();
|
||||||
$formDatas['file_caption'] = $this->getOriginName();
|
$formDatas['file_caption'] = $this->getOriginName();
|
||||||
@ -124,13 +134,12 @@ class FileLibrary extends MyStorageLibrary
|
|||||||
$formDatas['file_size'] = $this->getFileSize();
|
$formDatas['file_size'] = $this->getFileSize();
|
||||||
$formDatas['file_sequence'] = $this->getOriginSequence();
|
$formDatas['file_sequence'] = $this->getOriginSequence();
|
||||||
$formDatas['reg_date'] = date("Y-m-d H:i:s");
|
$formDatas['reg_date'] = date("Y-m-d H:i:s");
|
||||||
$entity = $this->getFileModel()->create($formDatas);
|
$entity = $this->getModel()->create($formDatas);
|
||||||
log_message("notice", sprintf(
|
log_message("notice", sprintf(
|
||||||
"%s %s번째 작업 완료",
|
"%s %s번째 작업 완료",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
$this->getOriginSequence()
|
$this->getOriginSequence()
|
||||||
));
|
));
|
||||||
$this->setFileEntity($entity);
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ class UserLibrary extends WebLibrary
|
|||||||
{
|
{
|
||||||
private $_web_library = null;
|
private $_web_library = null;
|
||||||
private $_user_model = null;
|
private $_user_model = null;
|
||||||
private $_user_entity = null;
|
|
||||||
public function __construct() {}
|
public function __construct() {}
|
||||||
public function getUserModel(): UserModel
|
public function getUserModel(): UserModel
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user