Skip to content

Commit

Permalink
New Event: EVENT_MANAGE_PROJECT_DELETE
Browse files Browse the repository at this point in the history
Add new event: EVENT_MANAGE_PROJECT_DELETE

These events allow plugins to process or 'block' a project deletion,
as they occur prior to any version or project deletion.

This could be used to allow synchronisation with a 3rd party system, to deny
the deletion of specific projects.

Fixes #17783

Signed-off-by: Victor Boctor <victor@mantishub.net>
  • Loading branch information
mantis authored and vboctor committed Nov 2, 2014
1 parent f9ee2fe commit 42e7ed0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/events_inc.php
Expand Up @@ -69,6 +69,7 @@
'EVENT_MANAGE_PROJECT_CREATE' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_PROJECT_UPDATE_FORM' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_PROJECT_UPDATE' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_PROJECT_DELETE' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_PROJECT_PAGE' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_VERSION_CREATE' => EVENT_TYPE_EXECUTE,
'EVENT_MANAGE_VERSION_UPDATE_FORM' => EVENT_TYPE_EXECUTE,
Expand Down
2 changes: 2 additions & 0 deletions core/project_api.php
Expand Up @@ -347,6 +347,8 @@ function project_create( $p_name, $p_description, $p_status, $p_view_state = VS_
* @return void
*/
function project_delete( $p_project_id ) {
event_signal( 'EVENT_MANAGE_PROJECT_DELETE', array( $p_project_id ) );

$t_email_notifications = config_get( 'enable_email_notification' );

# temporarily disable all notifications
Expand Down
17 changes: 17 additions & 0 deletions docbook/Developers_Guide/en-US/Events_Reference_Manage.xml
Expand Up @@ -117,6 +117,23 @@
</blockquote>
</blockquote>

<blockquote id="dev.eventref.manage.project.delete">
<title>EVENT_MANAGE_PROJECT_DELETE (Execute)</title>

<blockquote>
<para>
This event allows plugins to do pre-processing of project
deletion. This event is triggered prior to the project
removal from the database.
</para>

<itemizedlist>
<title>Parameters</title>
<listitem><para>&lt;Integer&gt;: Project ID</para></listitem>
</itemizedlist>
</blockquote>
</blockquote>

<blockquote id="dev.eventref.manage.version.create">
<title>EVENT_MANAGE_VERSION_CREATE (Execute)</title>

Expand Down

0 comments on commit 42e7ed0

Please sign in to comment.