verbb / icon-picker

A Craft CMS field to select SVG or font icons from a folder for use in your content.
Other
17 stars 8 forks source link

m221130_000000_migrate_root_iconsets: The dir argument must be a directory #81

Closed sander-lameco closed 10 months ago

sander-lameco commented 10 months ago

Describe the bug

Currently we are upgrading a Craft CMS project from Craft 3 to 4. While migrating we run into an error with the m221130_000000_migrate_root_iconsets migration.

The error:

The dir argument must be a directory: /Users/%redacted%/Sites/%redacted%/web/icon-picker (/Users/%redacted%/Sites/%redacted%/vendor/yiisoft/yii2/helpers/BaseFileHelper.php:646)

We are using a Custom font location with SVG files. Plugin settings:

Steps to reproduce

Not sure how to reproduce, sorry.

Craft CMS version

3.9.1

Plugin version

1.1.14

Multi-site?

Yes

Additional context

No response

engram-design commented 10 months ago

Does the folder /Users/%redacted%/Sites/%redacted%/web/icon-picker actually exist? Where does that path come from by the way? As your settings are showing that the root path is @webroot/icons/ not web/icon-picker as the error points out.

If you can also post the full error from your logs, that would be handy to try and trace the error a bit more.

sander-lameco commented 10 months ago

Hey, thanks for the quick reply. Sorry I should have looked into the path of the error some more before posten.

I tried moving the icons over to web/icon-picker instead of web/icons and that made the migration succeed. If I then go to the settings of the plugin the settings seem to have fallen back to the defaults, I guess that is why the migration was expecting web/icon-picker instead.

Are these values stored in the project.yaml or in the DB?

engram-design commented 10 months ago

They're stored as plugin settings, so they're part of your project config YAML files. These can be overridden with a config/icon-picker.php file however.

sander-lameco commented 10 months ago

Weird, only reference I could find in the project.yaml is this:

  icon-picker:
    edition: standard
    enabled: true
    licenseKey: %redacted%
    schemaVersion: 1.2.3

I guess it's always best practice to use the plugin config file instead.

engram-design commented 10 months ago

Wouldn't say it's best practice - whatever works for you! But yeah, there should be some settings in there. web/icon-picker isn't a default in the plugin, so not sure where that's come from.

The migration is going to try and create the icon set automatically, based on your "Icons path" plugin setting, which isn't that directory. Hard to tell what's going on here!

sander-lameco commented 10 months ago

So I did another test Craft 4 upgrade / migration, turned out the icon-picker.yaml config was empty (its a project we took over from another agency). With the correct config settings in the config file the migration works without any issue. So somehow the missing configuration settings in either project.yaml or icon-picker.yaml were causing the migration to fail on t he path.

Thanks for the help!