From 0ac69037e5d5a970ef715cb543bef08db1993b86 Mon Sep 17 00:00:00 2001 From: Tam Date: Mon, 11 Jul 2022 13:33:24 +0100 Subject: [PATCH 1/4] Craft 4 --- composer.json | 3 +-- src/Service.php | 12 ++++++++---- src/Utility.php | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index c52f6d9..95803c8 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,10 @@ { "name": "ether/logs", "description": "Access logs from the CP", - "version": "3.0.5", "type": "craft-plugin", "minimum-stability": "dev", "require": { - "craftcms/cms": "^3.0.0-RC1" + "craftcms/cms": "^4.0.0" }, "autoload": { "psr-4": { diff --git a/src/Service.php b/src/Service.php index 7ce5096..7b40bdd 100644 --- a/src/Service.php +++ b/src/Service.php @@ -11,15 +11,19 @@ class Service extends Component public function truncate ($log) { $logsDir = Craft::getAlias('@storage/logs'); - file_put_contents($logsDir . DIRECTORY_SEPARATOR . $log, ''); - Craft::$app->getSession()->setNotice($log . ' truncated.'); + $success = file_put_contents($logsDir . DIRECTORY_SEPARATOR . $log, ''); + + if ($success !== false) Craft::$app->getSession()->setNotice($log . ' truncated.'); + else Craft::$app->getSession()->setError('Failed to truncate ' . $log . ', check file permissions'); } public function delete ($log) { $logsDir = Craft::getAlias('@storage/logs'); - unlink($logsDir . DIRECTORY_SEPARATOR . $log); - Craft::$app->getSession()->setNotice($log . ' deleted.'); + $success = unlink($logsDir . DIRECTORY_SEPARATOR . $log); + + if ($success !== false) Craft::$app->getSession()->setNotice($log . ' deleted.'); + else Craft::$app->getSession()->setError('Failed to delete ' . $log . ', check file permissions'); } } \ No newline at end of file diff --git a/src/Utility.php b/src/Utility.php index 23e4469..7c36482 100644 --- a/src/Utility.php +++ b/src/Utility.php @@ -21,7 +21,7 @@ public static function id (): string return 'logs'; } - public static function iconPath () + public static function iconPath (): null|string { return Craft::getAlias('@ether/logs/utility_icon.svg'); } From b9c85755cff11726039d4f77c71923199b4b50b1 Mon Sep 17 00:00:00 2001 From: Tam Date: Mon, 11 Jul 2022 13:34:54 +0100 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index add0a2e..93e2a0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.0.0 - 2022-07-11 +### Changed +- Craft 4 release + ## 3.0.5 - 2021-11-23 ### Added - Add truncate / delete buttons From 8db7a69776b044a9ae24c2cbf81edc1b8981f1c3 Mon Sep 17 00:00:00 2001 From: Shen DeShayne Date: Tue, 19 Mar 2024 13:09:25 -0700 Subject: [PATCH 3/4] Version bump --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a0b4a..1280157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.0.1 - 2024-03-19 +### Fixed +- Escape unsafe HTML, this allows XML and HTML tags to display as text instead of render + ## 3.0.6 - 2022-05-10 ### Fixed - Escape unsafe HTML, this allows XML and HTML tags to display as text instead of render diff --git a/composer.json b/composer.json index 3576bdd..695f47c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ether/logs", "description": "Access logs from the CP", - "version": "3.0.6", + "version": "4.0.1", "type": "craft-plugin", "minimum-stability": "dev", "require": { From 0b39f082a6befee3a5b0e43fed7341946ec4b9b5 Mon Sep 17 00:00:00 2001 From: Kyle Andrews Date: Thu, 26 Sep 2024 11:29:48 -0400 Subject: [PATCH 4/4] Switched utility registration event -- Craft 5 compatibility --- src/Logs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logs.php b/src/Logs.php index 74e4a27..bcd3d80 100644 --- a/src/Logs.php +++ b/src/Logs.php @@ -27,11 +27,11 @@ public function init () Event::on( Utilities::class, - Utilities::EVENT_REGISTER_UTILITY_TYPES, + Utilities::EVENT_REGISTER_UTILITIES, function (RegisterComponentTypesEvent $event) { $event->types[] = Utility::class; } ); } -} \ No newline at end of file +}