Plugin duplicate class compile error

Hello,

I have successfully written a couple of simple plugins which work ok on mautic 6.0.0.

However on the next one i put the plugin in a sub directory by mistake. After spotting my mistake I moved it to the correct place up a level. However when I clear the cache I get a duplicate class compile error thereafter.

I have removed the plugin and put it back, I’ve cleared the cache using the command console and manually. I’ve reloaded the plugins and I’ve rebooted the web server etc. None of which work

I can remove the plugin and add another new one and that works ok, I just cant add the one back with the correct path after it was in the incorrect path.

Therefore Mautic is remembering the location of the plugin And if I put the plugin in its right place you get the error.

Any idea how mautic remembers plugin installs because when you remove the plugin folder or its path mautic remembers the previous one somehow ?

Thanks.

Can you check your plugins table? You need to remove from there

  • delete your cache folder’s prod/*

Hello joeyk,

Thanks for your tips.

I found the root cause of my problem.

I did not use the correct Mautic namespace format for a plugin. Its should be MauticPlugin.…

When I ran clear cache console command the code did compile originally and did work. However if I removed the plugin and then put it back at a later date it would not recompile.

I read somewhere that the console clear command only recompiled code with the correct namespace and ignores incorrect namespaces. And then I discovered my mistake.

I corrected the namespace and then the problem when away.

Yes I will check if the old namespaces and or plugin names exist in the database.

It would be great if you could install and uninstall a plugin and that process cleared up everything necessary and not have to manually change the database as this is problematic. This is just my view.

Thanks.

1 Like