Hello,

We found an issue in the way plugin assets were handled after the upgrade to redmine 6.

In the process of fixing this we also enabled loading of plugins per-instance with a fallback to the old way of loading plugins directly from /usr/share/redmine/plugins.

All the best,
Valentin

On 20/03/2025 16.45, Valentin wrote:
We are currently working on updating use_system_jquery_libs.patch to work with the new way assets are handled, but package setup, configuration and everything that doesn't use jquery works just fine with this patch.

Attached is our patch to link the system javascript libraries to the correct directory for redmine 6. Additionally i removed the redmine provided minified jquery from the source by updating patches/ use_system_jquery_libs.patch.

Thanks for your work,
Valentin

From 5f5235e25d7aec00e03418e3055a441ee64588c3 Mon Sep 17 00:00:00 2001
From: Valentin <valen...@vrvis.at>
Date: Thu, 20 Mar 2025 18:12:03 +0100
Subject: [PATCH] redmine-plugins: load plugins from instance dir

modified the multi-tenancy patch to load plugins
from the instance dir. If <instance-dir>/plugins doesn't exist
fall back to the old way of loading plugins.

fix asset paths for plugin assets in redmine 6
---
 .../0004-Add-multi-tenancy-support.patch      | 35 ++++++++++++-------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/debian/patches/0004-Add-multi-tenancy-support.patch b/debian/patches/0004-Add-multi-tenancy-support.patch
index dc3098fb..c01ad748 100644
--- a/debian/patches/0004-Add-multi-tenancy-support.patch
+++ b/debian/patches/0004-Add-multi-tenancy-support.patch
@@ -25,7 +25,7 @@ Last-Update: 2025-03-10
  /log/*.log*
 --- a/Gemfile
 +++ b/Gemfile
-@@ -52,8 +52,10 @@ end
+@@ -52,8 +52,10 @@
  
  # Include database gems for the adapters found in the database
  # configuration file
@@ -38,7 +38,7 @@ Last-Update: 2025-03-10
    database_config = File.read(database_file)
  
    # Requiring libraries in a Gemfile may cause Bundler warnings or
-@@ -68,6 +70,8 @@ if File.exist?(database_file)
+@@ -68,6 +70,8 @@
    adapters = database_config.scan(/^ *adapter: *(.*)/).flatten.uniq
    if adapters.any?
      adapters.each do |adapter|
@@ -47,7 +47,7 @@ Last-Update: 2025-03-10
        case adapter.strip
        when /mysql2/
          gem 'mysql2', '~> 0.5.0'
-@@ -86,8 +90,6 @@ if File.exist?(database_file)
+@@ -86,8 +90,6 @@
    else
      warn("No adapter found in config/database.yml, please configure it first")
    end
@@ -58,7 +58,7 @@ Last-Update: 2025-03-10
  group :development, :test do
 --- a/app/models/attachment.rb
 +++ b/app/models/attachment.rb
-@@ -78,10 +78,10 @@ class Attachment < ApplicationRecord
+@@ -78,10 +78,10 @@
    )
  
    cattr_accessor :storage_path
@@ -413,7 +413,7 @@ Last-Update: 2025-03-10
 +end
 --- a/lib/redmine/configuration.rb
 +++ b/lib/redmine/configuration.rb
-@@ -38,7 +38,7 @@ module Redmine
+@@ -38,7 +38,7 @@
        # * <tt>:file</tt>: the configuration file to load (default: config/configuration.yml)
        # * <tt>:env</tt>: the environment to load the configuration for (default: Rails.env)
        def load(options={})
@@ -422,7 +422,7 @@ Last-Update: 2025-03-10
          env = options[:env] || Rails.env
  
          @config = @defaults.dup
-@@ -116,7 +116,7 @@ module Redmine
+@@ -116,7 +116,7 @@
        end
  
        def load_deprecated_email_configuration(env)
@@ -483,7 +483,7 @@ Last-Update: 2025-03-10
 +end
 --- a/lib/redmine/scm/adapters/abstract_adapter.rb
 +++ b/lib/redmine/scm/adapters/abstract_adapter.rb
-@@ -216,7 +216,7 @@ module Redmine
+@@ -216,7 +216,7 @@
            if @stderr_log_file.nil?
              writable = false
              path = Redmine::Configuration['scm_stderr_log_file'].presence
@@ -494,7 +494,7 @@ Last-Update: 2025-03-10
                  writable = true
 --- a/lib/tasks/initializers.rake
 +++ b/lib/tasks/initializers.rake
-@@ -34,7 +34,7 @@ file 'config/initializers/secret_token.r
+@@ -34,7 +34,7 @@
  # change this key, all old sessions will become invalid! Make sure the
  # secret is at least 30 characters and all random, no regular words or
  # you'll be exposed to dictionary attacks.
@@ -505,7 +505,7 @@ Last-Update: 2025-03-10
  end
 --- a/app/models/import.rb
 +++ b/app/models/import.rb
-@@ -112,7 +112,7 @@ class Import < ApplicationRecord
+@@ -112,7 +112,7 @@
    # It is stored in tmp/imports with a random hex as filename
    def filepath
      if filename.present? && /\A[0-9a-f]+\z/.match?(filename)
@@ -516,18 +516,29 @@ Last-Update: 2025-03-10
      end
 --- a/lib/redmine/plugin_loader.rb
 +++ b/lib/redmine/plugin_loader.rb
-@@ -51,7 +51,7 @@ module Redmine
+@@ -47,11 +47,17 @@
+   class PluginLoader
+     # Absolute path to the directory where plugins are located
+     cattr_accessor :directory
+-    self.directory = Rails.root.join Rails.application.config.redmine_plugins_directory
++    if File.exist? Redmine.root.join Rails.application.config.redmine_plugins_directory
++        self.directory = Redmine.root.join Rails.application.config.redmine_plugins_directory
++    else
++        self.directory = Rails.root.join Rails.application.config.redmine_plugins_directory
++    end
  
      # Absolute path to the public directory where plugins assets are copied
++    # Note: this path gets partially overwritten in plugin.rb,
++    #       we set it to its final destination for clarity
      cattr_accessor :public_directory
 -    self.public_directory = Rails.public_path.join('plugin_assets')
-+    self.public_directory = Redmine.root.join('public/assets')
++    self.public_directory = Redmine.root.join('public', 'assets', 'plugin_assets')
  
      def self.load
        setup
 --- a/config/application.rb
 +++ b/config/application.rb
-@@ -106,6 +106,7 @@ module RedmineApp
+@@ -106,6 +106,7 @@
        :same_site => :lax
      )
  
-- 
2.39.5

Reply via email to