Perform an added check to ensure the database is connected prior to returning it.
Corrects an error encountered in bulk tracking with PIWIK_TRACKER_MODE set.
What error? how do you use bulk tracking and manage to trigger such error?
I am using 2.0.3 and an token_auth for bulk tracking, as well as have $GLOBALS['PIWIK_TRACKER_MODE'] set to true.
On every valid bulk request submission I had the following error,
PHP Fatal error: Call to a member function fetchAll() on a non-object in ... /piwik/core/Db.php on line 164
I found that fetchAll() retrieved it's db object from get(), which was calling Tracker::getDatabase(), which was returning null.
Upon adding my check, everything worked.
Don't set $GLOBALS['PIWIK_TRACKER_MODE'] to true and it should work
Added bug report: https://dev.piwik.org/trac/ticket/4603
Thanks, it's been fixed (and integration test added, so it does not break again in the future!)