Excerpts from why the lucky stiff's mail of 23 Jul 2005 (EDT):
> >I still think my solution is more elegant. :p I can't imagine when an
> >attachment would change except via the comment system, but who knows.
>
> What was your solution William? Let's look at it again.
Rather than touching the entry file when a comment is posted, rewriting
FileSys.last_modified to consider attachment last-modified times. To wit:
--- lib/hobix/storage/filesys.rb 11 Jun 2005 21:56:14 -0000 1.23
+++ lib/hobix/storage/filesys.rb 14 Jun 2005 22:09:26 -0000
@@ -242,7 +242,7 @@
end
def last_modified( entries )
entries.collect do |entry|
- @modified[entry.id]
+ modified( entry.id )
end.max
end
def last_created( entries )
@@ -251,7 +251,10 @@
end.max
end
def modified( entry_id )
- @modified[entry_id]
+ find_attached( entry_id ).inject( @modified[entry_id] ) do |max, ext|
+ mtime = File.mtime( entry_path( entry_id, ext ) )
+ mtime > max ? mtime : max
+ end
end
Slower, but perhaps not significantly so?
> >Plus File.utime seems to fail due to purported permission errors in cases
> >where command-line "touch" works fine. WTF.
> >
> Blooming!
Am I insane?
agave:/var/www/hobix/entries/Compute# su www-data
agave:~/hobix/entries/Compute$ ls -ls more_on_static_vs_dynamic.yaml
4 -rw-rw-r-- 1 wmorgan www-data 364 Jul 21 19:05
more_on_static_vs_dynamic.yaml
agave:~/hobix/entries/Compute$ touch more_on_static_vs_dynamic.yaml
agave:~/hobix/entries/Compute$ irb -r fileutils
irb(main):001:0> FileUtils.touch "more_on_static_vs_dynamic.yaml"
Errno::EPERM: Operation not permitted - more_on_static_vs_dynamic.yaml
from /usr/lib/ruby/1.8/fileutils.rb:837:in `utime'
from /usr/lib/ruby/1.8/fileutils.rb:837:in `touch'
from /usr/lib/ruby/1.8/fileutils.rb:835:in `each'
from /usr/lib/ruby/1.8/fileutils.rb:835:in `touch'
from (irb):1
--
William <[EMAIL PROTECTED]>
_______________________________________________
Hobix-is-the-way mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/hobix-is-the-way