Also use the $ignoreErrors flag to simplify the code.
Change-Id: Ieb685366b35487abcd618eb73cf67f4c266a70c7
if ( $this->isOpen() && ( microtime( true ) - $this->lastPing ) < self::PING_TTL ) {
return true;
}
- try {
- // This will reconnect if possible, or error out if not
- $this->query( "SELECT 1 AS ping", __METHOD__ );
- return true;
- } catch ( DBError $e ) {
- return false;
- }
+
+ $ignoreErrors = true;
+ $this->clearFlag( DBO_TRX, self::REMEMBER_PRIOR );
+ // This will reconnect if possible or return false if not
+ $ok = (bool)$this->query( "SELECT 1 AS ping", __METHOD__, $ignoreErrors );
+ $this->restoreFlags( self::RESTORE_PRIOR );
+
+ return $ok;
}
/**