make customizations persistent from upgrades

Hi,
I made customizations to the Calendar module, directly in the files of the /Calendar folder:

  • Calendar.php
  • CalendarUtils.php
  • CalendarDisplay.php

I noticed that changes to this module are not taken if placed in the ‘/ custom / modules / Calendar’ folder.
Where can I put these changes?

Thanks

Some files need to be updated manually because they are not picked from the custom folder.

There may be problems with updates?
Thanks

You should take some care, since you can’t make these changes upgrade-safe, to make them simple to update after some upgrade breaks them.

My suggestion is that you change only a small detail in core. When you find the “requires” for those files:

require_once("modules/Calendar/CalendarUtils.php");

change it to this:

require_once(get_custom_file_if_exists"modules/Calendar/CalendarUtils.php"));

Then create copies of those required files under “custom” dir and make your edits there.

When an upgrade happens that changes any of these files, you should:

  1. Re-do the above change in the files “requiring”

  2. Check what changed in the new required files and merge those changes into your custom versions.

1 Like