Skip to content

Commit

Permalink
Panel: nicer host info with sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Nov 14, 2015
1 parent 5ed5f89 commit 69c63fe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Kdyby/Doctrine/Diagnostics/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,24 @@ public function getPanel()
return '';
}

$connParams = $this->connection->getParams();
if ($connParams['driver'] === 'pdo_sqlite' && isset($connParams['path'])) {
$host = 'path: ' . basename($connParams['path']);

} else {
$host = sprintf('host: %s%s/%s',
$this->connection->getHost(),
(($p = $this->connection->getPort()) ? ':' . $p : ''),
$this->connection->getDatabase()
);
}

return
$this->renderStyles() .
sprintf('<h1>Queries: %s %s, host: %s</h1>',
sprintf('<h1>Queries: %s %s, %s</h1>',
count($this->queries),
($this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : ''),
sprintf('%s%s/%s',
$this->connection->getHost(),
(($p = $this->connection->getPort()) ? ':' . $p : ''),
$this->connection->getDatabase()
)
$host
) .
'<div class="nette-inner tracy-inner nette-Doctrine2Panel">' .
implode('<br>', array_filter(array(
Expand Down

0 comments on commit 69c63fe

Please sign in to comment.