Skip to content

Commit

Permalink
NEW Removed migrate_legacy_file support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chillu committed Apr 29, 2019
1 parent 260effe commit d8d9bb5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
23 changes: 0 additions & 23 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down
3 changes: 0 additions & 3 deletions tests/php/Dev/Tasks/FileMigrationHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,7 +75,6 @@ public function tearDown()
TestAssetStore::reset();
Filesystem::removeFolder($this->getBasePath());
parent::tearDown();
Config::unnest();
}

/**
Expand Down
3 changes: 0 additions & 3 deletions tests/php/LegacyThumbnailMigrationHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,7 +66,6 @@ public function tearDown()
TestAssetStore::reset();
Filesystem::removeFolder($this->getBasePath());
parent::tearDown();
Config::unnest();
}

public function testMigratesThumbnailsForProtectedFiles()
Expand Down

0 comments on commit d8d9bb5

Please sign in to comment.