diff --git a/CHANGELOG.md b/CHANGELOG.md index 0786f04..1280157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ +## 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 +## 4.0.0 - 2022-07-11 +### Changed +- Craft 4 release + ## 3.0.5 - 2021-11-23 ### Added - Add truncate / delete buttons diff --git a/composer.json b/composer.json index 24578e9..695f47c 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,11 @@ { "name": "ether/logs", "description": "Access logs from the CP", - "version": "3.0.6", + "version": "4.0.1", "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/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 +} 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 bb39a84..725c5ad 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'); }