-
-
Notifications
You must be signed in to change notification settings - Fork 25
Database
We're using wpdb
DB class for the DB connection in Matomo for WordPress.
This way no other DB connection needs to be configured and this way it works for all kind of DB connections even if they use any custom plugins that do any kind of thing differently.
This means behind the wpdb
class it uses always Mysqli
unless maybe in rare older installations mysql
.
WordPress logs under circumstances any kind of DB errors if the query fails and we have no influence over it if DB errors aren't suppressed. However, some queries might be expected to fail. Eg if we check whether a table exists or not. Such queries will need a comment in the query called /* WP IGNORE ERROR */
see eg https://github.com/matomo-org/wp-matomo/pull/417/files#diff-ddfe5e91c6a261d1714912faec71caa74d28f4bcda639eb877319261f5b1d2acR243 . For example: SELECT /* WP IGNORE ERROR */ 1 FROM ...
. Otherwise, the query would be logged every time as a failure (see eg https://github.com/matomo-org/wp-matomo/issues/416) and we would cause a lot of log entries and confuse everyone that a query failed.