| @@ -11,7 +11,7 @@ one that contains its config file). | |||||
| IRC Commands | IRC Commands | ||||
| ------------ | ------------ | ||||
| - **AFC-related commands** (*afc_pending*, *afc_report*, *afc_status*, | |||||
| - **AfC-related commands** (*afc_pending*, *afc_report*, *afc_status*, | |||||
| *afc_submissions*): implements various services for | *afc_submissions*): implements various services for | ||||
| [Articles for creation](http://en.wikipedia.org/wiki/WP:AFC). It has no | [Articles for creation](http://en.wikipedia.org/wiki/WP:AFC). It has no | ||||
| dependencies, but `afc_report` requires the `afc_statistics` task plugin for | dependencies, but `afc_report` requires the `afc_statistics` task plugin for | ||||
| @@ -67,24 +67,24 @@ Bot Tasks | |||||
| --------- | --------- | ||||
| - **afc_catdelink**: delinks mainspace categories (or templates, if necessary) | - **afc_catdelink**: delinks mainspace categories (or templates, if necessary) | ||||
| in declined [AFC](http://en.wikipedia.org/wiki/WP:AFC) submissions. | |||||
| in declined [AfC](http://en.wikipedia.org/wiki/WP:AFC) submissions. | |||||
| - **afc_copyvios**: checks newly-edited AFC submissions for copyright | |||||
| - **afc_copyvios**: checks newly-edited AfC submissions for copyright | |||||
| violations using the bot's built-in copyvio checking support. Takes multiple | violations using the bot's built-in copyvio checking support. Takes multiple | ||||
| config values, including connection info for a MySQL database to store | config values, including connection info for a MySQL database to store | ||||
| processed pages and a cache (disabled by default; usable by the | processed pages and a cache (disabled by default; usable by the | ||||
| [web interface](https://tools.wmflabs.org/copyvios)). A script to create the | [web interface](https://tools.wmflabs.org/copyvios)). A script to create the | ||||
| database is in `tasks/schema/afc_copyvios.sql`. | database is in `tasks/schema/afc_copyvios.sql`. | ||||
| - **afc_dailycats**: creates daily, monthly, and yearly categories for AFC. | |||||
| - **afc_dailycats**: creates daily, monthly, and yearly categories for AfC. | |||||
| - **afc_history**: generates charts about AFC submissions over time, including | |||||
| - **afc_history**: generates charts about AfC submissions over time, including | |||||
| number of pending submissions throughout the project's history as well as | number of pending submissions throughout the project's history as well as | ||||
| counts for individual reviewers. Takes multiple config values, including | counts for individual reviewers. Takes multiple config values, including | ||||
| MySQL database info. A script to create the database is in | MySQL database info. A script to create the database is in | ||||
| `tasks/schema/afc_history.sql`. | `tasks/schema/afc_history.sql`. | ||||
| - **afc_statistics**: generates statistics for AFC on the current number of | |||||
| - **afc_statistics**: generates statistics for AfC on the current number of | |||||
| pending submissions and recently declined or accepted ones. Takes multiple | pending submissions and recently declined or accepted ones. Takes multiple | ||||
| config values, including MySQL database info. A script to create the database | config values, including MySQL database info. A script to create the database | ||||
| is in `tasks/schema/afc_statistics.sql`. | is in `tasks/schema/afc_statistics.sql`. | ||||
| @@ -22,8 +22,8 @@ | |||||
| from earwigbot.commands import Command | from earwigbot.commands import Command | ||||
| class AFCPending(Command): | |||||
| """Link the user to the pending AFC submissions page and category.""" | |||||
| class AfCPending(Command): | |||||
| """Link the user to the pending AfC submissions page and category.""" | |||||
| name = "pending" | name = "pending" | ||||
| commands = ["pending", "pend"] | commands = ["pending", "pend"] | ||||
| @@ -23,8 +23,8 @@ | |||||
| from earwigbot import wiki | from earwigbot import wiki | ||||
| from earwigbot.commands import Command | from earwigbot.commands import Command | ||||
| class AFCReport(Command): | |||||
| """Get information about an AFC submission by name.""" | |||||
| class AfCReport(Command): | |||||
| """Get information about an AfC submission by name.""" | |||||
| name = "report" | name = "report" | ||||
| def process(self, data): | def process(self, data): | ||||
| @@ -24,7 +24,7 @@ import re | |||||
| from earwigbot.commands import Command | from earwigbot.commands import Command | ||||
| class AFCStatus(Command): | |||||
| class AfCStatus(Command): | |||||
| """Get the number of pending AfC submissions, open redirect requests, and | """Get the number of pending AfC submissions, open redirect requests, and | ||||
| open file upload requests.""" | open file upload requests.""" | ||||
| name = "status" | name = "status" | ||||
| @@ -143,7 +143,7 @@ class AFCStatus(Command): | |||||
| return self.site.get_category(catname).pages | return self.site.get_category(catname).pages | ||||
| def count_submissions(self): | def count_submissions(self): | ||||
| """Returns the number of open AFC submissions (count of CAT:PEND).""" | |||||
| """Returns the number of open AfC submissions (count of CAT:PEND).""" | |||||
| minus = len(self.ignore_list) | minus = len(self.ignore_list) | ||||
| return self.site.get_category("Pending AfC submissions").pages - minus | return self.site.get_category("Pending AfC submissions").pages - minus | ||||
| @@ -167,9 +167,9 @@ class AFCStatus(Command): | |||||
| return files | return files | ||||
| def get_aggregate(self, num): | def get_aggregate(self, num): | ||||
| """Returns a human-readable AFC status based on the number of pending | |||||
| AFC submissions, open redirect requests, and open FFU requests. This | |||||
| does not match {{AFC status}} directly because the algorithm factors in | |||||
| """Returns a human-readable AfC status based on the number of pending | |||||
| AfC submissions, open redirect requests, and open FFU requests. This | |||||
| does not match {{AfC status}} directly because the algorithm factors in | |||||
| WP:AFC/R and WP:FFU while the template only looks at the main | WP:AFC/R and WP:FFU while the template only looks at the main | ||||
| submissions. The reasoning is that AFC/R and FFU are still part of | submissions. The reasoning is that AFC/R and FFU are still part of | ||||
| the project, so even if there are no pending submissions, a backlog at | the project, so even if there are no pending submissions, a backlog at | ||||
| @@ -23,8 +23,8 @@ | |||||
| from earwigbot import wiki | from earwigbot import wiki | ||||
| from earwigbot.commands import Command | from earwigbot.commands import Command | ||||
| class AFCSubmissions(Command): | |||||
| """Link the user directly to some pending AFC submissions.""" | |||||
| class AfCSubmissions(Command): | |||||
| """Link the user directly to some pending AfC submissions.""" | |||||
| name = "submissions" | name = "submissions" | ||||
| commands = ["submissions", "subs"] | commands = ["submissions", "subs"] | ||||
| @@ -22,7 +22,7 @@ | |||||
| from earwigbot.tasks import Task | from earwigbot.tasks import Task | ||||
| class AFCCatDelink(Task): | |||||
| class AfCCatDelink(Task): | |||||
| """A task to delink mainspace categories in declined [[WP:AFC]] | """A task to delink mainspace categories in declined [[WP:AFC]] | ||||
| submissions.""" | submissions.""" | ||||
| name = "afc_catdelink" | name = "afc_catdelink" | ||||
| @@ -30,7 +30,7 @@ import oursql | |||||
| from earwigbot.tasks import Task | from earwigbot.tasks import Task | ||||
| class AFCCopyvios(Task): | |||||
| class AfCCopyvios(Task): | |||||
| """A task to check newly-edited [[WP:AFC]] submissions for copyright | """A task to check newly-edited [[WP:AFC]] submissions for copyright | ||||
| violations.""" | violations.""" | ||||
| name = "afc_copyvios" | name = "afc_copyvios" | ||||
| @@ -153,7 +153,7 @@ class AFCCopyvios(Task): | |||||
| return tag | return tag | ||||
| def is_pending(self, code): | def is_pending(self, code): | ||||
| """Return whether a page is a pending AFC submission.""" | |||||
| """Return whether a page is a pending AfC submission.""" | |||||
| other_statuses = ["r", "t", "d"] | other_statuses = ["r", "t", "d"] | ||||
| tmpls = ["submit", "afc submission/submit", "afc submission/pending"] | tmpls = ["submit", "afc submission/submit", "afc submission/pending"] | ||||
| for template in code.ifilter_templates(): | for template in code.ifilter_templates(): | ||||
| @@ -24,7 +24,7 @@ from datetime import datetime, timedelta | |||||
| from earwigbot.tasks import Task | from earwigbot.tasks import Task | ||||
| class AFCDailyCats(Task): | |||||
| class AfCDailyCats(Task): | |||||
| """A task to create daily categories for [[WP:AFC]].""" | """A task to create daily categories for [[WP:AFC]].""" | ||||
| name = "afc_dailycats" | name = "afc_dailycats" | ||||
| number = 3 | number = 3 | ||||
| @@ -32,7 +32,7 @@ class AFCDailyCats(Task): | |||||
| def setup(self): | def setup(self): | ||||
| cfg = self.config.tasks.get(self.name, {}) | cfg = self.config.tasks.get(self.name, {}) | ||||
| self.prefix = cfg.get("prefix", "Category:AfC submissions by date/") | self.prefix = cfg.get("prefix", "Category:AfC submissions by date/") | ||||
| self.content = cfg.get("content", "{{AFC submission category header}}") | |||||
| self.content = cfg.get("content", "{{AfC submission category header}}") | |||||
| default_summary = "Creating {0} category page for [[WP:AFC|Articles for creation]]." | default_summary = "Creating {0} category page for [[WP:AFC|Articles for creation]]." | ||||
| self.summary = self.make_summary(cfg.get("summary", default_summary)) | self.summary = self.make_summary(cfg.get("summary", default_summary)) | ||||
| @@ -22,7 +22,7 @@ | |||||
| from earwigbot.tasks import Task | from earwigbot.tasks import Task | ||||
| class AFCHistory(Task): | |||||
| class AfCHistory(Task): | |||||
| """A task to generate information about AfC submissions over time.""" | """A task to generate information about AfC submissions over time.""" | ||||
| name = "afc_history" | name = "afc_history" | ||||
| @@ -37,7 +37,7 @@ from earwigbot.tasks import Task | |||||
| _DEFAULT_PAGE_TEXT = """<noinclude><!-- You can edit anything on this page \ | _DEFAULT_PAGE_TEXT = """<noinclude><!-- You can edit anything on this page \ | ||||
| except for content inside of <!-- stat begin/end -> and <!-- sig begin/end -> \ | except for content inside of <!-- stat begin/end -> and <!-- sig begin/end -> \ | ||||
| without causing problems. Most of the chart can be modified by editing the \ | without causing problems. Most of the chart can be modified by editing the \ | ||||
| templates it uses, documented in [[Template:AFC statistics/doc]]. --> | |||||
| templates it uses, documented in [[Template:AfC statistics/doc]]. --> | |||||
| {{NOINDEX}}</noinclude>\ | {{NOINDEX}}</noinclude>\ | ||||
| <!-- stat begin --><!-- stat end --> | <!-- stat begin --><!-- stat end --> | ||||
| <span style="font-style: italic; font-size: 85%%;">Last updated by \ | <span style="font-style: italic; font-size: 85%%;">Last updated by \ | ||||
| @@ -47,13 +47,13 @@ templates it uses, documented in [[Template:AFC statistics/doc]]. --> | |||||
| _PER_CHART_LIMIT = 1000 | _PER_CHART_LIMIT = 1000 | ||||
| class AFCStatistics(Task): | |||||
| class AfCStatistics(Task): | |||||
| """A task to generate statistics for WikiProject Articles for Creation. | """A task to generate statistics for WikiProject Articles for Creation. | ||||
| Statistics are stored in a MySQL database ("u_earwig_afc_statistics") | Statistics are stored in a MySQL database ("u_earwig_afc_statistics") | ||||
| accessed with oursql. Statistics are synchronied with the live database | accessed with oursql. Statistics are synchronied with the live database | ||||
| every four minutes and saved once an hour, on the hour, to subpages of | every four minutes and saved once an hour, on the hour, to subpages of | ||||
| self.pageroot. In the live bot, this is "Template:AFC statistics". | |||||
| self.pageroot. In the live bot, this is "Template:AfC statistics". | |||||
| """ | """ | ||||
| name = "afc_statistics" | name = "afc_statistics" | ||||
| number = 2 | number = 2 | ||||
| @@ -72,7 +72,7 @@ class AFCStatistics(Task): | |||||
| self.revision_cache = {} | self.revision_cache = {} | ||||
| # Set some wiki-related attributes: | # Set some wiki-related attributes: | ||||
| self.pageroot = cfg.get("page", "Template:AFC statistics") | |||||
| self.pageroot = cfg.get("page", "Template:AfC statistics") | |||||
| self.pending_cat = cfg.get("pending", "Pending AfC submissions") | self.pending_cat = cfg.get("pending", "Pending AfC submissions") | ||||
| self.ignore_list = cfg.get("ignoreList", []) | self.ignore_list = cfg.get("ignoreList", []) | ||||
| default_summary = "Updating statistics for [[WP:WPAFC|WikiProject Articles for creation]]." | default_summary = "Updating statistics for [[WP:WPAFC|WikiProject Articles for creation]]." | ||||
| @@ -80,9 +80,9 @@ class AFCStatistics(Task): | |||||
| # Templates used in chart generation: | # Templates used in chart generation: | ||||
| templates = cfg.get("templates", {}) | templates = cfg.get("templates", {}) | ||||
| self.tl_header = templates.get("header", "AFC statistics/header") | |||||
| self.tl_header = templates.get("header", "AfC statistics/header") | |||||
| self.tl_row = templates.get("row", "#invoke:AfC|row") | self.tl_row = templates.get("row", "#invoke:AfC|row") | ||||
| self.tl_footer = templates.get("footer", "AFC statistics/footer") | |||||
| self.tl_footer = templates.get("footer", "AfC statistics/footer") | |||||
| # Connection data for our SQL database: | # Connection data for our SQL database: | ||||
| kwargs = cfg.get("sql", {}) | kwargs = cfg.get("sql", {}) | ||||
| @@ -544,12 +544,12 @@ class AFCStatistics(Task): | |||||
| return content | return content | ||||
| def _get_status_and_chart(self, content, namespace): | def _get_status_and_chart(self, content, namespace): | ||||
| """Determine the status and chart number of an AFC submission. | |||||
| """Determine the status and chart number of an AfC submission. | |||||
| The methodology used here is the same one I've been using for years | The methodology used here is the same one I've been using for years | ||||
| (see also commands.afc_report), but with the new draft system taken | (see also commands.afc_report), but with the new draft system taken | ||||
| into account. The order here is important: if there is more than one | into account. The order here is important: if there is more than one | ||||
| {{AFC submission}} template on a page, we need to know which one to | |||||
| {{AfC submission}} template on a page, we need to know which one to | |||||
| use (revision history search to find the most recent isn't a viable | use (revision history search to find the most recent isn't a viable | ||||
| idea :P). | idea :P). | ||||
| """ | """ | ||||
| @@ -569,7 +569,7 @@ class AFCStatistics(Task): | |||||
| return None, self.CHART_NONE | return None, self.CHART_NONE | ||||
| def get_statuses(self, content): | def get_statuses(self, content): | ||||
| """Return a list of all AFC submission statuses in a page's text.""" | |||||
| """Return a list of all AfC submission statuses in a page's text.""" | |||||
| valid = ["P", "R", "T", "D"] | valid = ["P", "R", "T", "D"] | ||||
| aliases = { | aliases = { | ||||
| "submit": "P", | "submit": "P", | ||||
| @@ -29,7 +29,7 @@ from earwigbot.wiki.constants import * | |||||
| NS_DRAFT = 118 | NS_DRAFT = 118 | ||||
| class AFCUndated(Task): | |||||
| class AfCUndated(Task): | |||||
| """A task to clear [[Category:Undated AfC submissions]].""" | """A task to clear [[Category:Undated AfC submissions]].""" | ||||
| name = "afc_undated" | name = "afc_undated" | ||||
| number = 5 | number = 5 | ||||
| @@ -45,7 +45,7 @@ class AFCUndated(Task): | |||||
| NS_CATEGORY_TALK] | NS_CATEGORY_TALK] | ||||
| } | } | ||||
| self.aliases = { | self.aliases = { | ||||
| "submission": ["AFC submission"], | |||||
| "submission": ["AfC submission"], | |||||
| "talk": ["WikiProject Articles for creation"] | "talk": ["WikiProject Articles for creation"] | ||||
| } | } | ||||
| @@ -72,7 +72,7 @@ class AFCUndated(Task): | |||||
| counter += 1 | counter += 1 | ||||
| def _build_aliases(self): | def _build_aliases(self): | ||||
| """Build template name aliases for the AFC templates.""" | |||||
| """Build template name aliases for the AfC templates.""" | |||||
| for key in self.aliases: | for key in self.aliases: | ||||
| base = self.aliases[key][0] | base = self.aliases[key][0] | ||||
| aliases = [base, "Template:" + base] | aliases = [base, "Template:" + base] | ||||