diff --git a/trunk/ripnews/news/article.rb b/trunk/ripnews/news/article.rb index 6470402..cbfe52a 100644 --- a/trunk/ripnews/news/article.rb +++ b/trunk/ripnews/news/article.rb @@ -907,7 +907,13 @@ def cache_save(cachedir, server) file = File.new( "#{filename}.#{server}", "a+" ) or puts "couldn't open cachefile for writing" # print "Updating cache...\n" @cache_buf[server].sort! - file.print @cache_buf[server] + @cache_buf[server].each{|line| + begin + file.puts line + rescue Encoding::UndefinedConversionError + next + end + } file.close @cache_buf[server] = [] # print "Cache updated for #{server}\n" diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index 03e766f..1f81e12 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -446,6 +446,20 @@ def unlock File.unlink(@config[group]["LOCKFILE"]) end +def cleantmp + puts "Removing old tmp files" + @config.each_key{ |group | + Dir.glob("#{@config[group]["TEMPDIR"]}/riptmp*"){ |file| + begin + File.delete(file) + rescue + puts "Couldn't remove #{file}" + next + end + } + } +end + def renice group = @config.keys[0] if @config[group].has_key?("NICE") @@ -724,6 +738,8 @@ def startup end } + cleantmp + @maxfilelength = get_max_file_length(@config[@config.keys[0]]["TEMPDIR"]) # puts "\n$Id$"