diff --git a/CHANGELOG.md b/CHANGELOG.md index ed5e7df..f90b782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- 2.6 --- +* security: Move the slow-query views' inline event handlers to CSP-safe bindings so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive: the charts/summary/details filter selects, Go/Clear buttons, time-shift icons and per-field clear glyph are bound in each view's ready block, and the confirmation Cancel button uses the `cactiReturnTo` class * perf: Stream the slow query log a line at a time during import (`fgets()`) instead of slurping the whole file into memory with `file()`, so importing a multi-gigabyte slow query log no longer costs many times its own size in PHP array overhead - the detail rows were already flushed to the database in `SLOWLOG_IMPORT_BATCH_SIZE` batches as parsing proceeds * bug: Distinguish a read error from end-of-file when streaming the import - `fgets()` returns `false` for both, so a mid-file I/O error was being treated as a clean EOF and the partial import was finalized (and post-processed) as successful. `import_logfile()` now checks `feof()` before closing the handle and fails the import (status 3, "Read Error - Import Aborted, Log May Be Truncated") instead of ingesting a truncated log * perf: Drop the `SELECT DISTINCT sld.*` from the details list query - the association tables' composite primary keys already make every `plugin_slowlog_details` x method x table join row unique, so the DISTINCT never removed a row and only forced a filesort/hash over the `mediumtext` query columns on every page of the Details view diff --git a/README.md b/README.md index 56406d3..b1630e0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,20 @@ Very simple analysis. I use it to see the forest through the tree's. Cacti 1.2.x +## Cacti compatibility + +If you are running a version of Cacti below 1.2.31, please add the function +below to the `applySkin()` function in `include/layout.js` to enable the Cancel +buttons on forms to work: + +```js +$(document).off('click.cactiReturnTo', '.cactiReturnTo') + .on('click.cactiReturnTo', '.cactiReturnTo', function(event) { + event.preventDefault(); + cactiReturnTo($(this).attr('data-url')); + }); +``` + ## Installation Simply place in the plugins directory and install like any other Cacti Plugin. diff --git a/includes/slowlog_functions.php b/includes/slowlog_functions.php index 3a5bd5e..433eedc 100644 --- a/includes/slowlog_functions.php +++ b/includes/slowlog_functions.php @@ -3038,7 +3038,7 @@ function slowlog_details_filter_clear_glyph(string $field): string { $defaults = slowlog_details_filter_defaults(); $url = slowlog_details_filter_url($field, $defaults[$field]) . '&header=false'; - return " "; + return " "; } /** diff --git a/slowlog.php b/slowlog.php index 829debc..10bb8fb 100644 --- a/slowlog.php +++ b/slowlog.php @@ -1544,8 +1544,8 @@ function slowlog_charts_filter(string $method, int $id): void {