Method: FileUtils::FileUtils.unify_time
- Defined in:
- lib/file_utils/file_utils.rb
.unify_time(content_data) ⇒ Object
then the assumption is that this file wasnt indexized and it will not be treated
(e.i. we do nothing with it)
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/file_utils/file_utils.rb', line 203 def self.unify_time(content_data) orig_content_data = ContentData::ContentData.new(content_data) content_data.unify_time content_data.each_instance { |checksum, size, content_mod_time, unified_inst_mod_time, server, path| location = [server, path] orig_inst_mod_time = orig_content_data.get_instance_mod_time(checksum, location) file_mtime, file_size = File.open(path) { |f| [f.mtime, f.size] } Log.debug1 "file:#{path} file_mtime:#{file_mtime}." Log.debug1 "update mtime:#{unified_inst_mod_time}" Log.debug1 "original instance mtime:#{orig_inst_mod_time}." Log.debug1 "unify instance mtime:#{unified_inst_mod_time}." Log.debug1 "Comparison: Real file = unified? #{file_mtime.to_i == unified_inst_mod_time}" if (file_mtime.to_i == orig_inst_mod_time) \ and file_size == size \ and (file_mtime.to_i != unified_inst_mod_time) Log.debug1 ("Comparison results: File actual time is same as instance time before unification. Need to modify file time") File.utime(File.atime(path), unified_inst_mod_time, path) file_mtime = File.open(path) { |f| f.mtime } Log.debug1 "new file mtime:#{file_mtime}." Log.debug1 "new file mtime in seconds:#{file_mtime.to_i}." end } content_data end |