From 73109e5c3814a38ce5f1e9cab8f10913ff3e6b29 Mon Sep 17 00:00:00 2001 From: Wataru Nishimoto Date: Thu, 20 Feb 2020 13:52:27 +0900 Subject: [PATCH 1/6] feat: don't invalidate CDN cache when updating download count (#121) --- Model/UploadFile.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Model/UploadFile.php b/Model/UploadFile.php index 5a1cc44..cafaf07 100644 --- a/Model/UploadFile.php +++ b/Model/UploadFile.php @@ -362,7 +362,9 @@ public function countUp($data) { if ($result === false) { throw new InternalErrorException('Failed UploadFile::countUp()'); } + $this->invalidateCDN = false; $this->commit(); + $this->invalidateCDN = true; return $result; } From 812983f2b731907b481fe226ea4a6adc2d2a0058 Mon Sep 17 00:00:00 2001 From: watura Date: Fri, 21 Feb 2020 19:43:48 +0900 Subject: [PATCH 2/6] feat: not to invalidate cache when image is wysiwyg --- Model/UploadFile.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Model/UploadFile.php b/Model/UploadFile.php index cafaf07..381df70 100644 --- a/Model/UploadFile.php +++ b/Model/UploadFile.php @@ -362,9 +362,17 @@ public function countUp($data) { if ($result === false) { throw new InternalErrorException('Failed UploadFile::countUp()'); } - $this->invalidateCDN = false; + + $isWysiwyg = 'wysiwyg' == $data[$this->alias]['plugin_key']; + + if ($isWysiwyg) // wysiwyg の時はCDN cache を invalidate しない + $this->invalidateCDN = false; + $this->commit(); - $this->invalidateCDN = true; + + if ($isWysiwyg) + $this->invalidateCDN = true; + return $result; } From a49a03c3bb90c5406300f7842b298e4bff6ea326 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Tue, 25 Feb 2020 21:37:48 +0900 Subject: [PATCH 3/6] feat: don't invalidate cache when downloading files --- Model/UploadFile.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Model/UploadFile.php b/Model/UploadFile.php index 381df70..7c2b3e7 100644 --- a/Model/UploadFile.php +++ b/Model/UploadFile.php @@ -363,15 +363,9 @@ public function countUp($data) { throw new InternalErrorException('Failed UploadFile::countUp()'); } - $isWysiwyg = 'wysiwyg' == $data[$this->alias]['plugin_key']; - - if ($isWysiwyg) // wysiwyg の時はCDN cache を invalidate しない - $this->invalidateCDN = false; - + $this->invalidateCDN = false; $this->commit(); - - if ($isWysiwyg) - $this->invalidateCDN = true; + $this->invalidateCDN = true; return $result; } From e062164493355f7cd75fbd3fed1444646dc4b897 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 8 Aug 2020 18:26:39 +0900 Subject: [PATCH 4/6] =?UTF-8?q?change:=20test:=20Travis=E3=81=8B=E3=82=89P?= =?UTF-8?q?HP5.6=E3=82=92=E5=89=8A=E9=99=A4,php72=E4=BB=A5=E9=99=8D?= =?UTF-8?q?=E3=81=A7UnitTest=E3=81=A7Warning=E3=81=8C=E5=87=BA=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fc86b82..2ec599e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ services: env: matrix: - - NETCOMMONS_VERSION=master DB=mysql + - NETCOMMONS_VERSION=availability DB=mysql global: - secure: "S8behgtpd8R32b/pfr+HIdRlB1ZFACxRN/Gu9ETLIfvglBmWZW8V0mAdYoOXD2s4I3LuMrEBa2LZBzVubDSPftDvkCTCNCFChL2E0FTkFtwGT78DhBxnyx1HVvmop+6yemF6ykbud/kI24E8rR2k8SXonTLzVRM0Mx+kIqUVYvA=" - GIT_COMMITTER_NAME=RyujiAMANO From 4805608e851193ce7fd969728564f6464e3314b3 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 19 Apr 2021 17:08:02 +0900 Subject: [PATCH 5/6] =?UTF-8?q?add:=20=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E6=9C=80=E5=A4=A7=E5=AE=B9=E9=87=8F=E3=81=AE=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=81=AF=E3=80=81=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=81=94=E3=81=A8=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F?= =?UTF-8?q?=E5=85=A8=E4=BD=93=E3=82=92=E9=80=9A=E3=81=97=E3=81=A6=E3=83=81?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=82=AF=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E6=94=B9=E5=A4=89=20https://github.com/edumap-jp/Edum?= =?UTF-8?q?ap2/issues/90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/UploadFileValidateBehavior.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Behavior/UploadFileValidateBehavior.php b/Model/Behavior/UploadFileValidateBehavior.php index 2d7ce2c..b3cf824 100644 --- a/Model/Behavior/UploadFileValidateBehavior.php +++ b/Model/Behavior/UploadFileValidateBehavior.php @@ -58,7 +58,7 @@ public function getTotalSizeByRoomId(Model $model, $roomId) { (`UploadFilesContent`.`content_is_active` IN (1, NULL)) OR (`UploadFilesContent`.`content_is_latest` IN (1, NULL)) - ) AND `UploadFile`.`room_id` = ? + ) GROUP BY `UploadFile`.`id` ) AS UploadFileSize; EOF; @@ -66,7 +66,7 @@ public function getTotalSizeByRoomId(Model $model, $roomId) { $query = sprintf($query, $model->tablePrefix . 'upload_files_contents', $model->tablePrefix . 'upload_files'); - $result = $model->query($query, [$roomId]); + $result = $model->query($query); $total = $result[0][0]['total_size']; $total = (is_null($total)) ? 0 : $total; return $total; From 3536bd8fd394e7821cb1505c33ff19680ada1fd6 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 28 Mar 2024 19:19:28 +0900 Subject: [PATCH 6/6] =?UTF-8?q?change:=20PHP=E3=81=AE=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=AF=E3=80=81=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=AA=E3=83=BC?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=81=A8=E6=B1=BA=E3=82=81=E3=81=A4=E3=81=91?= =?UTF-8?q?=E3=80=81=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/jpn/LC_MESSAGES/files.po | 3 +++ Model/Behavior/AttachmentBehavior.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Locale/jpn/LC_MESSAGES/files.po b/Locale/jpn/LC_MESSAGES/files.po index fc22cee..7aaba97 100644 --- a/Locale/jpn/LC_MESSAGES/files.po +++ b/Locale/jpn/LC_MESSAGES/files.po @@ -33,6 +33,9 @@ msgstr "アップロード不可のファイル形式です" msgid "Failed uploading file." msgstr "アップロードに失敗したため、処理を中断しました。" +msgid "Upload failed. File may be larger than %s." +msgstr "アップロードに失敗しました。ファイルが%sを超えている可能性があります。アップロードするファイルを確認して再度お試しください。" + #: Files/Model/Behavior/UploadFileValidateBehavior.php:110 msgid "Total file size uploaded to the %s, exceeded the limit. The limit is %s(%s left)." msgstr "%sにアップロードしたファイルサイズの合計が大きすぎます。合計%s(残り:%s)までしか使用できません。" diff --git a/Model/Behavior/AttachmentBehavior.php b/Model/Behavior/AttachmentBehavior.php index fd3ce2a..9d0820c 100644 --- a/Model/Behavior/AttachmentBehavior.php +++ b/Model/Behavior/AttachmentBehavior.php @@ -123,8 +123,11 @@ public function beforeValidate(Model $model, $options = array()) { if (isset($fileData['error']) && $fileData['error'] !== UPLOAD_ERR_OK && $fileData['error'] !== UPLOAD_ERR_NO_FILE) { - $model->validationErrors[$fieldName][] = - __d('files', 'Failed uploading file.'); + $model->validationErrors[$fieldName][] = __d( + 'files', + 'Upload failed. File may be larger than %s.', + ini_get('upload_max_filesize') . 'B' + ); } } }