check no childs
less verbose output
This commit is contained in:
parent
2ce34b0dc8
commit
3e99587988
1 changed files with 6 additions and 5 deletions
11
index.js
11
index.js
|
@ -96,7 +96,6 @@ const plugin = {
|
|||
const now = Math.floor(Date.now())
|
||||
const cut_datetime = now - plugin.settings?.deadline_time*60*60*1000
|
||||
const date_obj = new Date(cut_datetime)
|
||||
plugin.log.debug("now %s -- deadline %s", now, cut_datetime)
|
||||
plugin.log.info("[Cleaner Plugin] Removing old events before " + date_obj)
|
||||
events = await plugin.db.models.event.findAll({
|
||||
where: {
|
||||
|
@ -109,16 +108,16 @@ const plugin = {
|
|||
limit: plugin.settings.events_number,
|
||||
})
|
||||
|
||||
plugin.log.warn("[Cleaner Plugin] Found %s past events and related resources.", events.length)
|
||||
|
||||
if (!events.length) { return }
|
||||
|
||||
plugin.log.info("[Cleaner Plugin] Found %s past events and related resources.", events.length)
|
||||
|
||||
for (e of events) {
|
||||
end_date = new Date(e.end_datetime * 1000)
|
||||
start_date = new Date(e.start_datetime * 1000)
|
||||
plugin.log.info("[Cleaner Plugin] Cleaning: " + e.title + " - Rec: " + e.recurrent + " - From: " + start_date + " - To: " + end_date + " - place: " + e.placeId)
|
||||
plugin.log.info("[Cleaner Plugin] Cleaning: " + e.title + " - From: " + start_date + " - To: " + end_date)
|
||||
plugin.log.debug("[Cleaner Plugin] %s", JSON.stringify(e, null, "\t"))
|
||||
if (e.media && e.media.length && !e.recurrent && !e.parentId) {
|
||||
if (e.media && e.media.length && !e.recurrent && !e.parentId && !e.child.length) {
|
||||
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)
|
||||
|
@ -128,6 +127,8 @@ const plugin = {
|
|||
} catch (excep) {
|
||||
plugin.log.error("[Cleaner Plugin] error removing file %s", excep.toString())
|
||||
}
|
||||
} else {
|
||||
plugin.log.debug("[Cleaner Plugin] skip cleaning media file")
|
||||
}
|
||||
try {
|
||||
// notify local events before destroying notifications
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue