This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
forked from edavis10/redmine_maintenance_mode
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathinit.rb
55 lines (46 loc) · 1.92 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require_dependency 'maintenance_mode_hooks'
require_dependency 'maintenance_mode'
Rails.logger.info 'Starting Maintenance Mode plugin for Redmine'
Redmine::Plugin.register :redmine_maintenance_mode do
name 'Redmine Maintenance Mode'
author 'Tobias Fischer'
description 'This is a plugin to schedule and announce maintenance downtimes as well as disable user access to redmine during maintenance times.'
version '2.2.1'
url 'https://github.com/tofi86/redmine_maintenance_mode'
author_url 'https://github.com/tofi86'
requires_redmine :version_or_higher => '3.0.0'
requires_redmine_plugin :redmine_base_deface, :version_or_higher => '0.0.1'
menu :admin_menu, :redmine_maintenance_mode,
{ :controller => 'settings', :action => 'plugin', :id => :redmine_maintenance_mode },
:caption => :maintenance_mode,
:after => :auth_sources,
html: { class: 'icon icon-maintenance_mode' }
settings :default => {
'maintenance_active' => false,
'maintenance_message' => '',
'maintenance_schedule' => false,
'schedule_message' => '',
'schedule_start' => '2019-02-09 11:00',
'schedule_end' => '2019-02-09 13:00'
}, :partial => 'redmine_maintenance_mode_settings'
end
# Patches to the Redmine core.
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
# Patches to the Redmine core.
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
if Rails::VERSION::MAJOR >= 5
ActiveSupport::Reloader.to_prepare do
require_dependency 'application_controller'
ApplicationController.send(:include, MaintenanceMode)
end
elsif Rails::VERSION::MAJOR >= 3
ActionDispatch::Callbacks.to_prepare do
require_dependency 'application_controller'
ApplicationController.send(:include, MaintenanceMode)
end
else
Dispatcher.to_prepare do
require_dependency 'application_controller'
ApplicationController.send(:include, MaintenanceMode)
end
end