mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
DEV: Enable migrated_site flag during bulk imports (#32256)
Extend the `import_site_settings` import step to enable the `migrated_site` flag if possible. It also includes an escape hatch via the `SKIP_MIGRATED_SITE_FLAG_UPDATE` flag for cases where you really don't want to toggle it on.
This commit is contained in:
@ -196,6 +196,19 @@ class BulkImport::Generic < BulkImport::Base
|
||||
end
|
||||
|
||||
rows.close
|
||||
|
||||
return if ENV["SKIP_MIGRATED_SITE_FLAG_UPDATE"]
|
||||
|
||||
# Bypassing SiteSetting.set_and_log if migrated_site is present and not enabled, enable it
|
||||
# We don't need to have the plugin enabled
|
||||
migrated_site_flag_enabled = DB.exec(<<~SQL) > 0
|
||||
UPDATE site_settings
|
||||
SET value = 't'
|
||||
WHERE name = 'migrated_site'
|
||||
AND value <> 't'
|
||||
SQL
|
||||
|
||||
SiteSetting.refresh! if migrated_site_flag_enabled
|
||||
end
|
||||
|
||||
def import_categories
|
||||
|
Reference in New Issue
Block a user