WebDAV caching is optionable. Default is off.
This commit is contained in:
parent
5234eb2e1a
commit
1e30425f1e
@ -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*
|
||||
------------------
|
||||
|
||||
|
||||
@ -212,6 +212,15 @@
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_caching_enabled)) %>
|
||||
<%= check_box_tag('settings[dmsf_webdav_caching_enabled]', false, @settings['dmsf_webdav_caching_enabled']) %>
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_cahing_enabled) %> <br/>
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No)%>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<em class="info">
|
||||
<%= l(:label_full_text) %>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
3
init.rb
3
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)
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user