Ensure there is a connection object within \OC_DB::enableCaching()

fixes #12082