remove testing guardrails, add check for auth variables
This commit is contained in:
parent
e3af35a68e
commit
4d3b43adca
|
@ -40,12 +40,17 @@ function insertInfoboxEDBID (pageContent, edbID) {
|
|||
throw new Error('Dunno how to insert the parameter into this page');
|
||||
}
|
||||
|
||||
if (!process.env.MW_USERNAME || !process.env.MW_PASSWORD) {
|
||||
console.error('Environment variables `MW_USERNAME` and `MW_PASSWORD` are required.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Log into our wiki client
|
||||
const mw = new MediaWikiClient('https://ffxiv.consolegameswiki.com/mediawiki');
|
||||
await mw.login(process.env.MW_USERNAME, process.env.MW_PASSWORD);
|
||||
|
||||
// Get pages in the "Missing EDB ID" category
|
||||
const itemPagesWithoutEDBIDs = (await mw.listCategoryPages('Category:Missing EDB ID', 500)).slice(345, 346);
|
||||
const itemPagesWithoutEDBIDs = await mw.listCategoryPages('Category:Missing EDB ID', 500);
|
||||
console.log('Processing', itemPagesWithoutEDBIDs.length, 'item pages from [[Category:Missing EDB ID]]\n');
|
||||
|
||||
for (const {title} of itemPagesWithoutEDBIDs) {
|
||||
|
@ -76,7 +81,7 @@ for (const {title} of itemPagesWithoutEDBIDs) {
|
|||
|
||||
// write the new stuff back to the wiki
|
||||
try {
|
||||
// await mw.editPage(title);
|
||||
await mw.editPage(title, updatedText, "Add EDB item ID", true);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error('writes should not fail, this seems bad, dying now');
|
||||
|
|
Loading…
Reference in a new issue