2016-05-25 07:19:45 +00:00
|
|
|
class Sessions::Event::Maintenance < Sessions::Event::Base
|
|
|
|
|
|
|
|
def initialize(params)
|
|
|
|
super(params)
|
|
|
|
return if !@is_web_socket
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-05-25 07:19:45 +00:00
|
|
|
ActiveRecord::Base.establish_connection
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
return if !@is_web_socket
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-05-25 07:19:45 +00:00
|
|
|
ActiveRecord::Base.remove_connection
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
|
|
|
|
# check if sender is admin
|
2016-08-12 16:39:09 +00:00
|
|
|
return if !permission_check('admin.maintenance', 'maintenance')
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-05-25 07:19:45 +00:00
|
|
|
Sessions.broadcast(@payload, 'public', @session['id'])
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|