]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - plugins/sql_auth/SQL/sql.php
Move to new style config, with config in config/ directory.
[irc/unrealircd/unrealircd-webpanel.git] / plugins / sql_auth / SQL / sql.php
index 6de0d6cfc1bdfe4b713df7137ab88bf091bd7fa5..b325c96bc4610ba5a5fda9a6386db797d85bffe7 100644 (file)
@@ -2,13 +2,17 @@
 
 function sqlnew()
 {
-       $host = SQL_IP;
-       $user = SQL_USERNAME;
-       $pass = SQL_PASSWORD;
-       $db = SQL_DATABASE;
+       $host = get_config("mysql::host");
+       $user = get_config("mysql::username");
+       $pass = get_config("mysql::password");
+       $db = get_config("mysql::database");
        $charset = 'utf8mb4';
 
-       $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
+       if ($host[0] == "/")
+               $host_type = "unix_socket";
+       else
+               $host_type = "host";
+       $dsn = "mysql:$host_type=$host;dbname=$db;charset=$charset";
        $options = [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,