|
@@ -204,7 +204,7 @@ class Task(BaseTask): |
|
|
cursor.execute(query1, (source,)) |
|
|
cursor.execute(query1, (source,)) |
|
|
result = cursor.fetchall() |
|
|
result = cursor.fetchall() |
|
|
if result: |
|
|
if result: |
|
|
res = self.site.sql_query(query2, self.split_title(dest))) |
|
|
|
|
|
|
|
|
res = self.site.sql_query(query2, self.split_title(dest)) |
|
|
try: |
|
|
try: |
|
|
new_oldid = list(res)[0][0] |
|
|
new_oldid = list(res)[0][0] |
|
|
except IndexError: |
|
|
except IndexError: |
|
@@ -213,16 +213,6 @@ class Task(BaseTask): |
|
|
else: |
|
|
else: |
|
|
self.track_page(cursor, dest) |
|
|
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): |
|
|
def process_delete(self, page, **kwargs): |
|
|
query = "SELECT page_id FROM page WHERE page_namespace = ? AND page_title = ?" |
|
|
query = "SELECT page_id FROM page WHERE page_namespace = ? AND page_title = ?" |
|
|
with self.conn.cursor() as cursor, self.db_access_lock: |
|
|
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 = ?" |
|
|
query = "UPDATE page SET page_notes = ? WHERE page_id = ?" |
|
|
cursor.execute(query, (notes, pageid)) |
|
|
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): |
|
|
def get_status_and_chart(self, page): |
|
|
content = page.get() |
|
|
content = page.get() |
|
|
if page.is_redirect(): |
|
|
if page.is_redirect(): |
|
|