mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01: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
|
||||
determine how verbose the cpu command is.
|
||||
|
||||
|
@ -112,10 +112,18 @@ class DBHandler(object):
|
||||
|
||||
def makeChannelFilename(channel, filename):
|
||||
# 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)
|
||||
filename = '%s-%s' % (channel, filename)
|
||||
return conf.supybot.directories.data.dirize(filename)
|
||||
if conf.supybot.databases.plugins.channelSpecific.get(channel)():
|
||||
# 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
|
||||
# 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
|
||||
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.
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user