/** * delete a sponsorship given its id * id can be an array of ids or just an id. * @param int $p_sponsorship_id * @return null */ function sponsorship_delete($p_sponsorship_id) { # handle the case of array of ids if (is_array($p_sponsorship_id)) { foreach ($p_sponsorship_id as $id) { sponsorship_delete($id); } return; } $c_sponsorship_id = db_prepare_int($p_sponsorship_id); $t_sponsorship = sponsorship_get($c_sponsorship_id); $t_sponsorship_table = db_get_table('sponsorship'); # Delete the bug entry $query = "DELETE FROM {$t_sponsorship_table}\n\t\t\t\t WHERE id=" . db_param(); db_query_bound($query, array($c_sponsorship_id)); sponsorship_clear_cache($p_sponsorship_id); history_log_event_special($t_sponsorship->bug_id, BUG_DELETE_SPONSORSHIP, $t_sponsorship->user_id, $t_sponsorship->amount); sponsorship_update_bug($t_sponsorship->bug_id); email_sponsorship_deleted($t_sponsorship->bug_id); }
/** * delete a sponsorship given its id * id can be an array of ids or just an id. * @param integer $p_sponsorship_id The sponsorship identifier to delete. * @return void */ function sponsorship_delete($p_sponsorship_id) { # handle the case of array of ids if (is_array($p_sponsorship_id)) { foreach ($p_sponsorship_id as $t_id) { sponsorship_delete($t_id); } return; } $t_sponsorship = sponsorship_get($p_sponsorship_id); # Delete the bug entry $t_query = 'DELETE FROM {sponsorship} WHERE id=' . db_param(); db_query($t_query, array((int) $p_sponsorship_id)); sponsorship_clear_cache($p_sponsorship_id); history_log_event_special($t_sponsorship->bug_id, BUG_DELETE_SPONSORSHIP, $t_sponsorship->user_id, $t_sponsorship->amount); sponsorship_update_bug($t_sponsorship->bug_id); email_sponsorship_deleted($t_sponsorship->bug_id); }