Created
March 3, 2010 01:14
-
-
Save edavis10/320189 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MaintenanceMode | |
def self.included(base) | |
base.class_eval do | |
unloadable | |
prepend_before_filter(:show_maintenance_mode_page) | |
def show_maintenance_mode_page | |
unless User.current.admin? | |
render :text => "This site is currently under maintenance. Please check back later" | |
return false | |
end | |
end | |
end | |
end | |
end | |
# Patches to the Redmine core. | |
require 'dispatcher' | |
Dispatcher.to_prepare do | |
require_dependency 'application_controller' | |
ApplicationController.send(:include, MaintenanceMode) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment