Skip to content

Commit

Permalink
fix: 動画のブロックを削除したときに物理ファイルが消え残る現象対応
Browse files Browse the repository at this point in the history
  • Loading branch information
RikaFujiwara committed Dec 14, 2020
1 parent f3df896 commit f595b65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Model/VideoSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function deleteVideoSetting($data) {
}

// アップロードファイル 削除
$this->__deleteAll($this->UploadFile, 'content_key', $contentKeys);
$this->__deleteAll($this->UploadFile, 'content_key', $contentKeys, true);

// タグコンテンツ 削除
$this->__deleteAll($this->TagsContent, 'tag_id', $tagIds);
Expand Down Expand Up @@ -344,16 +344,17 @@ private function __getContentKeys($blockIds) {
* @param Model $model モデル
* @param string $filed フィールド名
* @param string $value 値
* @param bool $callBackFlag callBack実行
* @return void
* @throws InternalErrorException
*/
private function __deleteAll(Model $model, $filed, $value) {
private function __deleteAll(Model $model, $filed, $value, $callBackFlag = false) {
if (empty($value)) {
return;
}

$conditions = array($model->alias . '.' . $filed => $value);
if (! $model->deleteAll($conditions, false)) {
if (! $model->deleteAll($conditions, false, $callBackFlag)) {
throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
}
}
Expand Down

0 comments on commit f595b65

Please sign in to comment.