mirror of
https://github.com/progval/Limnoria.git
synced 2025-05-03 08:51:10 -05:00
Changed the way channel databases are handled, added supybot.databases.plugins.channelSpecific.
This commit is contained in:
parent
75f1eb4eee
commit
8daceeaebd
@ -1,3 +1,12 @@
|
|||||||
|
* Added supybot.databases.plugins.channelSpecific, a channel
|
||||||
|
value that determines whether the database used for channel-based
|
||||||
|
plugins will be a channel-specific database or a global database.
|
||||||
|
|
||||||
|
* Changed the way channel databases are handled; instead of
|
||||||
|
generating numerous #channel-<name> files, instead we create a
|
||||||
|
subdirectory of the data directory named #channel, and then stick
|
||||||
|
all the files in there.
|
||||||
|
|
||||||
* Added several configuration variables to the Status plugin to
|
* Added several configuration variables to the Status plugin to
|
||||||
determine how verbose the cpu command is.
|
determine how verbose the cpu command is.
|
||||||
|
|
||||||
|
@ -112,10 +112,18 @@ class DBHandler(object):
|
|||||||
|
|
||||||
def makeChannelFilename(channel, filename):
|
def makeChannelFilename(channel, filename):
|
||||||
# XXX We should put channel stuff in its own directory.
|
# XXX We should put channel stuff in its own directory.
|
||||||
assert filename == os.path.basename(filename)
|
assert filename == os.path.basename(filename), 'We don\'t handle dirs.'
|
||||||
channel = ircutils.toLower(channel)
|
channel = ircutils.toLower(channel)
|
||||||
filename = '%s-%s' % (channel, filename)
|
if conf.supybot.databases.plugins.channelSpecific.get(channel)():
|
||||||
return conf.supybot.directories.data.dirize(filename)
|
# Should we offer the old #channel-filename naming scheme?
|
||||||
|
dir = conf.supybot.directories.data.dirize(channel)
|
||||||
|
if not os.path.exists(dir):
|
||||||
|
os.mkdir(dir)
|
||||||
|
return os.path.join(dir, filename)
|
||||||
|
else:
|
||||||
|
return conf.supybot.directories.data.dirize(filename)
|
||||||
|
## filename = '%s-%s' % (channel, filename)
|
||||||
|
## return conf.supybot.directories.data.dirize(filename)
|
||||||
|
|
||||||
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
||||||
# want such behavior. But at this point, it wouldn't gain much for us
|
# want such behavior. But at this point, it wouldn't gain much for us
|
||||||
|
@ -618,6 +618,12 @@ registerGlobalValue(supybot.databases.channels, 'filename',
|
|||||||
for the channels database. This file will go into the directory specified
|
for the channels database. This file will go into the directory specified
|
||||||
by the supybot.directories.conf variable."""))
|
by the supybot.directories.conf variable."""))
|
||||||
|
|
||||||
|
registerGroup(supybot.databases, 'plugins')
|
||||||
|
registerChannelValue(supybot.databases.plugins, 'channelSpecific',
|
||||||
|
registry.Boolean(True, """Determines whether database-based plugins that
|
||||||
|
can be channel-specific will be so. This can be overridden by individual
|
||||||
|
channels."""))
|
||||||
|
|
||||||
###
|
###
|
||||||
# Protocol information.
|
# Protocol information.
|
||||||
###
|
###
|
||||||
|
Loading…
x
Reference in New Issue
Block a user