diff --git a/CHANGELOG.md b/CHANGELOG.md
index 161839f8..b3828935 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog for Redmine DMSF
==========================
+1.6.1 *2018-??-??*
+------------------
+
+ WebDAV caching optionable in the plugin settings. Default is off.
+
1.6.0 *2017-09-12*
------------------
diff --git a/app/views/settings/_dmsf_settings.html.erb b/app/views/settings/_dmsf_settings.html.erb
index 6d23ba4b..daed64cb 100644
--- a/app/views/settings/_dmsf_settings.html.erb
+++ b/app/views/settings/_dmsf_settings.html.erb
@@ -212,6 +212,15 @@
+
+ <%= content_tag(:label, l(:label_caching_enabled)) %>
+ <%= check_box_tag('settings[dmsf_webdav_caching_enabled]', false, @settings['dmsf_webdav_caching_enabled']) %>
+
+ <%= l(:note_webdav_cahing_enabled) %>
+ <%= l(:label_default)%>: <%= l(:general_text_No)%>
+
+
+
<%= l(:label_full_text) %>
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index f7ea78b1..17459642 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -359,6 +359,9 @@ cs:
label_dmsf_attachments: DMS přílohy
label_basic_attachments: Souborové přílohy
+ label_caching_enabled: Povolit použití vyrovnávací paměti
+ note_webdav_cahing_enabled: Odpovědi na požadavek PROPFIND jsou ukládány do vyrovnávací paměti za účelem zrychlení WebDAV komunikace.
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/de.yml b/config/locales/de.yml
index d4d86035..1ed7f8ae 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -356,6 +356,9 @@ de:
label_dmsf_attachments: DMS Anhänge
label_basic_attachments: Dateianhängen
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 68ab7966..46342cc7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -359,6 +359,9 @@ en:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 9bd4ccbe..b74aec0c 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -359,6 +359,9 @@ es:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 3fc49ee8..482d35f1 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -359,6 +359,9 @@ fr:
label_dmsf_attachments: Pièces-jointes DMS
label_basic_attachments: Pièces-jointes standards
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 04a7240b..50a55167 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -359,6 +359,9 @@ hu:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/it.yml b/config/locales/it.yml
index bcb8253c..abde2452 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -359,6 +359,9 @@ it: # Italian strings thx 2 Matteo Arceci!
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index e753e127..47221db4 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -359,6 +359,9 @@ ja:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index c55d57e1..8be78c17 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -359,6 +359,9 @@ pl:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index e6ac9b9a..6d94dff9 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -359,6 +359,9 @@ pt-BR:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 716df52a..a55cef85 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -359,6 +359,9 @@ ru:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 3497928d..d9db95d1 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -359,6 +359,9 @@ sl:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 7478f8e3..dc25ce44 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -359,6 +359,9 @@ zh-TW:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 306a3b46..4adfbed1 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -359,6 +359,9 @@ zh:
label_dmsf_attachments: DMS Attachments
label_basic_attachments: Basic Attachments
+ label_caching_enabled: Caching enabled
+ note_webdav_cahing_enabled: PROPFIND responses are cached in order to speed up WebDAV communication
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/init.rb b/init.rb
index f311d0f2..a5ce07d3 100644
--- a/init.rb
+++ b/init.rb
@@ -54,7 +54,8 @@ Redmine::Plugin.register :redmine_dmsf do
'dmsf_webdav_disable_versioning' => '^\~\$|\.tmp$',
'dmsf_keep_documents_locked' => false,
'dmsf_act_as_attachable' => false,
- 'dmsf_show_system_folders' => false
+ 'dmsf_show_system_folders' => false,
+ 'dmsf_webdav_caching_enabled' => false
}
# Uncomment to remove the original Documents from searching (replaced with DMSF)
diff --git a/lib/redmine_dmsf/webdav/cache.rb b/lib/redmine_dmsf/webdav/cache.rb
index 262fba96..84301ef6 100644
--- a/lib/redmine_dmsf/webdav/cache.rb
+++ b/lib/redmine_dmsf/webdav/cache.rb
@@ -21,35 +21,39 @@
module RedmineDmsf
module Webdav
+
class Cache
+
def self.read(name, options = nil)
- Rails.cache.read(name, options)
+ Rails.cache.read(name, options) if Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1'
end
def self.write(name, value, options = nil)
- Rails.cache.write(name, value, options)
+ Rails.cache.write(name, value, options) if Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1'
end
def self.delete(name, options = nil)
- Rails.cache.delete(name, options)
+ Rails.cache.delete(name, options) if Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1'
end
def self.exist?(name, options = nil)
- Rails.cache.exist?(name, options)
+ (Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1') && Rails.cache.exist?(name, options)
end
def self.clear
- Rails.cache.clear
+ Rails.cache.clear if Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1'
end
def self.invalidate_item(key)
- return if key.blank?
- # Write an .invalid entry to notify anyone that is currently creating a response
- self.write("#{key}.invalid", expires_in: 60.seconds)
- # Delete any existing entry in the cache
- self.delete(key)
+ if (Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] == '1') && (!key.blank?)
+ # Write an .invalid entry to notify anyone that is currently creating a response
+ self.write("#{key}.invalid", expires_in: 60.seconds)
+ # Delete any existing entry in the cache
+ self.delete(key)
+ end
end
end
+
end
end
\ No newline at end of file
diff --git a/test/integration/webdav/dmsf_webdav_propfind_test.rb b/test/integration/webdav/dmsf_webdav_propfind_test.rb
index aea5cdd1..d2fd0e3d 100644
--- a/test/integration/webdav/dmsf_webdav_propfind_test.rb
+++ b/test/integration/webdav/dmsf_webdav_propfind_test.rb
@@ -46,6 +46,7 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest
@project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
@project1_uri = Addressable::URI.escape(@project1_name)
Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = false
+ Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] = '1'
RedmineDmsf::Webdav::Cache.clear
end
@@ -319,5 +320,14 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest
assert !RedmineDmsf::Webdav::Cache.exist?("PROPFIND/#{@project1.id}.invalid")
assert RedmineDmsf::Webdav::Cache.exist?("PROPSTATS/#{@project1.identifier}/#{@folder1.title}")
end
+
+ def test_webdav_caching_disabled
+ Setting.plugin_redmine_dmsf['dmsf_webdav_caching_enabled'] = '0'
+ log_user 'admin', 'admin' # login as admin
+ xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_DEPTH => '1'})
+ assert_response 207 # MultiStatus
+ # Verify that everything exists in the cache as it should
+ assert !RedmineDmsf::Webdav::Cache.exist?("PROPFIND/#{@project1.id}")
+ end
end
\ No newline at end of file