릴리스: v1.3.66 누락 썸네일 정리 조건 보정
This commit is contained in:
@@ -1083,6 +1083,8 @@ async function cleanupMissingUploadReferences() {
|
||||
const stats = {
|
||||
clearedAvatars: 0,
|
||||
clearedGameThumbnails: 0,
|
||||
clearedTierListThumbnails: 0,
|
||||
clearedTemplateRequestThumbnails: 0,
|
||||
deletedGameItems: 0,
|
||||
updatedTierLists: 0,
|
||||
updatedTemplateRequests: 0,
|
||||
@@ -1124,67 +1126,69 @@ async function cleanupMissingUploadReferences() {
|
||||
missingCustomSrcs.add(row.src)
|
||||
}
|
||||
|
||||
if (missingCustomItemIds.size || missingCustomSrcs.size) {
|
||||
for (const row of tierListRows) {
|
||||
const groups = parseJson(row.groups_json, [])
|
||||
const pool = parseJson(row.pool_json, [])
|
||||
let changed = false
|
||||
let nextThumbnail = row.thumbnail_src || ''
|
||||
for (const row of tierListRows) {
|
||||
const groups = parseJson(row.groups_json, [])
|
||||
const pool = parseJson(row.pool_json, [])
|
||||
let changed = false
|
||||
let nextThumbnail = row.thumbnail_src || ''
|
||||
|
||||
if (row.thumbnail_src && !(await fileExistsForUploadSrc(row.thumbnail_src))) {
|
||||
nextThumbnail = ''
|
||||
changed = true
|
||||
}
|
||||
if (row.thumbnail_src && !(await fileExistsForUploadSrc(row.thumbnail_src))) {
|
||||
nextThumbnail = ''
|
||||
changed = true
|
||||
stats.clearedTierListThumbnails += 1
|
||||
}
|
||||
|
||||
const strippedPool = stripMissingItems(pool, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedGroups = stripItemIdsFromGroups(groups, missingCustomItemIds)
|
||||
if (strippedPool.changed || strippedGroups.changed) changed = true
|
||||
const strippedPool = stripMissingItems(pool, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedGroups = stripItemIdsFromGroups(groups, missingCustomItemIds)
|
||||
if (strippedPool.changed || strippedGroups.changed) changed = true
|
||||
|
||||
if (changed) {
|
||||
await query('UPDATE tierlists SET thumbnail_src = ?, groups_json = ?, pool_json = ?, updated_at = ? WHERE id = ?', [
|
||||
if (changed) {
|
||||
await query('UPDATE tierlists SET thumbnail_src = ?, groups_json = ?, pool_json = ?, updated_at = ? WHERE id = ?', [
|
||||
nextThumbnail,
|
||||
serializeJson(strippedGroups.groups),
|
||||
serializeJson(strippedPool.items),
|
||||
now(),
|
||||
row.id,
|
||||
])
|
||||
stats.updatedTierLists += 1
|
||||
}
|
||||
}
|
||||
|
||||
for (const row of templateRequestRows) {
|
||||
const groups = parseJson(row.groups_json, [])
|
||||
const items = parseJson(row.items_json, [])
|
||||
const boardItems = parseJson(row.board_items_json, [])
|
||||
let changed = false
|
||||
let nextThumbnail = row.thumbnail_src_snapshot || ''
|
||||
|
||||
if (row.thumbnail_src_snapshot && !(await fileExistsForUploadSrc(row.thumbnail_src_snapshot))) {
|
||||
nextThumbnail = ''
|
||||
changed = true
|
||||
stats.clearedTemplateRequestThumbnails += 1
|
||||
}
|
||||
|
||||
const strippedItems = stripMissingItems(items, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedBoardItems = stripMissingItems(boardItems, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedGroups = stripItemIdsFromGroups(groups, missingCustomItemIds)
|
||||
if (strippedItems.changed || strippedBoardItems.changed || strippedGroups.changed) changed = true
|
||||
|
||||
if (changed) {
|
||||
await query(
|
||||
'UPDATE template_requests SET thumbnail_src_snapshot = ?, groups_json = ?, items_json = ?, board_items_json = ?, updated_at = ? WHERE id = ?',
|
||||
[
|
||||
nextThumbnail,
|
||||
serializeJson(strippedGroups.groups),
|
||||
serializeJson(strippedPool.items),
|
||||
serializeJson(strippedItems.items),
|
||||
serializeJson(strippedBoardItems.items),
|
||||
now(),
|
||||
row.id,
|
||||
])
|
||||
stats.updatedTierLists += 1
|
||||
}
|
||||
}
|
||||
|
||||
for (const row of templateRequestRows) {
|
||||
const groups = parseJson(row.groups_json, [])
|
||||
const items = parseJson(row.items_json, [])
|
||||
const boardItems = parseJson(row.board_items_json, [])
|
||||
let changed = false
|
||||
let nextThumbnail = row.thumbnail_src_snapshot || ''
|
||||
|
||||
if (row.thumbnail_src_snapshot && !(await fileExistsForUploadSrc(row.thumbnail_src_snapshot))) {
|
||||
nextThumbnail = ''
|
||||
changed = true
|
||||
}
|
||||
|
||||
const strippedItems = stripMissingItems(items, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedBoardItems = stripMissingItems(boardItems, missingCustomItemIds, missingCustomSrcs)
|
||||
const strippedGroups = stripItemIdsFromGroups(groups, missingCustomItemIds)
|
||||
if (strippedItems.changed || strippedBoardItems.changed || strippedGroups.changed) changed = true
|
||||
|
||||
if (changed) {
|
||||
await query(
|
||||
'UPDATE template_requests SET thumbnail_src_snapshot = ?, groups_json = ?, items_json = ?, board_items_json = ?, updated_at = ? WHERE id = ?',
|
||||
[
|
||||
nextThumbnail,
|
||||
serializeJson(strippedGroups.groups),
|
||||
serializeJson(strippedItems.items),
|
||||
serializeJson(strippedBoardItems.items),
|
||||
now(),
|
||||
row.id,
|
||||
]
|
||||
)
|
||||
stats.updatedTemplateRequests += 1
|
||||
}
|
||||
]
|
||||
)
|
||||
stats.updatedTemplateRequests += 1
|
||||
}
|
||||
}
|
||||
|
||||
if (missingCustomItemIds.size) {
|
||||
await deleteCustomItems(Array.from(missingCustomItemIds))
|
||||
stats.deletedCustomItems = missingCustomItemIds.size
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user