Esempio n. 1
0
function project_delete($p_project_id)
{
    $t_email_notifications = config_get('enable_email_notification');
    # temporarily disable all notifications
    config_set_cache('enable_email_notification', OFF, CONFIG_TYPE_INT);
    $c_project_id = db_prepare_int($p_project_id);
    $t_project_table = db_get_table('project');
    # Delete the bugs
    bug_delete_all($p_project_id);
    # Delete associations with custom field definitions.
    custom_field_unlink_all($p_project_id);
    # Delete the project categories
    category_remove_all($p_project_id);
    # Delete the project versions
    version_remove_all($p_project_id);
    # Delete relations to other projects
    project_hierarchy_remove_all($p_project_id);
    # Delete the project files
    project_delete_all_files($p_project_id);
    # Delete the records assigning users to this project
    project_remove_all_users($p_project_id);
    # Delete all news entries associated with the project being deleted
    news_delete_all($p_project_id);
    # Delete project specific configurations
    config_delete_project($p_project_id);
    # Delete any user prefs that are project specific
    user_pref_delete_project($p_project_id);
    # Delete the project entry
    $query = "DELETE FROM {$t_project_table}\n\t\t\t\t  WHERE id=" . db_param();
    db_query_bound($query, array($c_project_id));
    config_set_cache('enable_email_notification', $t_email_notifications, CONFIG_TYPE_INT);
    project_clear_cache($p_project_id);
    # db_query errors on failure so:
    return true;
}
Esempio n. 2
0
/**
 * Delete a project
 * @param integer $p_project_id A project identifier.
 * @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
    config_set_cache('enable_email_notification', OFF, CONFIG_TYPE_INT);
    # Delete the bugs
    bug_delete_all($p_project_id);
    # Delete associations with custom field definitions.
    custom_field_unlink_all($p_project_id);
    # Delete the project categories
    category_remove_all($p_project_id);
    # Delete the project versions
    version_remove_all($p_project_id);
    # Delete relations to other projects
    project_hierarchy_remove_all($p_project_id);
    # Delete the project files
    project_delete_all_files($p_project_id);
    # Delete the records assigning users to this project
    project_remove_all_users($p_project_id);
    # Delete all news entries associated with the project being deleted
    news_delete_all($p_project_id);
    # Delete project specific configurations
    config_delete_project($p_project_id);
    # Delete any user prefs that are project specific
    user_pref_delete_project($p_project_id);
    # Delete the project entry
    $t_query = 'DELETE FROM {project} WHERE id=' . db_param();
    db_query($t_query, array($p_project_id));
    config_set_cache('enable_email_notification', $t_email_notifications, CONFIG_TYPE_INT);
    project_clear_cache($p_project_id);
}