Forums de discussion

hooks can get overwritten by patches

thumbnail
Jack Bakker, modifié il y a 9 années.

hooks can get overwritten by patches

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
I applied latest fixpacks in EE v6.2 which overwrote my dockbar and login hooks, where on redeploy of dockbar and login hooks 'seems ok' but I don't know if then overwrote patch updates...

hook merge utility needed
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Yep, you should look at the changes prior to your hook deploy and make sure they are in sync. otherwise your hook may be undoing the patch that was applied.

Hook merge utility sounds good, but boy what a nightmare it would be to implement. Somehow it would have to isolate your changes from the previous unpatched code, add/integrate that into the new patched version, then hope it all applied correctly when deployed? Ick, glad I don't have to write that thing emoticon
thumbnail
Jack Bakker, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
Yeah, the best I have come up with so far is to maintain very good comments in hooks so it is less painful to redo them after installing patches.
thumbnail
Jack Bakker, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
For jsp hooks, the approach I take currently:

- undeploy the hook
- apply the patch(es)
- in NotePad++ with compare plugin, in left pane I open the tomcat*/html/*/*.jsp file and in right pane open my overriding .jsp from my *sdk*/hooks/*/...
- do the comparison noting any new patch-incurred changes in left pane, where if there is I alt-tab back to dev IDE (Eclipse) to update my jsp code

To help myself along I put comments at the end of lines I have 'hooked' like <%-- hook add --%> or <%-- hook commentOut --%> . I choose to only my comments at end of line to reduce number of extra lines...
thumbnail
Christoph Rabel, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Legend Publications: 1554 Date d'inscription: 24/09/09 Publications récentes
I noticed a couple of weeks ago that the current patching-tool actually warns that there are hooked jsps. I didn't really use it.

My approach is slightly different (but basically same):

I usually do a diff of the hooked file with the original file. That's usually very easy to do for me. We have a policy here to always check in the original file to the repository first and only then check in our changes. Makes it simple to know the exact lines we hooked.

Then I take the new file from the patch and apply our changes to it. I think this way is more clean and I found it easier because I usually know what the idea behind the hook was.
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
I think Jack's original problem was that, if you're not paying attention, you could apply a patch overwriting your hook and you might not be aware of it...
thumbnail
Jack Bakker, modifié il y a 9 années.

RE: hooks can get overwritten by patches

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
Christoph Rabel:
I noticed a couple of weeks ago that the current patching-tool actually warns that there are hooked jsps. I didn't really use it.

yeah, I discovered the following recently too ; only names the portlet and files affected yet is still useful

patching-tool list-collisions

Christoph Rabel:

My approach is slightly different (but basically same):

I usually do a diff of the hooked file with the original file. That's usually very easy to do for me. We have a policy here to always check in the original file to the repository first and only then check in our changes. Makes it simple to know the exact lines we hooked.

Then I take the new file from the patch and apply our changes to it. I think this way is more clean and I found it easier because I usually know what the idea behind the hook was.


Good idea

David H Nebinger:
I think Jack's original problem was that, if you're not paying attention, you could apply a patch overwriting your hook and you might not be aware of it...


Yes, and now that we are aware, we discuss towards best practices