1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-09 16:17:48 +02:00

Move connect() to Driver

This commit is contained in:
Jakub Vrana
2025-03-30 07:51:47 +02:00
parent 992561f75e
commit 7ee6f4f7ac
13 changed files with 96 additions and 113 deletions

View File

@@ -323,6 +323,13 @@ if (isset($_GET["mongo"])) {
public $primary = "_id";
static function connect(?string $server, string $username, string $password) {
if ($server == "") {
$server = "localhost:27017";
}
return parent::connect($server, $username, $password);
}
function select(string $table, array $select, array $where, array $group, array $order = array(), $limit = 1, ?int $page = 0, bool $print = false) {
$select = ($select == array("*")
? array()
@@ -430,15 +437,6 @@ if (isset($_GET["mongo"])) {
return $credentials[1];
}
function connect($credentials) {
$connection = new Db;
list($server, $username, $password) = $credentials;
if ($server == "") {
$server = "localhost:27017";
}
return ($connection->attach($server, $username, $password) ?: $connection);
}
function alter_indexes($table, $alter) {
foreach ($alter as $val) {
list($type, $name, $set) = $val;