1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00
Arsse/vendor/JKingWeb/NewsSync/Database.php

32 lines
690 B
PHP
Raw Normal View History

2016-10-02 21:07:17 +00:00
<?php
declare(strict_types=1);
2016-10-02 21:07:17 +00:00
namespace JKingWeb\NewsSync;
class Database {
protected $drv;
public function __construct(Conf $conf) {
$driver = $conf->dbClass;
$this->drv = $driver::create($conf);
2016-10-02 21:07:17 +00:00
}
static public function listDrivers(): array {
$sep = \DIRECTORY_SEPARATOR;
$path = __DIR__.$sep."Db".$sep;
$classes = [];
foreach(glob($path."Driver?*.php") as $file) {
$name = basename($file, ".php");
if(substr($name,-3) != "PDO") {
$name = NS_BASE."Db\\$name";
if(class_exists($name)) {
$classes[$name] = $name::driverName();
}
}
}
return $classes;
}
public function schemaVersion(): int {
return $this->drv->schemaVersion();
2016-10-02 21:07:17 +00:00
}
}