Fix bug for updating from older kernel.
This commit is contained in:
parent
7023990086
commit
ff34b42e10
|
@ -8,10 +8,15 @@ module Admin::GmailHelper
|
||||||
@secret = secret
|
@secret = secret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
require "google/apis/gmail_v1"
|
require "google/apis/gmail_v1"
|
||||||
require "googleauth"
|
rescue LoadError => e
|
||||||
require "googleauth/stores/file_token_store"
|
end
|
||||||
|
begin
|
||||||
|
require "googleauth"
|
||||||
|
require "googleauth/stores/file_token_store"
|
||||||
|
rescue LoadError => e
|
||||||
|
end
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
SCOPE = ['https://mail.google.com/']
|
SCOPE = ['https://mail.google.com/']
|
||||||
OOB_URI = "urn:ietf:wg:oauth:2.0:oob"
|
OOB_URI = "urn:ietf:wg:oauth:2.0:oob"
|
||||||
|
@ -116,4 +121,4 @@ module Admin::GmailHelper
|
||||||
service.send_user_message(user_id,message,quota_user: site[:title][site.default_locale||:zh_tw]){|r,err| result=r;error=err}
|
service.send_user_message(user_id,message,quota_user: site[:title][site.default_locale||:zh_tw]){|r,err| result=r;error=err}
|
||||||
[service,error]
|
[service,error]
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -168,8 +168,10 @@ class Site
|
||||||
end
|
end
|
||||||
after_save do
|
after_save do
|
||||||
File.open("config/member_extra_db.txt","w+"){|f| f.write(self.member_extra_db)}
|
File.open("config/member_extra_db.txt","w+"){|f| f.write(self.member_extra_db)}
|
||||||
OrbitHelper::SharedHash['current_site']['site'] = self if @changed && OrbitHelper::SharedHash['current_site']
|
if (defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash rescue false)
|
||||||
OrbitHelper::SharedHash['privileged_page_count'].value = self.privileged_page_count
|
OrbitHelper::SharedHash['current_site']['site'] = self if @changed && OrbitHelper::SharedHash['current_site']
|
||||||
|
OrbitHelper::SharedHash['privileged_page_count'].value = self.privileged_page_count
|
||||||
|
end
|
||||||
end
|
end
|
||||||
after_initialize do |record|
|
after_initialize do |record|
|
||||||
if !record.new_record? && !@skip_callback
|
if !record.new_record? && !@skip_callback
|
||||||
|
@ -191,10 +193,10 @@ class Site
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def need_process_ip
|
def need_process_ip
|
||||||
OrbitHelper::SharedHash['privileged_page_count'].value != 0
|
OrbitHelper::SharedHash['privileged_page_count'].value != 0 rescue false
|
||||||
end
|
end
|
||||||
def has_privileged_page
|
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
|
end
|
||||||
def check_ip_is_privileged?(ip, user=(user_nil=true; nil))
|
def check_ip_is_privileged?(ip, user=(user_nil=true; nil))
|
||||||
flag = (self.privileged_ip_range.blank?)
|
flag = (self.privileged_ip_range.blank?)
|
||||||
|
@ -309,4 +311,4 @@ class Site
|
||||||
def min_memory
|
def min_memory
|
||||||
return 50000 #50k bytes
|
return 50000 #50k bytes
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue