Enhancement add notice for MigrateFileTask if FileMigrationHelper doesn't exist

Enhancement add call to image thumbnail helper to generate thumbnails
This commit is contained in:
Christopher Joe 2017-09-27 16:49:11 +13:00 committed by Damian Mooyman
parent fe98555d0a
commit 36397c787c

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Dev\Tasks; namespace SilverStripe\Dev\Tasks;
use SilverStripe\AssetAdmin\Helper\ImageThumbnailHelper;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\Assets\FileMigrationHelper; use SilverStripe\Assets\FileMigrationHelper;
use SilverStripe\Dev\BuildTask; use SilverStripe\Dev\BuildTask;
@ -21,11 +22,23 @@ class MigrateFileTask extends BuildTask
public function run($request) public function run($request)
{ {
if (!class_exists(FileMigrationHelper::class)) {
DB::alteration_message("No file migration helper detected", "notice");
return;
}
$migrated = FileMigrationHelper::singleton()->run(); $migrated = FileMigrationHelper::singleton()->run();
if ($migrated) { if ($migrated) {
DB::alteration_message("{$migrated} File DataObjects upgraded", "changed"); DB::alteration_message("{$migrated} File DataObjects upgraded", "changed");
} else { } else {
DB::alteration_message("No File DataObjects need upgrading", "notice"); DB::alteration_message("No File DataObjects need upgrading", "notice");
} }
if (!class_exists(ImageThumbnailHelper::class)) {
DB::alteration_message("No image thumbnail helper detected", "notice");
return;
}
ImageThumbnailHelper::singleton()->run();
} }
} }