silverstripe-framework/Dev/Tasks/MigrateFileTask.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

31 lines
784 B
PHP

<?php
namespace SilverStripe\Dev\Tasks;
use SilverStripe\ORM\DB;
use SilverStripe\Assets\FileMigrationHelper;
use SilverStripe\Dev\BuildTask;
/**
* Migrates all 3.x file dataobjects to use the new DBFile field.
*/
class MigrateFileTask extends BuildTask {
private static $segment = 'MigrateFileTask';
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");
} else {
DB::alteration_message("No File DataObjects need upgrading", "notice");
}
}
}