- Fixed the revision number not showing properly. Hopefully it's fixed for good this time, as it works off of logic, instead of line numbers.

- Standardized the database library code
- Deleted a few unused database related files (karma and forum activation), so they won't get in my way later. They work off of no longer existent database tables.
- Made it so the server maintains a constant connection with the database, which is established on world/New() and never broken, until the server ends. If 5 consecutive database connection attempts result in no connection getting established, the server will not attempt any more connections. Made all existing database connections use the global continuous connections. Currently we need two, as we have two databases, but the old database is going to get moved into the new one.
- Fixed the spaghetti-like report in the permissions panel, which happened when someone had many permissions enabled.
- Added database connection reports to display to dream daemon on server startup.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5015 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-11-06 17:21:13 +00:00
parent f4a559f183
commit abad9978b2
16 changed files with 264 additions and 732 deletions

View File

@@ -15,14 +15,7 @@
usr << "\red You do not have permission to do this!"
return
var/user = sqlfdbklogin
var/pass = sqlfdbkpass
var/db = sqlfdbkdb
var/address = sqladdress
var/port = sqlport
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
establish_db_connection()
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
return
@@ -53,12 +46,18 @@
var/adm_rank = select_query.item[2]
var/adm_level = select_query.item[3]
var/adm_flags = text2num(select_query.item[4])
var/rights_text = rights2text(adm_flags)
rights_text = replacetextEx(rights_text, "+", "<br>+")
if(length(rights_text) > 5)
rights_text = copytext(rights_text, 5) //Removes the first <br>, which replacetextEx() adds.
output += "<tr bgcolor='[(i % 2) ? color1 : color2]'>"
output += "<td align='center'><b>[adm_ckey]</b></td>"
output += "<td align='center'><b>[adm_rank]</b></td>"
output += "<td align='center'>[adm_level]</td>"
output += "<td align='center'>"
output += "<font size='2'>[rights2text(adm_flags)]</font>"
output += "<font size='2'>[rights_text]</font>"
output += "</td>"
output += "<td align='center'><font size='2'>"
@@ -74,8 +73,6 @@
usr << browse(output,"window=editadminpermissions;size=600x500")
dbcon.Disconnect()
/datum/admins/proc/log_admin_rank_modification(var/adm_ckey, var/new_rank)
if(!usr.client)
@@ -85,14 +82,8 @@
usr << "\red You do not have permission to do this!"
return
var/user = sqlfdbklogin
var/pass = sqlfdbkpass
var/db = sqlfdbkdb
var/address = sqladdress
var/port = sqlport
establish_db_connection()
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
return
@@ -131,8 +122,6 @@
log_query.Execute()
usr << "\blue Admin rank changed."
dbcon.Disconnect()
/datum/admins/proc/log_admin_permission_modification(var/adm_ckey, var/new_permission)
@@ -144,14 +133,7 @@
usr << "\red You do not have permission to do this!"
return
var/user = sqlfdbklogin
var/pass = sqlfdbkpass
var/db = sqlfdbkdb
var/address = sqladdress
var/port = sqlport
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
establish_db_connection()
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
return
@@ -193,6 +175,4 @@
insert_query.Execute()
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
log_query.Execute()
usr << "\blue Permission added."
dbcon.Disconnect()
usr << "\blue Permission added."