comparison after5.rb @ 78:ec7d483d381d draft

Fix missing notification
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 25 Jan 2013 18:11:32 +0900
parents 53e747495502
children 1acd9c926bd6
comparison
equal deleted inserted replaced
77:ff9e5fa124d2 78:ec7d483d381d
834 user = @usermap.keys.grep(user)[0] 834 user = @usermap.keys.grep(user)[0]
835 end 835 end
836 next unless user 836 next unless user
837 ud = File.join(dd, user).untaint 837 ud = File.join(dd, user).untaint
838 next unless test(?d, ud) 838 next unless test(?d, ud)
839 ntl[user] = {} 839 ntl[user] = {} unless ntl.has_key?(user)
840 Dir.foreach(ud){|date| 840 Dir.foreach(ud){|date|
841 next if /^\./ =~ date 841 next if /^\./ =~ date
842 unless /(\d\d\d\d+)-(\d+)-(\d+)-(\d\d\d\d)/ =~ date 842 unless /(\d\d\d\d+)-(\d+)-(\d+)-(\d\d\d\d)/ =~ date
843 gomifiles << File.join(ud, date) 843 gomifiles << File.join(ud, date)
844 next 844 next
2612 end 2612 end
2613 Dir.chdir @mydir 2613 Dir.chdir @mydir
2614 line = "-"*25 2614 line = "-"*25
2615 indent = " " 2615 indent = " "
2616 now = Time.now 2616 now = Time.now
2617 p "notifylist", @sc.notify_list(now) if $DEBUG 2617 ntlist = @sc.notify_list(now)
2618 @sc.notify_list(now).each{|u, datehash| 2618 p "notifylist", ntlist if $DEBUG
2619 ntlist.each{|u, datehash|
2619 dellist = [] 2620 dellist = []
2620 content = datehash.sort.collect{|date, filehash| 2621 content = datehash.sort.collect{|date, filehash|
2621 next unless /(\d\d\d\d+)-(\d+)-(\d+)-(\d\d\d\d)/ =~ date 2622 next unless /(\d\d\d\d+)-(\d+)-(\d+)-(\d\d\d\d)/ =~ date
2622 y, m, d, t = $1.to_i, $2.to_i, $3.to_i, $4.to_i 2623 y, m, d, t = $1.to_i, $2.to_i, $3.to_i, $4.to_i
2623 ddiff=(Time.mktime(y, m, d) \ 2624 ddiff=(Time.mktime(y, m, d) \
2661 end 2662 end
2662 end 2663 end
2663 end 2664 end
2664 end 2665 end
2665 } 2666 }
2666 if !(list=@sc.notify_list(now)).empty? 2667 if !ntlist.empty?
2667 subj = @mybase+": Undeleted old cron files detected" 2668 subj = @mybase+": Undeleted old cron files detected"
2668 files = list.collect{|who, whash| 2669 files = ntlist.collect{|who, whash|
2669 whash.sort.collect{|date, fhash| fhash['file']}.join("\n") 2670 whash.sort.collect{|date, fhash| fhash['file']}.join("\n")
2670 }.join("\n") 2671 }.join("\n")
2671 sendMail(@opt['maintainer'], subj, 2672 sendMail(@opt['maintainer'], subj,
2672 "This is `#{@mybase}' in #{@mydir}\n" + 2673 "This is `#{@mybase}' in #{@mydir}\n" +
2673 "You'd better check and remove these files.\n\n"+files) 2674 "You'd better check and remove these files.\n\n"+files)

yatex.org