mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 16:17:48 +02:00
Avoid fatal in PostgreSQL without implemented database()
https://sourceforge.net/p/adminer/discussion/1095138/thread/5e29e380/
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user