diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index fc0dbea4..b433a98b 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -362,7 +362,7 @@ class DmsfFile < ApplicationRecord results = scope.where(find_options).uniq.to_a results.delete_if { |x| !DmsfFolder.permissions?(x.dmsf_folder) } - if !options[:titles_only] && RedmineDmsf::Plugin.xapian_available? + if !options[:titles_only] && RedmineDmsf::Plugin.lib_available?('xapian') database = nil begin lang = RedmineDmsf.dmsf_stemming_lang diff --git a/app/views/settings/_dmsf_settings.html.erb b/app/views/settings/_dmsf_settings.html.erb index 3f1a9343..5c93b670 100644 --- a/app/views/settings/_dmsf_settings.html.erb +++ b/app/views/settings/_dmsf_settings.html.erb @@ -355,15 +355,7 @@
<% else %> - <% begin %> - <% require 'xapian' %> - <% xapian_disabled = false %> - <% rescue LoadError => e %> -<%= l(:warning_xapian_not_available) %>
- <% Rails.logger.warn e.message %> - <% xapian_disabled = true %> - <% end %> - <% if RedmineDmsf::Plugin.xapian_available? %> + <% if RedmineDmsf::Plugin.lib_available?('xapian') %>
<%= content_tag :label, l(:label_index_database) %>
<%= text_field_tag 'settings[dmsf_index_database]', RedmineDmsf.dmsf_index_database, size: 50 %>
diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb
index 4539dd40..3e4d49b5 100644
--- a/lib/redmine_dmsf.rb
+++ b/lib/redmine_dmsf.rb
@@ -253,6 +253,7 @@ unless defined?(EasyPatchManager)
require "#{File.dirname(__FILE__)}/../patches/access_control_patch"
require "#{File.dirname(__FILE__)}/../patches/search_patch"
require "#{File.dirname(__FILE__)}/../patches/custom_field_patch"
+ require "#{File.dirname(__FILE__)}/../patches/puma_patch"
# A workaround for obsolete 'alias_method' usage in RedmineUp's plugins
if RedmineDmsf::Plugin.an_obsolete_plugin_present?
require "#{File.dirname(__FILE__)}/../patches/notifiable_ru_patch"
diff --git a/lib/redmine_dmsf/plugin.rb b/lib/redmine_dmsf/plugin.rb
index 15775386..e4dcbbdc 100644
--- a/lib/redmine_dmsf/plugin.rb
+++ b/lib/redmine_dmsf/plugin.rb
@@ -39,12 +39,12 @@ module RedmineDmsf
false
end
- # Return true if Xapian binding is installed (gem ruby_xapian)
- def self.xapian_available?
- require 'xapian'
+ # Return true if the given gem is installed
+ def self.lib_available?(path)
+ require path
true
rescue LoadError => e
- Rails.logger.warn e.message
+ Rails.logger.info e.message
false
end
end
diff --git a/patches/puma_patch.rb b/patches/puma_patch.rb
new file mode 100644
index 00000000..37eaeecb
--- /dev/null
+++ b/patches/puma_patch.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+# Redmine plugin for Document Management System "Features"
+#
+# Karel Pičman