2019-05-02 18:17:27 -04:00
# frozen_string_literal: true
2019-06-12 22:58:27 -04:00
return if GlobalSetting . skip_db?
2014-03-24 03:03:39 -04:00
# Some sanity checking so we don't count on an unindexed column on boot
2019-01-17 04:28:00 -05:00
begin
if ActiveRecord :: Base . connection . table_exists? ( :users ) &&
User . limit ( 20 ) . count < 20 &&
User . where ( admin : true ) . human_users . count == 0
2019-01-17 04:22:15 -05:00
2019-01-17 04:28:00 -05:00
notice =
if GlobalSetting . developer_emails . blank?
" Congratulations, you installed Discourse! Unfortunately, no administrator emails were defined during setup, so finalizing the configuration <a href='https://meta.discourse.org/t/create-admin-account-from-console/17274'>may be difficult</a>. "
2014-03-24 18:45:21 -04:00
else
2019-01-17 04:28:00 -05:00
emails = GlobalSetting . developer_emails . split ( " , " )
if emails . length > 1
emails = emails [ 0 .. - 2 ] . join ( ', ' ) << " or #{ emails [ - 1 ] } "
else
emails = emails [ 0 ]
end
" Congratulations, you installed Discourse! Register a new admin account with #{ emails } to finalize configuration. "
2014-03-24 03:03:39 -04:00
end
2019-01-17 04:28:00 -05:00
if notice != SiteSetting . global_notice
SiteSetting . global_notice = notice
SiteSetting . has_login_hint = true
end
2014-03-24 03:03:39 -04:00
end
2019-01-17 04:28:00 -05:00
rescue ActiveRecord :: NoDatabaseError
# Database might not have been created
2019-01-17 04:22:15 -05:00
end