Skip to content

Commit

Permalink
Bug fix disable error conection
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersongoncalves committed Jun 13, 2018
1 parent 5d29d4c commit 2a1eac1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Routing/Middleware/AnalyzerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class AnalyzerMiddleware
/**
* Serve assets if the path matches one.
*
* @param \Psr\Http\Message\ServerRequestInterface $request The request.
* @param \Psr\Http\Message\ResponseInterface $response The response.
* @param callable $next Callback to invoke the next middleware.
* @param \Psr\Http\Message\ServerRequestInterface $request The request.
* @param \Psr\Http\Message\ResponseInterface $response The response.
* @param callable $next Callback to invoke the next middleware.
*
* @return \Psr\Http\Message\ResponseInterface A response
*/
Expand All @@ -52,14 +52,19 @@ public function __invoke($request, $response, $next)
*/
protected function _tableExists()
{
$db = ConnectionManager::get('default');
$tables = $db->getSchemaCollection()->listTables();
try {
$db = ConnectionManager::get('default');
$tables = $db->getSchemaCollection()->listTables();

if (in_array('analyzer_requests', $tables) && in_array('analyzer_visitors', $tables)) {
return true;
if (in_array('analyzer_requests', $tables) && in_array('analyzer_visitors', $tables)) {
return true;
}

return false;
} catch (\Exception $connectionError) {
return false;
}

return false;
}

/**
Expand Down

0 comments on commit 2a1eac1

Please sign in to comment.