long startTime = System.currentTimeMillis();
EnumWikipedia wiki = getWikipedia();
WPCConfiguration configuration = wiki.getConfiguration();
setText(GT._("Retrieving MediaWiki API"));
API api = APIFactory.getAPI();
int lastCount = 0;
WikiConfiguration wikiConfiguration = wiki.getWikiConfiguration();
Stats stats = new Stats();
Map<String, List<String>> errors = null;
try {
if (!useList) {
warningPages.clear();
// Retrieve talk pages including a warning
String warningTemplateName = configuration.getString(WPCConfigurationString.ISBN_WARNING_TEMPLATE);
if (warningTemplateName != null) {
setText(GT._("Retrieving talk pages including {0}", "{{" + warningTemplateName + "}}"));
String templateTitle = wikiConfiguration.getPageTitle(
Namespace.TEMPLATE,
warningTemplateName);
Page warningTemplate = DataManager.getPage(
wiki, templateTitle, null, null, null);
api.retrieveEmbeddedIn(
wiki, warningTemplate,
configuration.getEncyclopedicTalkNamespaces(),
false);
warningPages.addAll(warningTemplate.getRelatedPages(Page.RelatedPages.EMBEDDED_IN));
}
// Retrieve articles in categories for ISBN errors
List<String> categories = configuration.getStringList(WPCConfigurationStringList.ISBN_ERRORS_CATEGORIES);
if (categories != null) {
for (String category : categories) {
String categoryTitle = wikiConfiguration.getPageTitle(Namespace.CATEGORY, category);
Page categoryPage = DataManager.getPage(wiki, categoryTitle, null, null, null);
api.retrieveCategoryMembers(wiki, categoryPage, 0, false);
List<Page> categoryMembers = categoryPage.getRelatedPages(
Page.RelatedPages.CATEGORY_MEMBERS);
if (categoryMembers != null) {
warningPages.addAll(categoryMembers);
}