2015-09-15 04:52:02 +02:00
|
|
|
<?php
|
|
|
|
|
2016-06-15 06:03:16 +02:00
|
|
|
use SilverStripe\ORM\DB;
|
|
|
|
|
2015-09-15 04:52:02 +02:00
|
|
|
/**
|
|
|
|
* Migrates all 3.x file dataobjects to use the new DBFile field.
|
|
|
|
*
|
|
|
|
* @package framework
|
|
|
|
* @subpackage filesystem
|
|
|
|
*/
|
|
|
|
class MigrateFileTask extends BuildTask {
|
|
|
|
|
|
|
|
protected $title = 'Migrate File dataobjects from 3.x';
|
|
|
|
|
|
|
|
protected $description
|
|
|
|
= 'Imports all files referenced by File dataobjects into the new Asset Persistence Layer introduced in 4.0';
|
|
|
|
|
|
|
|
public function run($request) {
|
|
|
|
$migrated = FileMigrationHelper::singleton()->run();
|
|
|
|
if($migrated) {
|
|
|
|
DB::alteration_message("{$migrated} File DataObjects upgraded", "changed");
|
2016-01-26 04:56:07 +01:00
|
|
|
} else {
|
|
|
|
DB::alteration_message("No File DataObjects need upgrading", "notice");
|
2015-09-15 04:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|