Our plugin (VersionPress) needs to track database changes so that it can version-control them. We currently do this by creating db.php
and overriding the $wpdb
instance in it but it has an issue that if any other plugin decides to override db.php
there will be a conflict.
My question is rather generic: to me, it seems that db.php
and creating a subclass is very weird and uncommon extensibility point in WordPress - why is that? There will probably be a reason why hooks or filters are not used. Is it because some of the queries are run before a plugin would be loaded and had a chance to influence the query? Or some other reason?
And how to work around it? We want VersionPress to work with other plugins that possibly create their own db.php. Is our only chance hooking into the 'query'
filter which unfortunately only provides unstructured query data?