Hi,
Actually, the pull request I generated also handles VERSION deletions
In terms of the code for the manage project deletion event, thereâs a couple of subtle differences:
Firstly â you currently place the code within manage_proj_delete.php â this is a problem in as much as â itâs possible to delete projects via the SOAP api. Equally other plugins may provide routes to delete projects.
Making the assumption that the most likely reason for adding a plugin on a hook to handle project deletions is to allow either:
a) Synchronisation of project information with a 3rd party source (I suspect in your case this the reason you are after this event is so you can handle project deletions within your time tracking software
b) âEvent logâ monitoring of project deletions
In both of these cases the correct placement of this hook is within project_delete â one of the issues in the current code IMO is that for some of the hooks Iâve slowly been submitting PRâs to relocate/fix there are cases where the event does not fire â for example, a bugnote added event that only fires if a bugnote is added via a particular route.
In some cases Iâd deem this to be the correct behaviour i.e. if we expect the plugin author to modify a particular page.
In the case of deletion of project or version events, I think that itâs unlikely that weâd want to modify the page output â and that instead, the expectation would be to achieve either a or b above.
If indeed, the expectation is to allow something specify to the manage page, then Iâd argue weâd need to add a 2 new events â one to fire on A+B above, the other to fire on the manage project page.
In terms of the naming of the hook, (and again, I think some of our existing hooks may have been thrown in in the wrong place in this regard) â we may like to add 2 events at some stage:
EVENT_MANAGE_PROJECT_DELETE (Y)
Delete from project_table
EVENT_MANAGE_PROJECT_DELETED (Z)
Consider 3 plugins:
a) Plugin 1 checks project has been removed from a wiki before allowing deletion
b) Plugin 2 checks project has been removed from a forum before allowing deletion from mantis
c) Plugin 3 logs that a project has been deleted
In the base above, weâd want to hook plugins 1+2 to event Y â this would allow a user to âblockâ the deletion of the project if the tidy up steps (delete from wiki, delete from forum) had not been completed.
Weâd then potentially want to hook plugin 3 to event Z â i.e. to perform the logging after the actual deletion â note, weâd need to be careful what arguments would be picked for this hook as it wouldnât be possible to look up the information at this point.
In any case, my point here is more that we need to make a good choice of naming for future use â calling an event âdeletedâ (past tense) before the actual deletion Iâd argue is more confusing for long-term use. We describe the hook as a âpre-â hook and then use past tense which doesnât make that much sense â and Iâm pretty sure we do that in a number of places already.
Paul
From: Louis BAYLE [mailto:***@gmail.com]
Sent: 16 October 2014 21:26
To: developer discussions
Subject: Re: [mantisbt-dev] EVENT_MANAGE_PROJECT_DELETE
Hi Paul,
I too, created a pull request on EVENT_MANAGE_PROJECT_DELETED:
https://github.com/mantisbt/mantisbt/pull/383
So now we've got two :-)
Note: i called it "..._DELETED" (instead of "..._DELETE", to be similar to the 'EVENT_BUG_DELETED' event. But it's exactly the same code.
I tested in on my plugin, so it should be ok.
Thank you,
Louis
Louis BAYLE
Tel: +33 (0)4.42.604.734
***@gmail.com <mailto:***@gmail.com>
On Thu, Oct 16, 2014 at 9:16 PM, Paul Richards <***@blueyonder.co.uk <mailto:***@blueyonder.co.uk> > wrote:
Louis,
As promised, Iâve generated the patch I had for PROJECT event deletion, and also VERSION event deletion.
Whilst I managed to generate the patch at lunchtime today from previous experimental branches, we block SSH from our work network to âunknownâ hosts so could only generate the PR now.
Iâve created two bugs in Mantis to track these new events:
http://www.mantisbt.org/bugs/view.php?id=17782 - 0017782: New Event: EVENT_MANAGE_VERSION_DELETE
http://www.mantisbt.org/bugs/view.php?id=17783 - 0017783: New Event: EVENT_MANAGE_PROJECT_DELETE
Can you see if the PR for this at https://github.com/mantisbt/mantisbt/pull/384 would achieve what you were after?
Iâve got some similar patches still to generate PRâs for, so if thereâs anything else you are missing say â it might be I already have a patch, or it might be something new that it would be helpful for you to work on implementing.
Thanks
Paul
From: Paul Richards [mailto:***@mantisforge.org <mailto:***@mantisforge.org> ]
Sent: 16 October 2014 10:08
To: developer discussions
Subject: Re: [mantisbt-dev] EVENT_MANAGE_PROJECT_DELETE
Hi Louis,
I'd been reviewing some of the EVENT's in mantis recently for correct placement.
Hooks on deleting project is one of the areas where we are missing events.
I'll generate a PR either during a spare moment today or this evening for this. We actually miss being able to hook on a number of deletion activities across the code base - adding additional hooks to cover this is something that has been on my list to backport from the previous scrapped 2.x branches.
In addition, when reviewing the events before in that branch, there were a number of events that I believe we mis-placed within the code base ( some of which are currently in as PR's and as those get reviewed and merged, i'll be continuing to submit the remaining ones)
Paul
On Thu, Oct 16, 2014 at 9:27 AM, Louis BAYLE <***@gmail.com <mailto:***@gmail.com> > wrote:
Hi,
I have not found any EVENT_MANAGE_PROJECT_DELETE in core/events_inc.php.
Do you know if someone has already worked on this ?
If not, I'll try to do it. Is there any chance that this would be integrated in future mantis 1.2.x releases or are you not interested in this event ?
Is there any documentation on adding events in mantis ?
Best regards,
Louis BAYLE
http://CodevTT.org
***@gmail.com <mailto:***@gmail.com>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
mantisbt-dev mailing list
mantisbt-***@lists.sourceforge.net <mailto:mantisbt-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/mantisbt-dev