Best way to protect customised module code?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
sjo123
New Member
New Member
Posts: 7
Joined: Sun Jul 11, 2010 6:07 am

Best way to protect customised module code?

Post by sjo123 »

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?
Last edited by sjo123 on Mon Jul 25, 2011 12:58 am, edited 1 time in total.
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: Best way to protect customised module code?

Post by M@rtijn »

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')
Make your community a better place!
sjo123
New Member
New Member
Posts: 7
Joined: Sun Jul 11, 2010 6:07 am

Re: Best way to protect customised module code?

Post by sjo123 »

So do you need to change anything to get the /module_custom/Products/foo.php file picked up instead of the standard module file?
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Best way to protect customised module code?

Post by Wishbone »

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.
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: Best way to protect customised module code?

Post by M@rtijn »

Sorry, I stand corrected.
It is indeed not possible to have custom php files.
Make your community a better place!
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Best way to protect customised module code?

Post by Wishbone »

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.
Post Reply

Return to “Modules/Add-Ons”