From 5702cc9250fb2d34efdbfc3d7b72e4d18e10c226 Mon Sep 17 00:00:00 2001 From: Selase Krakani <849886+s3lase@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:00:48 +0000 Subject: [PATCH] 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. --- script/bulk_import/generic_bulk.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/script/bulk_import/generic_bulk.rb b/script/bulk_import/generic_bulk.rb index 782fd46f91e..cd0d98b8d58 100644 --- a/script/bulk_import/generic_bulk.rb +++ b/script/bulk_import/generic_bulk.rb @@ -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