I was thinking of one of the best way to "touch" core code (drupal or contributed modules).
This aspect matters when an upgrade is needed. The easier it is the happier you are.
And right now I think I find a "smooth" way.
Let's assume I really need to change the node_save function in the node.module file (I know you were saying: "ALWAYS TRY TO AVOID TOUCHING people's code" :-)).
1- I'll rename the default function to mv_node_save (in node.module) for example.
2- Include, in node.module, my file modif_node.module created in "sites/all/modif_code/modif_node/". And in my new file i will put the code in the node_save function.
So my new instructions will be taking into account without having to do many 'gymnastics'.
3-Keep track of patches : Once the code is in production (basically after major testing), generate patch file to keep track of what has changed. So in my case node.patch will mention only my include and the function renamed.
Thus the day i will need to upgrade, i will change only my code and maybe rename function.
I need to check all this and probably think of some details after some projects.
But I think this approach will make life less painful every time the "upgrade" word is appearing somehere :-).
! test and see ...
Good news !!!
Il y a 13 ans
Aucun commentaire:
Enregistrer un commentaire