Jump to content

How to prevent files from being deleted during a module update [SOLVED]


Recommended Posts

Hello @ all

On my FrontendForms module, users can add their own custom email templates inside the "email_templates" folder of the module. The problem is that after updating the module, these files are no longer present (only the ones shipped with the module exist). In other words the custom files get lost.

During an update the"old" module directory will be renamed with a dot in the front position (.FrontendForms in this case) and the new version will be downloaded from the module directory. After the update, the module files exist twice: .FrontendForms and FrontendForms directory.

The old directory contains the custom templates added by the user, the newly downloaded not.

Goal: The custom files should be copied from the old folder to the new one.

I have tried to use the upgrade function of the module to copy the files from the old folder to the new one, but this does not work properly, because it only happens if the user clicks the button "Continue to module settings" afterwards. Otherwise the files will not be copied to the new version.

This is not working the way that I wanted. Is there someone that has created a module which also allows the user to add custom files to the module and has a working solution how to prevent those files to be gone after an update?

BTW: I want to prevent storing the custom files outside the module folder (fe. in site/assets/files) if not absolutely necessary.

Any help or idea will be appreciated.

Thanks

Link to comment
Share on other sites

3 hours ago, Juergen said:

BTW: I want to prevent storing the custom files outside the module folder (fe. in site/assets/files) if not absolutely necessary.

Why? This is the way everybody else does it ? 

I'd recommend using a folder in /site/templates, eg /site/templates/FrontendForms - if you choose one in /site/assets the files will not be translatable.

  • Like 2
Link to comment
Share on other sites

2 minutes ago, bernhard said:

I'd recommend using a folder in /site/templates, eg /site/templates/FrontendForms - if you choose one in /site/assets the files will not be translatable.

Ok, thanks @bernhard!!

 

3 minutes ago, bernhard said:

Why? This is the way everybody else does it ? 

I have not seen that before and my thought was to keep it all inside the FrontendForms folder and not separated all over the site?.

So I will add an extra folder beside the templates folder for the custom email templates.

  • Like 1
Link to comment
Share on other sites

  • Juergen changed the title to How to prevent files from being deleted during a module update [SOLVED]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...