mirror of https://github.com/Mikaela/Limnoria.git
HUP handling.
This commit is contained in:
parent
c5a4972cc8
commit
b085ba5ba3
|
@ -37,7 +37,9 @@ __revision__ = "$Id$"
|
|||
__author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
||||
|
||||
import getopt
|
||||
import signal
|
||||
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
import supybot.world as world
|
||||
|
@ -78,6 +80,17 @@ def getCapability(name):
|
|||
### Do more later, for specific capabilities/sections.
|
||||
return capability
|
||||
|
||||
def _reload():
|
||||
ircdb.users.reload()
|
||||
ircdb.channels.reload()
|
||||
registry.open(world.registryFilename)
|
||||
|
||||
def _hupHandler(sig, frame):
|
||||
log.info('Received SIGHUP, reloading configuration.')
|
||||
_reload()
|
||||
|
||||
signal.signal(signal.SIGHUP, _hupHandler)
|
||||
|
||||
|
||||
class Config(callbacks.Privmsg):
|
||||
def callCommand(self, method, irc, msg, *L):
|
||||
|
@ -253,14 +266,11 @@ class Config(callbacks.Privmsg):
|
|||
Reloads the various configuration files (user database, channel
|
||||
database, registry, etc.).
|
||||
"""
|
||||
ircdb.users.reload()
|
||||
ircdb.channels.reload()
|
||||
registry.open(world.registryFilename)
|
||||
_reload() # This was factored out for SIGHUP handling.
|
||||
irc.replySuccess()
|
||||
reload = privmsgs.checkCapability(reload, 'owner')
|
||||
|
||||
|
||||
|
||||
Class = Config
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
|
Loading…
Reference in New Issue