Problem/Motivation
Hi. First of all thanks for all your hard work on this. I was planning to build something very similar and to my joy you already did that :) Thanks!
To the problem. If one adds ReportNotFound block to the dashboard while dblog module is not installed (watchdog table is missing), one gets the WSOD with the following error:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.watchdog' doesn't exist: SELECT COUNT(DISTINCT("message")) AS "expression" FROM "watchdog" "watchdog" WHERE "type" = :db_condition_placeholder_0; Array ( [:db_condition_placeholder_0] => page not found ) in Drupal\dashboards\Plugin\Dashboard\ReportNotFound->buildRenderArray() (line 73 of modules/contrib/dashboards/src/Plugin/Dashboard/ReportNotFound.php).
Steps to reproduce
- Ensure dblog is not installed
- Create dashboard
- Add "Top 404 pages" block to the dashboard
Proposed resolution
The block must ensure dependencies are in place before trying to run a query. If dependencies are not met, dashboard should either show an error message or a block should be hidden.
Comments
Comment #2
zaporylieComment #5
Erik Seifert CreditAttribution: Erik Seifert commentedAdd a message if report is used. Not the best option but is okay for existing installations.
Comment #6
Erik Seifert CreditAttribution: Erik Seifert commentedComment #7
zaporylieThanks for this quick fix. I just noticed this is also the case for another plugin - ErrorReport - which is not covered by the fix above.
Comment #9
Erik Seifert CreditAttribution: Erik Seifert commentedGood catch. Thx
Comment #10
Erik Seifert CreditAttribution: Erik Seifert commentedCheck the other plugins. Seems to be okay.
Comment #11
Erik Seifert CreditAttribution: Erik Seifert commented