Patch #24007

Change plugins directory through the configuration.yml file

Added by Helder Manuel Torres Vieira 9 months ago. Updated 5 days ago.

Status:ReopenedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-

Description

This patch adds the possibility to change the directory "plugins" of the application through the file configuration.yml.

The patch has been tested with the last Trunk version (15839)

config_plugins_path.diff Magnifier (3.85 KB) Helder Manuel Torres Vieira, 2016-10-05 20:17


Related issues

Related to Redmine - Patch #13927: Reduce coupling between plugins and the "plugins/" directory New
Blocked by Redmine - Patch #26139: Follow Gemfile's plugin loader as #24007 Reopened

Associated revisions

Revision 15963
Added by Jean-Philippe Lang 7 months ago

Change plugins directory through the configuration.yml file (#24007).

Patch by Helder Manuel Torres Vieira.

Revision 15964
Added by Jean-Philippe Lang 7 months ago

Code cleanup (#24007).

Revision 16654
Added by Jean-Philippe Lang 12 days ago

Plugin directory is configurable (#24007).

Patch by Go MAEDA.

Revision 16666
Added by Jean-Philippe Lang 5 days ago

Change plugins directory through the configuration.yml file (#24007, #26139).

Patch by Sho HASHIMOTO

Revision 16669
Added by Jean-Philippe Lang 5 days ago

Reverts r16666 that prevents Redmine to start.

[!] There was an error parsing `Gemfile`: uninitialized constant Bundler::Dsl::R
edmine. Bundler cannot continue.

Revision 16670
Added by Jean-Philippe Lang 5 days ago

Redmine::Plugin.directory is an absolute path (#24007).

Revision 16675
Added by Jean-Philippe Lang 5 days ago

Removes plugins_path from configuration file (#24007).

History

#1 Updated by Jean-Philippe Lang 9 months ago

  • Status changed from New to Needs feedback

In the comments, you say that Redmine needs to have write permission on the plugins directory. Why is that? I think it should have read permission only.

#2 Updated by Andrey Lobanov (RedSoft) 9 months ago

I agree. Why plugins directory should have write permissions?

#3 Updated by Jean-Philippe Lang 9 months ago

  • Category set to Plugin API
  • Status changed from Needs feedback to New
  • Assignee set to Jean-Philippe Lang
  • Target version set to 3.4.0

#4 Updated by Helder Manuel Torres Vieira 9 months ago

Hello,

Sorry, it was a mistake, i was talking about read permissions (not write).

Thanks

#5 Updated by Jean-Philippe Lang 7 months ago

  • Status changed from New to Closed

Patch committed, thanks.

#6 Updated by Go MAEDA 2 months ago

  • Status changed from Closed to Reopened

config/routes.rb must be aware of plugins_path setting.

Index: config/routes.rb
===================================================================
--- config/routes.rb    (revision 16528)
+++ config/routes.rb    (working copy)
@@ -374,7 +374,7 @@

   get 'robots.txt', :to => 'welcome#robots'

-  Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
+  Dir.glob File.expand_path("#{Redmine::Plugin.directory}/*", Rails.root) do |plugin_dir|
     file = File.join(plugin_dir, "config/routes.rb")
     if File.exists?(file)
       begin

#7 Updated by David Côté-Tremblay 2 months ago

I wish that functionality, would be very great for multitenancy environments.

#8 Updated by Jean-Philippe Lang 12 days ago

  • Status changed from Reopened to Closed

Fix committed, thanks.

#9 Updated by Go MAEDA 10 days ago

  • Blocked by Patch #26139: Follow Gemfile's plugin loader as #24007 added

#10 Updated by Go MAEDA 10 days ago

  • Status changed from Closed to Reopened

Reopening this issue because a fix for this feature has been submitted as #26139.

#11 Updated by Sho HASHIMOTO 9 days ago

Is r16654 correct?
config_plugins_path.diff defines Redmine::Plugin.directory as "Absolute path to the directory where plugins are stored.".
File.expand_path("#{Redmine::Plugin.directory}/*", Rails.root) maybe returns "#{Rails.root}/#{Redmine::Plugin.directory}/*"

#12 Updated by Jean-Philippe Lang 5 days ago

Sho HASHIMOTO wrote:

Is r16654 correct?
config_plugins_path.diff defines Redmine::Plugin.directory as "Absolute path to the directory where plugins are stored.".
File.expand_path("#{Redmine::Plugin.directory}/*", Rails.root) maybe returns "#{Rails.root}/#{Redmine::Plugin.directory}/*"

No it does not returns that because the first argument is an absolute path. But for clarity, I've removed the second arg that is not used. Thanks for pointing this out.

#13 Updated by Jean-Philippe Lang 5 days ago

  • Assignee deleted (Jean-Philippe Lang)
  • Target version deleted (3.4.0)

The current implementation does not support loading plugin gemfiles (#26139), I've removed the option in the configuration file for 3.4.0

#14 Updated by Mischa The Evil 4 days ago

  • Related to Patch #13927: Reduce coupling between plugins and the "plugins/" directory added

Also available in: Atom PDF