Some dev utils stuff
This commit is contained in:
@@ -593,11 +593,10 @@ function togglePauseSavingToDatabaseCommand(command, params, client) {
|
|||||||
|
|
||||||
function createAccountDataForNewServer(serverId) {
|
function createAccountDataForNewServer(serverId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_main`);
|
let accounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_main`);
|
||||||
if (dbQuery) {
|
for (let i in accounts) {
|
||||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serverId})`;
|
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accounts[i]["acct_id"]}, ${serverId})`;
|
||||||
quickDatabaseQuery(dbQueryString);
|
quickDatabaseQuery(dbQueryString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,6 +604,60 @@ function createAccountDataForNewServer(serverId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function fixMissingAccountServerData() {
|
||||||
|
let dbConnection = connectToDatabase();
|
||||||
|
console.log(`Connection: ${dbConnection}`);
|
||||||
|
if (dbConnection != false) {
|
||||||
|
let accounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_main WHERE acct_id > 12`);
|
||||||
|
console.log(`Accounts: ${accounts.length}`);
|
||||||
|
let servers = fetchQueryAssoc(dbConnection, `SELECT * FROM svr_main`);
|
||||||
|
console.log(`Servers: ${servers.length}`);
|
||||||
|
|
||||||
|
for (let i in accounts) {
|
||||||
|
let serverAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_svr WHERE acct_svr_acct = ${accounts[i]["acct_id"]}`)
|
||||||
|
console.log(`Server accounts for ${accounts[i]["acct_id"]}: ${serverAccounts.length}`);
|
||||||
|
for (let k in servers) {
|
||||||
|
let check = serverAccounts.find((sa) => sa["acct_svr_svr"] == servers[k]["svr_id"]);
|
||||||
|
console.log(`Check server: ${servers[k]["svr_id"]}. Amount ${check}`);
|
||||||
|
if (typeof check == "undefined") {
|
||||||
|
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accounts[i]["acct_id"]}, ${servers[k]["svr_id"]})`;
|
||||||
|
//console.log(dbQueryString);
|
||||||
|
quickDatabaseQuery(dbQueryString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function fixMissingSubAccountServerData() {
|
||||||
|
let dbConnection = connectToDatabase();
|
||||||
|
console.log(`Connection: ${dbConnection}`);
|
||||||
|
if (dbConnection != false) {
|
||||||
|
let subAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM sacct_main`);
|
||||||
|
console.log(`SubAccounts: ${subAccounts.length}`);
|
||||||
|
let servers = fetchQueryAssoc(dbConnection, `SELECT * FROM svr_main`);
|
||||||
|
console.log(`Servers: ${servers.length}`);
|
||||||
|
|
||||||
|
for (let i in subAccounts) {
|
||||||
|
let serverAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM sacct_svr WHERE sacct_svr_sacct = ${subAccounts[i]["sacct_id"]}`)
|
||||||
|
console.log(`Server accounts for ${subAccounts[i]["sacct_id"]}: ${serverAccounts.length}`);
|
||||||
|
for (let k in servers) {
|
||||||
|
let check = serverAccounts.find((sa) => sa["sacct_svr_server"] == servers[k]["svr_id"]);
|
||||||
|
console.log(`Check server: ${servers[k]["svr_id"]}. Amount ${check}`);
|
||||||
|
if (typeof check == "undefined") {
|
||||||
|
let dbQueryString = `INSERT INTO sacct_svr (sacct_svr_sacct, sacct_svr_server) VALUES (${subAccounts[i]["sacct_id"]}, ${servers[k]["svr_id"]})`;
|
||||||
|
//console.log(dbQueryString);
|
||||||
|
quickDatabaseQuery(dbQueryString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function streamAudioURLToAllPlayersCommand(command, params, client) {
|
function streamAudioURLToAllPlayersCommand(command, params, client) {
|
||||||
if (areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
|
|||||||
Reference in New Issue
Block a user