Avoid fatal in PostgreSQL without implemented database()

https://sourceforge.net/p/adminer/discussion/1095138/thread/5e29e380/
This commit is contained in:
Jakub Vrana 2013-06-13 07:46:12 +02:00
parent aae2289095
commit e680d22023

View file

@ -19,11 +19,13 @@ class Adminer {
function database() {
global $connection;
$databases = $this->databases(false);
return (!$databases
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
);
if ($connection) {
$databases = $this->databases(false);
return (!$databases
? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
);
}
}
function databases($flush = true) {