Browse Source

RIP Toolserver. (Some fixes for Labs compatibilty.)

tags/v0.2
Ben Kurtovic 11 years ago
parent
commit
fd5852a6d0
3 changed files with 16 additions and 7 deletions
  1. +2
    -2
      earwigbot/commands/lag.py
  2. +13
    -4
      earwigbot/config/script.py
  3. +1
    -1
      earwigbot/wiki/site.py

+ 2
- 2
earwigbot/commands/lag.py View File

@@ -24,7 +24,7 @@ from earwigbot import exceptions
from earwigbot.commands import Command from earwigbot.commands import Command


class Lag(Command): class Lag(Command):
"""Return the replag for a specific database on the Toolserver."""
"""Return replag or maxlag information on specific databases."""
name = "lag" name = "lag"
commands = ["lag", "replag", "maxlag"] commands = ["lag", "replag", "maxlag"]


@@ -45,7 +45,7 @@ class Lag(Command):
self.reply(data, msg) self.reply(data, msg)


def get_replag(self, site): def get_replag(self, site):
return "Toolserver replag is {0}".format(self.time(site.get_replag()))
return "replag is {0}".format(self.time(site.get_replag()))


def get_maxlag(self, site): def get_maxlag(self, site):
return "database maxlag is {0}".format(self.time(site.get_maxlag())) return "database maxlag is {0}".format(self.time(site.get_maxlag()))


+ 13
- 4
earwigbot/config/script.py View File

@@ -279,11 +279,20 @@ class ConfigScript(object):
self.data["wiki"]["sql"] = {} self.data["wiki"]["sql"] = {}


if self._wmf: if self._wmf:
msg = "Will this bot run from the Wikimedia Toolserver?"
toolserver = self._ask_bool(msg, default=False)
if toolserver:
args = [("host", "$1-p.rrdb.toolserver.org"), ("db", "$1_p")]
msg = "Will this bot run from the Wikimedia Tool Labs?"
labs = self._ask_bool(msg, default=False)
if labs:
args = [("host", "$1.labsdb"), ("db", "$1_p"),
("read_default_file",
"/data/project/earwigbot/replica.my.cnf")]
self.data["wiki"]["sql"] = OrderedDict(args) self.data["wiki"]["sql"] = OrderedDict(args)
else:
msg = "Will this bot run from the Wikimedia Toolserver?"
toolserver = self._ask_bool(msg, default=False)
if toolserver:
args = [("host", "$1-p.rrdb.toolserver.org"),
("db", "$1_p")]
self.data["wiki"]["sql"] = OrderedDict(args)


self.data["wiki"]["shutoff"] = {} self.data["wiki"]["shutoff"] = {}
msg = "Would you like to enable an automatic shutoff page for the bot?" msg = "Would you like to enable an automatic shutoff page for the bot?"


+ 1
- 1
earwigbot/wiki/site.py View File

@@ -729,7 +729,7 @@ class Site(object):
query = """SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) FROM query = """SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) FROM
recentchanges ORDER BY rc_timestamp DESC LIMIT 1""" recentchanges ORDER BY rc_timestamp DESC LIMIT 1"""
result = list(self.sql_query(query)) result = list(self.sql_query(query))
return result[0][0]
return int(result[0][0])


def namespace_id_to_name(self, ns_id, all=False): def namespace_id_to_name(self, ns_id, all=False):
"""Given a namespace ID, returns associated namespace names. """Given a namespace ID, returns associated namespace names.


Loading…
Cancel
Save