Commit 6c97dd7c authored by Karamel's avatar Karamel
Browse files

Remove unused SysModule DynamicDB.

parent 764f2e3f
......@@ -94,7 +94,6 @@ $filesToCheck = [
'src/lib/System/SysModules/Database/DBModule.php',
'src/lib/System/SysModules/Database/SingleDB.php',
'src/lib/System/SysModules/Database/InifileDB.php',
'src/lib/System/SysModules/Database/DynamicDB.php',
'src/lib/System/DAO/DoctrineModel.php',
'src/lib/System/DAO/DAOFactory.php',
'src/lib/System/DAO/DBException.php',
......
<?php
// Pastèque Web back office, Dynamic database module
//
// Copyright (C) 2015 Scil (http://scil.coop)
//
// This file is part of Pastèque.
//
// Pastèque is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pastèque is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Pastèque. If not, see <http://www.gnu.org/licenses/>.
namespace Pasteque\Server\System\SysModules\Database;
class DynamicDB extends DBModule {
protected static $expectedProperties = array(
"db_dsn", "db_username", "db_password");
// Remember, this cache dies at the end of each HTTP request, no panic
private $data = NULL;
private function getLocalAuthDatabase() {
return new \PDO($this->getProperty('db_dsn'),
$this->getProperty('db_username'),
$this->getProperty('db_password');
}
function getDatabase($uid) {
if ($this->data == NULL) {
$dbh = \Pasteque\get_local_auth_database();
$stmt = $dbh->prepare('SELECT * FROM pasteque_databases WHERE user_id = :user_id');
$stmt->bindParam(':user_id', $uid);
$stmt->execute();
$result = $stmt->fetchAll();
if (count($result) != 1) {
die("No database found for " . $uid);
}
$data = $result[0];
}
return $data;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment