From d8d9bb53671b31e9abfc5a834714eb2f22594745 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 15 Apr 2019 16:37:03 +1200 Subject: [PATCH] NEW Removed migrate_legacy_file support For the vast majority of sites, you really don't want to run your file migration as part of dev build. The step is involved enough to warrant it's own task. I don't think this is an API change, since the setting won't have affect for anyone who has already enabled it - they would've already done the one-off migration. --- src/File.php | 23 ------------------- .../php/Dev/Tasks/FileMigrationHelperTest.php | 3 --- .../LegacyThumbnailMigrationHelperTest.php | 3 --- 3 files changed, 29 deletions(-) diff --git a/src/File.php b/src/File.php index 8dc73e4f..415f0a8c 100644 --- a/src/File.php +++ b/src/File.php @@ -255,14 +255,6 @@ class File extends DataObject implements AssetContainer, Thumbnail, CMSPreviewab */ private static $apply_restrictions_to_admin = true; - /** - * If enabled, legacy file dataobjects will be automatically imported into the APL - * - * @config - * @var bool - */ - private static $migrate_legacy_file = false; - /** * @config * @var boolean @@ -1206,21 +1198,6 @@ public function getTag() return (string)$this->renderWith($template); } - public function requireDefaultRecords() - { - parent::requireDefaultRecords(); - - // Check if old file records should be migrated - if (!$this->config()->get('migrate_legacy_file')) { - return; - } - - $migrated = FileMigrationHelper::singleton()->run(); - if ($migrated) { - DB::alteration_message("{$migrated} File DataObjects upgraded", "changed"); - } - } - /** * Get the back-link tracking objects that link to this file via HTML fields * diff --git a/tests/php/Dev/Tasks/FileMigrationHelperTest.php b/tests/php/Dev/Tasks/FileMigrationHelperTest.php index cc9efd1f..c5086319 100644 --- a/tests/php/Dev/Tasks/FileMigrationHelperTest.php +++ b/tests/php/Dev/Tasks/FileMigrationHelperTest.php @@ -43,8 +43,6 @@ protected function getBasePath() public function setUp() { - Config::nest(); // additional nesting here necessary - Config::modify()->merge(File::class, 'migrate_legacy_file', false); parent::setUp(); // Set backend root to /FileMigrationHelperTest/assets @@ -77,7 +75,6 @@ public function tearDown() TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); parent::tearDown(); - Config::unnest(); } /** diff --git a/tests/php/LegacyThumbnailMigrationHelperTest.php b/tests/php/LegacyThumbnailMigrationHelperTest.php index f0b9a491..a40356a7 100644 --- a/tests/php/LegacyThumbnailMigrationHelperTest.php +++ b/tests/php/LegacyThumbnailMigrationHelperTest.php @@ -43,8 +43,6 @@ protected function getBasePath() public function setUp() { - Config::nest(); // additional nesting here necessary - Config::modify()->merge(File::class, 'migrate_legacy_file', false); parent::setUp(); // Set backend root to /LegacyThumbnailMigrationHelperTest/assets @@ -68,7 +66,6 @@ public function tearDown() TestAssetStore::reset(); Filesystem::removeFolder($this->getBasePath()); parent::tearDown(); - Config::unnest(); } public function testMigratesThumbnailsForProtectedFiles()