*/
@Override
public Object construct() {
long startTime = System.currentTimeMillis();
EnumWikipedia wikipedia = getWikipedia();
WPCConfiguration configuration = wikipedia.getConfiguration();
setText(GT._("Retrieving MediaWiki API"));
API api = APIFactory.getAPI();
int lastCount = 0;
WikiConfiguration wikiConfiguration = wikipedia.getWikiConfiguration();
Stats stats = new Stats();
try {
if (!useList) {
// Retrieve talk pages including a warning
String warningTemplateName = configuration.getString(WPCConfigurationString.DAB_WARNING_TEMPLATE);
setText(GT._("Retrieving talk pages including {0}", "{{" + warningTemplateName + "}}"));
String templateTitle = wikiConfiguration.getPageTitle(
Namespace.TEMPLATE,
warningTemplateName);
Page warningTemplate = DataManager.getPage(
wikipedia, templateTitle, null, null, null);
api.retrieveEmbeddedIn(
wikipedia, warningTemplate,
configuration.getEncyclopedicTalkNamespaces(),
false);
List<Page> warningTalkPages = warningTemplate.getRelatedPages(Page.RelatedPages.EMBEDDED_IN);
// Construct list of articles with warning
setText(GT._("Constructing list of articles with warning"));
HashSet<Page> tmpWarningPages = new HashSet<Page>();
for (Page warningPage : warningTalkPages) {
String title = warningPage.getTitle();
String todoSubpage = configuration.getString(WPCConfigurationString.TODO_SUBPAGE);
if (title.endsWith("/" + todoSubpage)) {
title = title.substring(0, title.length() - 1 - todoSubpage.length());
}
int colonIndex = title.indexOf(':');
if (colonIndex >= 0) {
for (Integer namespace : configuration.getEncyclopedicTalkNamespaces()) {
Namespace namespaceTalk = wikiConfiguration.getNamespace(namespace);
if ((namespaceTalk != null) &&
(namespaceTalk.isPossibleName(title.substring(0, colonIndex)))) {
String tmpTitle = title.substring(colonIndex + 1);
if (namespace != Namespace.MAIN_TALK) {