File migration from SS3.5 to 4.5 MigrateFileTask not working

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.5.2

Question: Has there been any changes to it lately?

Details of your query go here

I ran the php ./vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTask

and get the following error:
ERROR [Emergency]: Uncaught Error: Call to undefined function SilverStripe\ORM\Connect\mysqli_init() IN GET dev/tasks/MigrateFileTask
Line 79 …vendor\silverstripe\framework\src\ORM\Connect\MySQLiConnector.php
$this->dbConn = mysqli_init();

Has anybody an idea why? I ran this on the root of my project folder.
Is the question:How to configure MigrateFileTask for migrating assets from SS3 to SS4 maybe related to this as well?

Thank you very much.

Are you sure that the mysqli module is present and enabled in your PHP installation? I’m saying so because the function name starts with mysqli and that prefix matches a known PHP module/extension.

I don’t think it’s related to the question that I asked and that you’ve linked to.

Thanks for the quick reply, VoodooPriest.
Yes, PHP extension mysqli is enabled.

Any other idea?

Maybe double check that mysqli is enabled both for your webserver and for the CLI. You can end up in some situations where some module are enabled for one and not the other. This command will list all the php modules enabled for your CLI. php -m

Thanks MaximeRainville,

I didn’t even know there was such thing as php cli. That was a good hint as for some reason my php version on the webserver is different to the one the cli points to.

Anyway, I now have the problem that I get errors about images

ERROR [Emergency]: Uncaught InvalidArgumentException: …\public\assets\assets/Uploads/SilverStripeLogo.png does not exist
IN GET dev/tasks/MigrateFileTask
Line 509 in …vendor\silverstripe\assets\src\Flysystem\FlysystemAssetStore.php
… // Validate this file exists
508: if (!file_exists($path)) {

  • 509: throw new InvalidArgumentException("$path does not exist");
    510: }

Where does the path with the double “assets” public\assets\assets come from?
The image exists on the path public\assets\Uploads

So, I have the same problem as the question
How to configure MigrateFileTask for migrating assets from SS3 to SS4 (mentioned above)

As nobody seems to know how to fix this, I experimented a bit and tried to use SS version 4.4.6, but I got actually the same result with the double assets in the path: public\assets\assets/Uploads/…jpg does not exist IN GET dev/tasks/MigrateFileTask
Line 509 …vendor\silverstripe\assets\src\Flysystem\FlysystemAssetStore.php

So, then I tried version 4.4.1 with the result that I got the following error:
…vendor\silverstripe\framework\src\Dev\TaskRunner.php line 151 {“exception”:"[object] (ReflectionException(code: -1): Class SilverStripe\Assets\Dev\Tasks\VersionedFilesMigrationTask does not exist

I am pretty sure I worked according to the instructions given on File Migration, but to be honest there have been so many changes between all those versions and so many instructions, that I might have missed something. There must be something I am missing, that it doesn’t work for me.

Has anybody any idea???

Or can anybody list actions to migrate files from version 3.5 to 4.5.2 which I can simply apply step by step, please?
I know these are given in the File Migration document, but I followed them like VooDooPries and we both have the problem. So is this simply a bug - but then I am pretty sure somebody else must have had that problem a while ago as I have this issue with version 4.6 as well. So I guess it is some kind of configuration step I am missing.

Any help is really much appreciated.
Thanks,
Kim

@Kimk It is not necessarily that you have missed something. My past experience with SilverStripe migrations since 2.4.7 is what makes me say that. I have come across a handful of hard problems in my migrations so far:

  • The switch from .php to .yml for translation files, which iirc had a script for converting files, but it didn’t work that well. I seem to remember that I ended up doing the conversion manually, but my memory may mislead me here.
  • BlogMigrationTask for converting the blog module from 1.0 to 2.0 was not fully working. A user did some modifications to it, which may have been in a PR, and I’ve submitted amendments to their work.
  • This MigrateFileTask, which, as you’ve experienced yourself, adds a duplicate ‘assets’ in the path. If I did my debugging right, back in March or April, the code is buggy.

You may have missed a step just like I may have missed either the same step or another one. But the fact that you come across the same snag as me should not dismiss the possibility that there is an issue (for instance, an undocumented assumption) with MigrateFileTask. A definitive test would be to create an SS 3.6 site and upload a few assets, then migrate it to SS 4 and see whether MigrateFileTask outputs the same error message.

In order to bring my website online, I have now resorted to putting it (in its 3.6 version) in a Docker container, which led to its own string of issues (absolute links, login forms working on dev workstation or in VMs but not working in production where I can’t have xdebug). I have not given up yet on trying to solve those issues, but the amount of work starts to feel ‘not worth it’.

I am now rather considering bypassing the asset migration and uploading again the assets that are still used on the website, since the website has been offline for almost a month. I still have ConvertTranslatableTask to run and the fluent and ldap modules to reconfigure before I’m over with the migration to 4.x, which looks like a long road ahead.

Hi there,

Back in SS4.5.2:

So, I found a solution for the MigrateFileTask double “assets” in path:
In …\vendor\silverstripe\assets\src\Dev\Tasks\FileMigrationHelper.php I changed line 306 to
$base . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $fsFilename,…
(deleted the ASSETS_DIR . from it)