What is the best way to protect customised modules from being over-written when a module upgrade takes place?
Can you put customised module files in /module_custom as you can with land and template files?
Best way to protect customised module code?
Best way to protect customised module code?
Last edited by sjo123 on Mon Jul 25, 2011 12:58 am, edited 1 time in total.
Re: Best way to protect customised module code?
it actually is module_custom and yes you can, but...
..most of the time when there is a upgrade to a module, the entire code or parts of it will be rewritten, deleted or added. Therefore a custom_module file will not work properly overtime and is not really handy.
I have a simple text file with the code i've 'rewritten' (actually they are more simple sql queries I want different than standard) which I manually change when a module updates, that way you can control it better.
(tip: the brilliant module 'OwnersManual', you'll get an extra page in your admin panel where you can store these 'code changes')
..most of the time when there is a upgrade to a module, the entire code or parts of it will be rewritten, deleted or added. Therefore a custom_module file will not work properly overtime and is not really handy.
I have a simple text file with the code i've 'rewritten' (actually they are more simple sql queries I want different than standard) which I manually change when a module updates, that way you can control it better.
(tip: the brilliant module 'OwnersManual', you'll get an extra page in your admin panel where you can store these 'code changes')
Make your community a better place!
Re: Best way to protect customised module code?
So do you need to change anything to get the /module_custom/Products/foo.php file picked up instead of the standard module file?
Re: Best way to protect customised module code?
I don't believe that you can use module_custom for PHP changes.. I believe I tested this, and you can only use lang and template overrides in this area.
Re: Best way to protect customised module code?
Sorry, I stand corrected.
It is indeed not possible to have custom php files.
It is indeed not possible to have custom php files.
Make your community a better place!
Re: Best way to protect customised module code?
One little trick I have done is to add a template into the module_custom area that calls a plugin or UDT, then includes the original template... In this UDT, I can do whatever I want, database calls, etc, then modify existing template variables, and in this way modify some aspects of the original code without having to hack it. One example would be adding GBFilePicker to the default news article submission template.

