mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +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
|
end
|
||||||
|
|
||||||
rows.close
|
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
|
end
|
||||||
|
|
||||||
def import_categories
|
def import_categories
|
||||||
|
Reference in New Issue
Block a user