Watch List Emailnotificationsinterval Snippet
Watch List Emailnotificationsinterval Snippet
After some XWiki engine upgrade we notify that Email notifications interval format for Watch List change from numbers to stringsI don't known when it change and why migration don't update existing field.
To solve it, I write this snippet code to update existing configuration.
Hop that can help.
{{groovy}}
for(du in xwiki.search("select doc from XWikiDocument doc, BaseObject obj where obj.name = doc.fullName and obj.className = 'XWiki.WatchListClass' and doc.fullName <> 'XWiki.Admin' order by doc.fullName")) {
u = xwiki.getDocument(du.fullName)
wl = u.getObject('XWiki.WatchListClass')
print u
print " "
if ("1".equals(wl.interval)) {
wl.interval = "Scheduler.WatchListHourlyNotifier"
u.save("Correct WatchList Email notification interval")
}
if ("2".equals(wl.interval)) {
wl.interval = "Scheduler.WatchListDailyNotifier"
u.save("Correct WatchList Email notification interval")
}
if ("3".equals(wl.interval)) {
wl.interval = "Scheduler.WatchListWeeklyNotifier"
u.save("Correct WatchList Email notification interval")
}
print wl.interval
print "\n"
}
{{/goovy}}