ID:262555
 
Code:
client
New()
start
var/pronme = input(src, "What is your projects name?", "SVN", src.key) as text
var/projectname = dd_replaceText(pronme, " ", "_")
var/password = input(src, "What password for this project?") as text
if(!projectname || !password) goto start
var/directory = {"c:/Inetpub/reposroot/[projectname]"}
if(fexists("[directory]/[projectname]-auth-file"))
alert(src, "Project [projectname] already exists")
goto start
var/cmd1 = "cmd mkdir [directory]"
var/cmd2 = "c:/Program Files/Apache Group/Apache2/bin/htpasswd.exe -cb c:/Inetpub/reposroot/[projectname]/[projectname]-auth-file [projectname] [password]"
var/confloc = {"c:/Program Files/Apache Group/Apache2/conf/httpd.conf"}
src << "Creating directory"
if(shell(cmd1))
src << "Creating subversion repository files"
shell("svnadmin create [directory]")
src << "Creating password file"
shell(cmd2)
src << "Opening apache httpd files"
var/list/tempinfo1 = dd_file2list(confloc)
var/list/tempinfo = new
dd_list2file("[confloc].bak", tempinfo1) //A reversed version of file2list from Deadron.TextHandling
tempinfo += "<Location /[projectname]>"
tempinfo += "DAV svn "
tempinfo += "SVNParentPath [directory]"
tempinfo += "AuthType Basic"
tempinfo += {"AuthName "[projectname] Repository""}
tempinfo += "AuthUserFile [directory]/[projectname]-auth-file"
tempinfo += "</Location>"
src << "Writing new information to apache http files"
dd_list2file(confloc, tempinfo)//A reversed version of file2list from Deadron.TextHandling
src << "Restarting apache httpd"
if(shell("C:/Program Files/Apache Group/Apache2/bin/Apache.exe -k restart"))
src << "Apache httpd restarted"
else
src << "Error restarting apache httpd, you may have to wait for your SVN repository to become active"
src << "<font color=red size=2 face=verdana> Access your SVN repository at <a href=http://byond-svn.faith-gaming.com/[projectname]>http://byond-svn.faith-gaming.com/[projectname]</a> via tortoiseSVN client (Google it)"
src << "Username: [projectname]"
src << "Password: [password]"
del(src)


Problem description: The apache restart command works from start -> Run, but I can't make it work from shell()

Creating directory
Creating subversion repository files
Creating password file
Opening apache httpd files
Writing new information to apache http files
Restarting apache httpd
Error restarting apache httpd, you may have to wait for your SVN repository to become active
Access your SVN repository at http://byond-svn.faith-gaming.com/Test5 via tortoiseSVN client (Google it)
Username: Test5
Password: Test5




This is to be my contribution to the BYOND community, SVN server accounts for all, when its finally working, google "Subversion" if you don't know what that is.
Never mind, made it work

world
hub = "FaithGaming.SubVersion"
name = "SubVersion Account Creation"
Del()
var/savefile/T = new("Info.sav")
T["Uses"] << count
T["Users"] << users
..()
New()
..()
var/savefile/T = new("Info.sav")
T["Uses"] >> count
var/list/tmpusrs = new
T["Users"] >> tmpusrs
if(tmpusrs)
users = tmpusrs
world.status = "<br>SubVersion Account creation from Faith Gaming<br>Used: [count] times!<br>"
var/global/count = 0
var/global/list/users = new
client
New()
if(users.Find(src.ckey))
src << "This service is free, as a contribution to BYOND membership, only one repository allowed per key"
del(src)
if(src.IsByondMember())
start
var/tmp/pronme = input(src, "What is your projects name?", "SVN", src.key) as text
var/projectname = dd_replaceText(pronme, " ", "_")
var/password = input(src, "What password for this project?") as text
if(!projectname || !password) goto start
var/directory = {"c:/Inetpub/reposroot/[projectname]"}
if(fexists("[directory]/[projectname]-auth-file"))
alert(src, "Project [projectname] already exists")
goto start
var/cmd1 = "cmd mkdir [directory]"
var/cmd2 = "c:/Program Files/Apache Group/Apache2/bin/htpasswd.exe -cb c:/Inetpub/reposroot/[projectname]/[projectname]-auth-file [projectname] [password]"
var/confloc = {"c:/Program Files/Apache Group/Apache2/conf/httpd.conf"}
src << "Creating directory"
if(shell(cmd1))
src << "Creating subversion repository files"
shell("svnadmin create [directory]")
src << "Creating password file"
shell(cmd2)
src << "Opening apache httpd files"
var/list/tempinfo1 = dd_file2list(confloc)
var/list/tempinfo = new
dd_list2file("[confloc].bak", tempinfo1)
tempinfo += "<Location /[projectname]>"
tempinfo += " DAV svn "
tempinfo += " SVNPath [directory]"
tempinfo += " AuthType Basic"
tempinfo += {" AuthName "[projectname] Repository""}
tempinfo += " AuthUserFile [directory]/[projectname]-auth-file"
tempinfo += " Require valid-user"
tempinfo += "</Location>"
src << "Writing new information to apache http files"
dd_list2file(confloc, tempinfo)
src << "Restarting apache httpd"
var/httpd = "httpd.bat"
if(shell(httpd))
src << "Apache httpd restarted"
// else
// src << "Error restarting apache httpd, you may have to wait for your SVN repository to become active"
src << "<font color=red size=2 face=verdana> Access your SVN repository at <a href=http://byond-svn.faith-gaming.com/[projectname]>http://byond-svn.faith-gaming.com/[projectname]</a> via tortoiseSVN client (Google it)"
src << "Username: [projectname]"
src << "Password: [password]"
count++
world.status = "<br>SubVersion Account creation from Faith Gaming<br>Used: [count] times!<br>"
users.Add(src.ckey)
else
src << "This service is offered to BYOND members only, Faith-Gaming.com's contribution to BYOND!"
if(src.key == "Faith Gaming")
src << "Now in hosting mode"
..()
else
del(src)
In response to Holy Retribution
You really need to remove goto from this code. It has no place here. It should only be used in loops too complex for other methods. Here, a simple while() loop will replace it.

Lummox JR