Commit 9f7a42ee authored by André Kerkhoff's avatar André Kerkhoff
Browse files

Apply modification dates of topics to files

parent 841fb300
......@@ -62,7 +62,7 @@ end
## Topics
The default can create topics and thereby remove their existing history.
The default recipe can create topics and thereby remove their existing history.
### System.SitePreferences
......@@ -80,7 +80,7 @@ For custom installations you decare Chef templates using `WebPreferences.txt.erb
You can declare raw topics under `['foswiki']['topics'][topic] = 'content'`. Topic names can use slashes or dots as seperators between webs and topics.
For custom installations just use Chef's file resource.
For custom installations just use Chef's file resource. Be sure to change the modification date of the file if the correct history matters to you.
## Plugins
......
......@@ -3,7 +3,7 @@ maintainer 'HPC'
maintainer_email 'hpc@gsi.de'
license 'All rights reserved'
description 'Installs/Configures Foswiki'
version '2.2.1'
version '2.2.2'
depends 'apache2', '< 6.0'
supports 'debian'
supports 'ubuntu'
......@@ -113,12 +113,20 @@ end
# Manage other topics
(node['foswiki']['topics'] || {}).each do |topic, tcontent|
base = "#{foswiki_dir('data')}/#{topic.gsub(/\./, '/')}"
base = "#{foswiki_dir('data')}/#{topic.tr('.', '/')}"
file "#{base}.txt" do
content tcontent
user node['apache']['user']
group node['apache']['group']
end
begin
time = tcontent.split("\n")[0].split.grep(/^date=/)[0].split('"')[1]
execute "Set mod time for #{base}.txt" do
command "touch -m -d '@#{time}' '#{base}.txt'"
end
rescue NoMethodError
Chef::Log.warn("Foswiki topic #{topic} has no modification date")
end
directory "#{base},pfv" do
recursive true
action :delete
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment