Sha256: 5c80738f89b9feae8b0c797abf335741817cbd33014cee6b134e805daeac35ac
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
class Skyline::MediaCache < ActiveRecord::Base set_table_name :skyline_media_cache cattr_accessor :cache_path @@cache_path ||= Skyline::Configuration.media_file_cache_path after_destroy :expire_cache class << self def delete_file(path) if File.file?(path) File.delete(path) dir = File.basename(path) if File.directory?(dir) && Dir.entries(dir).size == 2 Dir.delete(dir) rescue nil end else logger.error "Could not sweep #{path}" end end end private def expire_cache # It'd be better to call expire_page here, except it's a # controller method and we can't get to it. path = self.class.cache_path + "#{self.url}" logger.info "Sweeping #{path}" delete_file(path) end def delete_file(path) self.class.delete_file(path) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skylinecms-3.0.7 | app/models/skyline/media_cache.rb |