Added Docker stuff.

This commit is contained in:
msinkec
2020-07-08 13:56:33 +02:00
commit 4e27767ac1
119 changed files with 12738 additions and 0 deletions

50
api/DBconnect.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/**
* Created by PhpStorm.
* User: Nermin
* Date: 28. 05. 2018
* Time: 12:12
*/
class DBconnect {
private static $host = getenv('DB_HOST') ?: "localhost";
private static $user = getenv('DB_USER') ?: "nermin";
private static $password = getenv('DB_PASS') ?: "";
private static $schema = getenv('DB_SCHEMA') ?: "dialectsdb";
private static $instance = null;
private function __construct() {
}
private function __clone() {
}
/**
* Returns a PDO instance -- a connection to the database.
* The singleton instance assures that there is only one connection active
* at once (within the scope of one HTTP request)
*
* @return PDO instance
*/
public static function getInstance() {
if (!self::$instance) {
$config = "mysql:host=" . self::$host
. ";dbname=" . self::$schema;
$options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_PERSISTENT => true,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
);
self::$instance = new PDO($config, self::$user, self::$password, $options);
}
return self::$instance;
}
}