From 36397c787ccef002c7bba793e2e255112a8652c1 Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Wed, 27 Sep 2017 16:49:11 +1300 Subject: [PATCH] Enhancement add notice for MigrateFileTask if FileMigrationHelper doesn't exist Enhancement add call to image thumbnail helper to generate thumbnails --- src/Dev/Tasks/MigrateFileTask.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Dev/Tasks/MigrateFileTask.php b/src/Dev/Tasks/MigrateFileTask.php index 7b19c5b82..4b026b876 100644 --- a/src/Dev/Tasks/MigrateFileTask.php +++ b/src/Dev/Tasks/MigrateFileTask.php @@ -2,6 +2,7 @@ namespace SilverStripe\Dev\Tasks; +use SilverStripe\AssetAdmin\Helper\ImageThumbnailHelper; use SilverStripe\ORM\DB; use SilverStripe\Assets\FileMigrationHelper; use SilverStripe\Dev\BuildTask; @@ -21,11 +22,23 @@ class MigrateFileTask extends BuildTask public function run($request) { + if (!class_exists(FileMigrationHelper::class)) { + DB::alteration_message("No file migration helper detected", "notice"); + return; + } + $migrated = FileMigrationHelper::singleton()->run(); if ($migrated) { DB::alteration_message("{$migrated} File DataObjects upgraded", "changed"); } else { 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(); } }