How to generate FileHash manually wthout migrationscript



How to generate FileHash manually wthout migrationscript

I’m migrating a SS3 website to SS4. Sadly the migration tool for FileDataObjects is not working.
So I need to generate the value for the HashFile Field manually via n php-script or sql-statement.
I think I can managed that, but i’m not sure which field is used as base for the generation of that hashvalue.

// Include any relevant code. If you have a lot of code, link to a gist instead.


If it’s “not working” it’s either a bug or some problems with your assets. Can you share an error message or define, what is not working?

I had e.g. to remove a .tif image from DB, which was accidently uploaded loong time ago to make it work. And best is, to run it from CLI to avoid time and memory limits.

vendor/bin/sake dev/tasks/MigrateFileTask

Do you have subsites module installed?

with subsites I also had to run

vendor/bin/sake dev/tasks/MigrateFileTask SubsiteID=1
vendor/bin/sake dev/tasks/MigrateFileTask SubsiteID=2

You migt also skip migrating and use the old “legacy” filesystem, which might have other drawbacks.


Hej, thanks for youre reply. Is sake only working for linux?

The error is "Uncaught Exception SilverStripe\ORM\ValidationException: “Extension is not allowed”
Guess that is the error you pointed at. but I do not find any other files than jpg/gif…
Looking into the db-table I figured out that the FileHash has been generated for my Custom DataObject (i.e:RealEstate/RE_Image) that extends Image but not for the File of the Image::class itself(SilverStripe\Assets\Image)…


For windows user (xampp)

cd your-webroot/
php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTool