do not delete images, same image can be used by another event.

order results by start_date, end_date can be null
This commit is contained in:
snt 2025-07-10 15:20:33 +00:00
parent 3e99587988
commit 16ea47432a

View file

@ -74,7 +74,7 @@ const plugin = {
plugin.log.warn('[Cleaner Plugin] _tick already in progress, skipping')
return
}
plugin.log.debug('[Cleaner Plugin] _tick started, locking it')
// plugin.log.debug('[Cleaner Plugin] _tick started, locking it')
plugin._isTickRunning = true
try {
@ -103,7 +103,7 @@ const plugin = {
start_datetime: { [Op.lt]: cut_datetime/1000 },
[Op.or]: [ {end_datetime: { [Op.lt]: cut_datetime/1000 } }, { end_datetime: null } ]
},
order: [['end_datetime', 'ASC']],
order: [['start_datetime', 'ASC']],
include: [{ model: Event, as:'child' }],
limit: plugin.settings.events_number,
})
@ -121,8 +121,8 @@ const plugin = {
try {
const old_path = path.join(config.upload_path, e.media[0].url)
const old_thumb_path = path.join(config.upload_path, 'thumb', e.media[0].url)
await fs.unlink(old_thumb_path)
await fs.unlink(old_path)
//await fs.unlink(old_thumb_path)
//await fs.unlink(old_path)
plugin.log.debug("[Cleaner Plugin] removing file: " + old_path)
} catch (excep) {
plugin.log.error("[Cleaner Plugin] error removing file %s", excep.toString())
@ -152,7 +152,7 @@ const plugin = {
} catch (e) {
plugin.log.error(`[Cleaner Plugin] Uncaught error in _tick: ${String(e)}`)
} finally {
plugin.log.debug('[Cleaner Plugin] _tick finished, unlocking it')
// plugin.log.debug('[Cleaner Plugin] _tick finished, unlocking it')
plugin._isTickRunning = false
}
}