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:
Selase Krakani
2025-04-29 22:00:48 +00:00
committed by GitHub
parent 97bcbe1716
commit 5702cc9250

View File

@ -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