Kaynağa Gözat

RIP Toolserver. (Some fixes for Labs compatibilty.)

tags/v0.2
Ben Kurtovic 11 yıl önce
ebeveyn
işleme
fd5852a6d0
3 değiştirilmiş dosya ile 16 ekleme ve 7 silme
  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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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.


Yükleniyor…
İptal
Kaydet