Fix bug for updating from older kernel.

This commit is contained in:
BoHung Chiu 2022-08-04 10:20:51 +08:00
parent 7023990086
commit ff34b42e10
2 changed files with 17 additions and 10 deletions

View File

@ -8,10 +8,15 @@ module Admin::GmailHelper
@secret = secret
end
end
begin
require "google/apis/gmail_v1"
rescue LoadError => e
end
begin
require "googleauth"
require "googleauth/stores/file_token_store"
rescue LoadError => e
end
require "fileutils"
SCOPE = ['https://mail.google.com/']
OOB_URI = "urn:ietf:wg:oauth:2.0:oob"

View File

@ -168,9 +168,11 @@ class Site
end
after_save do
File.open("config/member_extra_db.txt","w+"){|f| f.write(self.member_extra_db)}
if (defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash rescue false)
OrbitHelper::SharedHash['current_site']['site'] = self if @changed && OrbitHelper::SharedHash['current_site']
OrbitHelper::SharedHash['privileged_page_count'].value = self.privileged_page_count
end
end
after_initialize do |record|
if !record.new_record? && !@skip_callback
save_flag = false
@ -191,10 +193,10 @@ class Site
end
end
def need_process_ip
OrbitHelper::SharedHash['privileged_page_count'].value != 0
OrbitHelper::SharedHash['privileged_page_count'].value != 0 rescue false
end
def has_privileged_page
OrbitHelper::SharedHash['privileged_page_count'].value != 0 && self.privileged_ip_range.present?
(OrbitHelper::SharedHash['privileged_page_count'].value != 0 && self.privileged_ip_range.present? rescue false)
end
def check_ip_is_privileged?(ip, user=(user_nil=true; nil))
flag = (self.privileged_ip_range.blank?)