From 759520b3fa0a45b49b3584bc7a36e7f0a71f4894 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 19 Jun 2022 21:02:39 -0700 Subject: [PATCH] Command to update content hashes --- packages/skin-database/cli.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/skin-database/cli.ts b/packages/skin-database/cli.ts index f3291faf..d8e0d572 100755 --- a/packages/skin-database/cli.ts +++ b/packages/skin-database/cli.ts @@ -328,12 +328,28 @@ program "--refresh-archive-files", "Refresh the data we keep about files within skin archives" ) + .option( + "--refresh-content-hash", + "Refresh content hash" + ) .action( async ({ uploadIaScreenshot, uploadMissingScreenshots, refreshArchiveFiles, + refreshContentHash }) => { + if (refreshContentHash) { + const ctx = new UserContext(); + const skinRows = await knex("skins").select(); + console.log(`Found ${skinRows.length} skins to update`); + const skins = skinRows.map((row) => new SkinModel(ctx, row)); + for (const skin of skins) { + await Skins.setContentHash(skin.getMd5()); + process.stdout.write("."); + } + + } if (uploadIaScreenshot) { const md5 = uploadIaScreenshot; if (!(await SyncToArchive.uploadScreenshotIfSafe(md5))) {