Implemented disconnect() method in Db adaptor


Well-known member
While it's not hard to add with a custom adaptor that extends the normal one, I can think of some use cases beyond my own where you might want to disconnect from the db server, especially when you are using XF as a framework for other applications. For my case, I have something that reads some info from the database, does it's thing (which can take a few minutes) and then update the database once that is done. I'm disconnecting from the database, rather than hold the connection open (could be real problematic if you have multiple of these processes going on at once). Just extended the default adapter to give me a disconnect method:

public function disconnect()
   if ($this->isConnected())
      $this->connection = null;

   return true;


Well-known member
I've just noticed the lack of this is sitll the case for XF2.0RC3

If XenForo is going todo forking on the CLI for multiple workers, it will need to ensure the database connection is closed before forking, or you get very weird results (same for any cache provider).