From fee67b6775c2476d20b78714acb8f5be4f87e2ca Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 8 Feb 2024 16:30:06 +1300 Subject: [PATCH] DOC Add new query trace comment to changelog (#404) --- en/02_Developer_Guides/07_Debugging/index.md | 8 ++++++++ en/04_Changelogs/5.2.0.md | 1 + 2 files changed, 9 insertions(+) diff --git a/en/02_Developer_Guides/07_Debugging/index.md b/en/02_Developer_Guides/07_Debugging/index.md index 05b45f4a5..d200dc265 100644 --- a/en/02_Developer_Guides/07_Debugging/index.md +++ b/en/02_Developer_Guides/07_Debugging/index.md @@ -34,6 +34,14 @@ Backtrace::backtrace(); // prints a calls-stack ``` +## Debugging database queries + +You can opt in to including a comment on all ORM queries indicating where the query was executed by setting the [DBQueryBuilder.trace_query_origin](api:SilverStripe\ORM\Connect\DBQueryBuilder->trace_query_origin) configuration property or the `SS_TRACE_DB_QUERY_ORIGIN` environment variable to `true`. + +Note that the environment variable, if set, will take precedence over the configuration property value. + +This is useful if you're using a database proxy, or if you're using the [`showqueries` URL variable](url_variable_tools/#database). + ## API documentation - [Backtrace](api:SilverStripe\Dev\Backtrace) diff --git a/en/04_Changelogs/5.2.0.md b/en/04_Changelogs/5.2.0.md index cb5504257..53ba21abf 100644 --- a/en/04_Changelogs/5.2.0.md +++ b/en/04_Changelogs/5.2.0.md @@ -347,6 +347,7 @@ A [`LogicException`](https://www.php.net/manual/en/class.logicexception.php) is - You can now upload [Braille ASCII file format](https://en.wikipedia.org/wiki/Braille_ASCII) (`.brf`) files to the CMS without needing to modify the [allowed file types](/developer_guides/files/allowed_file_types/). - The assets admin section now respects the [`Upload_Validator.default_max_file_size`](api:SilverStripe\Assets\Upload_Validator->default_max_file_size) configuration if [`AssetAdmin.max_upload_size`](api:SilverStripe\AssetAdmin\Controller\AssetAdmin->max_upload_size) has not been explicitly set for your project. Previously, asset admin would ignore `Upload_Validator.default_max_file_size` and just use the PHP `upload_max_filesize` ini configuration by default. - Redirector pages with a link to a missing or unpublished page/file will now return a 404 response. You can revert to the previous behaviour by setting the [`RedirectorPageController.missing_redirect_is_404`](api:SilverStripe\CMS\Model\RedirectorPageController->missing_redirect_is_404) configuration property to `false`. +- Developers can now opt in to including a comment on all ORM database queries indicating where they were executed from. See [debugging database queries](/developer_guides/debugging/#debugging-database-queries) for details. ## API changes