You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

admin_controller.rb 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006- Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. class AdminController < ApplicationController
  19. layout 'admin'
  20. self.main_menu = false
  21. menu_item :projects, :only => :projects
  22. menu_item :plugins, :only => :plugins
  23. menu_item :info, :only => :info
  24. before_action :require_admin
  25. helper :queries
  26. include QueriesHelper
  27. helper :projects_queries
  28. helper :projects
  29. def index
  30. @no_configuration_data = Redmine::DefaultData::Loader::no_data?
  31. end
  32. def projects
  33. retrieve_query(ProjectQuery, false, :defaults => @default_columns_names)
  34. @query.admin_projects = 1
  35. @entry_count = @query.result_count
  36. @entry_pages = Paginator.new @entry_count, per_page_option, params['page']
  37. @projects = @query.results_scope(:limit => @entry_pages.per_page, :offset => @entry_pages.offset).to_a
  38. render :action => "projects", :layout => false if request.xhr?
  39. end
  40. def plugins
  41. @plugins = Redmine::Plugin.all
  42. end
  43. # Loads the default configuration
  44. # (roles, trackers, statuses, workflow, enumerations)
  45. def default_configuration
  46. if request.post?
  47. begin
  48. Redmine::DefaultData::Loader::load(params[:lang])
  49. flash[:notice] = l(:notice_default_data_loaded)
  50. rescue => e
  51. flash[:error] = l(:error_can_t_load_default_data, ERB::Util.h(e.message))
  52. end
  53. end
  54. redirect_to admin_path
  55. end
  56. def test_email
  57. begin
  58. Mailer.deliver_test_email(User.current)
  59. flash[:notice] = l(:notice_email_sent, ERB::Util.h(User.current.mail))
  60. rescue => e
  61. flash[:error] = l(:notice_email_error, ERB::Util.h(Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup)))
  62. end
  63. redirect_to settings_path(:tab => 'notifications')
  64. end
  65. def info
  66. @checklist = [
  67. [:text_default_administrator_account_changed, User.default_admin_account_changed?],
  68. [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
  69. [:text_all_migrations_have_been_run, !ActiveRecord::Base.connection.migration_context.needs_migration?],
  70. [:text_minimagick_available, Object.const_defined?(:MiniMagick)],
  71. [:text_convert_available, Redmine::Thumbnail.convert_available?],
  72. [:text_gs_available, Redmine::Thumbnail.gs_available?]
  73. ]
  74. @checklist << [:text_default_active_job_queue_changed, Rails.application.config.active_job.queue_adapter != :async] if Rails.env.production?
  75. end
  76. end