Files
vgstation13/code/datums/helper_datums/getrev.dm
baloh.matevz abad9978b2 - 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
2012-11-06 17:21:13 +00:00

101 lines
2.6 KiB
Plaintext

/*
* This datum gets revision info from local svn 'entries' file
* Path to the directory containing it should be in 'config/svndir.txt' file
*
*/
var/global/datum/getrev/revdata = new("config/svndir.txt")
//Oh yeah, I'm an OOP fag, lalala
/datum/getrev
var/revision
var/commiter
var/svndirpath
var/revhref
proc/abort()
world.log << "Unable to get revision info."
spawn()
del src
New(filename)
..()
var/list/Lines = file2list(filename)
if(!Lines.len) return abort()
for(var/t in Lines)
if(!t) continue
t = trim(t)
if (length(t) == 0)
continue
else if (copytext(t, 1, 2) == "#")
continue
var/pos = findtext(t, " ")
var/name = null
var/value = null
if (pos)
name = lowertext(copytext(t, 1, pos))
value = copytext(t, pos + 1)
else
name = lowertext(t)
if(!name)
continue
switch(name)
if("svndir")
svndirpath = value
if("revhref")
revhref = value
if(svndirpath && fexists(svndirpath) && fexists("[svndirpath]/entries") && isfile(file("[svndirpath]/entries")))
var/list/filelist = file2list("[svndirpath]/entries")
var/s_archive = "" //Stores the previous line so the revision owner can be assigned.
//This thing doesn't count blank lines, so doing filelist[4] isn't working.
for(var/s in filelist)
if(!commiter)
if(s == "has-props")//The line before this is the committer.
commiter = s_archive
if(!revision)
var/n = text2num(s)
if(isnum(n))
if(n > 5000 && n < 99999) //Do you think we'll still be up and running at r100000? :) ~Errorage
revision = s
if(revision && commiter)
break
s_archive = s
if(!revision)
abort()
world.log << "Running TG Revision Number: [revision]."
diary << "Revision info loaded succesfully"
return
return abort()
proc/getRevisionText()
var/output
if(revhref)
output = {"<a href="[revhref][revision]">[revision]</a>"}
else
output = revision
return output
proc/showInfo()
return {"<html>
<head>
</head>
<body>
<p><b>Server Revision:</b> [getRevisionText()]<br/>
<b>Author:</b> [commiter]</p>
</body>
<html>"}
client/verb/showrevinfo()
set category = "OOC"
set name = "Show Server Revision"
var/output = "Sorry, the revision info is unavailable."
if(revdata)
output = revdata.showInfo()
output += "Current Infomational Settings: <br>"
output += "Protect Authority Roles From Tratior: [config.protect_roles_from_antagonist]<br>"
usr << browse(output,"window=revdata");
return