Ben Kurtovic 13 anni fa
parent
commit
6b202c5992
1 ha cambiato i file con 11 aggiunte e 11 eliminazioni
  1. +11
    -11
      bot/tasks/afc_statistics.py

+ 11
- 11
bot/tasks/afc_statistics.py Vedi File

@@ -204,7 +204,7 @@ class Task(BaseTask):
cursor.execute(query1, (source,))
result = cursor.fetchall()
if result:
res = self.site.sql_query(query2, self.split_title(dest)))
res = self.site.sql_query(query2, self.split_title(dest))
try:
new_oldid = list(res)[0][0]
except IndexError:
@@ -213,16 +213,6 @@ class Task(BaseTask):
else:
self.track_page(cursor, dest)

def split_title(self, title):
namespace, body = title.split(":", 1)[0]
if not body:
return 0, title
try:
ns = self.site.namespace_name_to_id(namespace)
except wiki.NamespaceNotFoundError:
return 0, title
return ns, body

def process_delete(self, page, **kwargs):
query = "SELECT page_id FROM page WHERE page_namespace = ? AND page_title = ?"
with self.conn.cursor() as cursor, self.db_access_lock:
@@ -316,6 +306,16 @@ class Task(BaseTask):
query = "UPDATE page SET page_notes = ? WHERE page_id = ?"
cursor.execute(query, (notes, pageid))

def split_title(self, title):
namespace, body = title.split(":", 1)[0]
if not body:
return 0, title
try:
ns = self.site.namespace_name_to_id(namespace)
except wiki.NamespaceNotFoundError:
return 0, title
return ns, body

def get_status_and_chart(self, page):
content = page.get()
if page.is_redirect():


Caricamento…
Annulla
Salva