瀏覽代碼

RIP Toolserver. (Some fixes for Labs compatibilty.)

tags/v0.2
Ben Kurtovic 10 年之前
父節點
當前提交
fd5852a6d0
共有 3 個文件被更改,包括 16 次插入7 次删除
  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 查看文件

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

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

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

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):
return "database maxlag is {0}".format(self.time(site.get_maxlag()))


+ 13
- 4
earwigbot/config/script.py 查看文件

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

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)
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"] = {}
msg = "Would you like to enable an automatic shutoff page for the bot?"


+ 1
- 1
earwigbot/wiki/site.py 查看文件

@@ -729,7 +729,7 @@ class Site(object):
query = """SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) FROM
recentchanges ORDER BY rc_timestamp DESC LIMIT 1"""
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):
"""Given a namespace ID, returns associated namespace names.


Loading…
取消
儲存