Patch #31151

Add AppServer to Technical Information page

Added by Vincent Robert 12 months ago.

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

0%

Category:Administration
Target version:-

Description

Hello

The Information page shows some useful data about the current environment. But one important information is missing: the app server.
So here is a patch which adds this information to the list.

Thank you

diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -77,5 +77,6 @@ class AdminController < ApplicationController
       [:text_rmagick_available,        Object.const_defined?(:Magick)],
       [:text_convert_available,        Redmine::Thumbnail.convert_available?]
     ]
+    @request = request
   end
 end

diff --git a/app/views/admin/info.html.erb b/app/views/admin/info.html.erb
--- a/app/views/admin/info.html.erb
+++ b/app/views/admin/info.html.erb
@@ -12,7 +12,7 @@
 </table>
 <br />
 <div class="box">
-&lt;pre&gt;&lt;%= Redmine::Info.environment %&gt;&lt;/pre&gt;
+&lt;pre&gt;&lt;%= Redmine::Info.environment(@request) %&gt;&lt;/pre&gt;
 &lt;/div&gt;

 &lt;% html_title(l(:label_information_plural)) -%&gt;

diff --git a/lib/redmine/info.rb b/lib/redmine/info.rb
--- a/lib/redmine/info.rb
+++ b/lib/redmine/info.rb
@@ -6,17 +6,17 @@ module Redmine
       def help_url; 'https://www.redmine.org/guide' end
       def versioned_name; "#{app_name} #{Redmine::VERSION}" end

-      def environment
+      def environment(request = nil)
         s = "Environment:\n" 
-        s &lt;&lt; [
-          ["Redmine version", Redmine::VERSION],
-          ["Ruby version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"],
-          ["Rails version", Rails::VERSION::STRING],
-          ["Environment", Rails.env],
-          ["Database adapter", ActiveRecord::Base.connection.adapter_name],
-          ["Mailer queue", ActionMailer::DeliveryJob.queue_adapter.class.name],
-          ["Mailer delivery", ActionMailer::Base.delivery_method]
-        ].map {|info| "  %-30s %s" % info}.join("\n") + "\n" 
+        environment_data = [["Redmine version", Redmine::VERSION],
+                           ["Ruby version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"],
+                           ["Rails version", Rails::VERSION::STRING],
+                           ["Environment", Rails.env],
+                           ["Database adapter", ActiveRecord::Base.connection.adapter_name],
+                           ["Mailer queue", ActionMailer::DeliveryJob.queue_adapter.class.name],
+                           ["Mailer delivery", ActionMailer::Base.delivery_method]]
+        environment_data &lt;&lt; ["App server", request.get_header("SERVER_SOFTWARE")] if request.present?
+        s &lt;&lt; environment_data.map {|info| "  %-30s %s" % info}.join("\n") + "\n" 

         s &lt;&lt; "SCM:\n" 
         Redmine::Scm::Base.all.each do |scm|

appserver.diff Magnifier (2.6 KB) Vincent Robert, 2019-04-05 14:40

Also available in: Atom PDF