Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions botconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,23 @@ def configure(rehash="NO"):
if rehash == "NO":
print "*** FATAL: quitting ***"
return "Error"
elif option == "MySQL_port":
if "MySQL_port" in defined:
print "*** CONFIG PARSE ERROR ON LINE " + str(linenumber) + " ***"
print "*** MySQL_port already defined, using earlier definition ***"
else:
try:
MPort = line.strip().split("=")[1].strip().split("##")[0].strip()
if MPort == "":
print "*** CONFIG PARSE ERROR ON LINE " + str(linenumber) + " ***"
print "*** No arguments for option MySQL_port, using default (3306) ***"
defined["MySQL_port"] = "3306"
else:
defined["MySQL_port"] = MPort
except IndexError:
print "*** CONFIG PARSE ERROR ON LINE " + str(linenumber) + " ***"
print "*** No arguments for option MySQL_port, using default (3306) ***"
defined["MySQL_port"] = "3306"
elif option == "MySQL_passwd":
if "MySQL_passwd" in defined:
print "*** CONFIG PARSE ERROR ON LINE " + str(linenumber) + " ***"
Expand Down
1 change: 1 addition & 0 deletions zookeeper.conf
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ HalfOps = user,anotheruser,john ## Ignored if mod_IRCPrivs is enabled

# These should match the settings in config.php
MySQL_host =
MySQL_port =
MySQL_user =
MySQL_passwd =
MySQL_db =
Expand Down
1 change: 1 addition & 0 deletions zookeeper.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ HalfOps = user,anotheruser,john ## Ignored if mod_IRCPrivs is enabled

# These should match the settings in config.php
MySQL_host =
MySQL_port =
MySQL_user =
MySQL_passwd =
MySQL_db =
Expand Down
3 changes: 2 additions & 1 deletion zookeeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
Channels = config["Channels"].split(",")
AnnounceChans = config["AnnounceChan"].split(",")
MySQL_host = config["MySQL_host"]
MySQL_port = int(config["MySQL_port"])
MySQL_user = config["MySQL_user"]
MySQL_passwd = config["MySQL_passwd"]
MySQL_db = config["MySQL_db"]
Expand Down Expand Up @@ -94,7 +95,7 @@ class mysql:
def __init__(self):
self.running = True;
try:
self.sql = MySQLdb.connect(host = MySQL_host, user = MySQL_user, passwd = MySQL_passwd, db = MySQL_db, reconnect = 1)
self.sql = MySQLdb.connect(host = MySQL_host, port = MySQL_port, user = MySQL_user, passwd = MySQL_passwd, db = MySQL_db, reconnect = 1)
except MySQLdb.Error, e:
self.running = True;
print "*** MySQL Error %d: %s ***" % (e.args[0], e.args[1])
Expand Down