How to generate FileHash manually wthout migrationscript

ss4.2

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

has to be “MigrateFileTask” instead of “MigrateFileTool”

Hi Fabian_Schrattenholz,

Any luck with that?
I have the same problem. I migrated my project from 3.6 to 4.2 and ran the last script mentioned here, but the script must be:
php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTask instead of “MigrateFileTool”.

Still I can’t get it to work, this is the error message I got:
ERROR [Emergency]: Uncaught League\Flysystem\Exception: Impossible to create the root directory “projectfolder\public\assets.protected\Folder/Subfolder/5ba302131a5b8.”.
IN GET dev/tasks/MigrateFileTask
Line 113 in projectfolder\vendor\league\flysystem\src\Adapter\Local.php

I opened a new topic for this here

Hi Kimk,
Yes works for me. More or less. My dataobjects with Relation to an Image habe eben migrated nur I hab to reupload Images with Class::Image… Have you tried to created the folder manually?

Hi Fabian,
that was a bit Denglisch :wink:
No, if I remember correctly I deleted these ’ .protected’ ones that didn’t make any sense and as I couldn’t open the documents properly, I deleted all folders and just copied and pasted them from my former installation. That did the trick and I could open them all properly.
I hope that helped.