Procedural File: bug_api.php
Source Location: /core/bug_api.php
Page Details
Bug API
| Copyright: | Copyright (C) 2002 - 2009 MantisBT Team - mantisbt-dev@lists.sourceforge.net |
| Copyright: | Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org |
| Link: | http://www.mantisbt.org |
| Usedby: | access_api.php |
Classes
|
BugData
|
Bug Data Structure Definition
|
Includes
requires relationship_api
Functions
bug_assign [line 1502]
null bug_assign(
array $p_bug_id, $p_user_id, [ $p_bugnote_text = ''], [ $p_bugnote_private = false]
)
|
|
assign the bug to the given user
Parameters:
|
array |
$p_bug_id: |
p_bug_id_array integer array representing bug ids to cache |
|
|
$p_user_id: |
|
|
|
$p_bugnote_text: |
|
|
|
$p_bugnote_private: |
|
API Tags:
bug_cache_array_rows [line 186]
null bug_cache_array_rows(
array $p_bug_id_array
)
|
|
Cache a set of bugs
Parameters:
|
array |
$p_bug_id_array: |
p_bug_id_array integer array representing bug ids to cache |
API Tags:
bug_cache_database_result [line 130]
array bug_cache_database_result(
array $p_bug_database_result, [array $p_stats = null]
)
|
|
Cache a database result-set containing full contents of bug_table row.
Parameters:
|
array |
$p_bug_database_result: |
p_bug_database_result database row containing all columns from mantis_bug_table |
|
array |
$p_stats: |
p_stats (optional) array representing bugnote stats |
API Tags:
| Return: | returns an array representing the bug row if bug exists |
| Access: | public |
bug_cache_row [line 148]
bool|array bug_cache_row(
array $p_bug_id, [array $p_trigger_errors = true]
)
|
|
Cache a bug row if necessary and return the cached copy
Parameters:
|
array |
$p_bug_id: |
p_bug_id id of bug to cache from mantis_bug_table |
|
array |
$p_trigger_errors: |
p_trigger_errors set to true to trigger an error if the bug does not exist. |
API Tags:
| Return: | returns an array representing the bug row if bug exists or false if bug does not exist |
| Access: | public |
| Uses: | database_api.php |
bug_check_workflow [line 444]
bool bug_check_workflow(
int $p_bug_status, int $p_wanted_status
)
|
|
Validate workflow state to see if bug can be moved to requested state
Parameters:
|
int |
$p_bug_status: |
p_bug_status current bug status |
|
int |
$p_wanted_status: |
p_wanted_status new bug status |
API Tags:
bug_clear_cache [line 247]
null bug_clear_cache(
[int $p_bug_id = null]
)
|
|
Clear a bug from the cache or all bugs if no bug id specified.
Parameters:
|
int |
$p_bug_id: |
bug id to clear (optional) |
API Tags:
bug_close [line 1558]
bool bug_close(
int $p_bug_id, [string $p_bugnote_text = ''], [bool $p_bugnote_private = false], [string $p_time_tracking = '0:00']
)
|
|
close the given bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id |
|
string |
$p_bugnote_text: |
p_bugnote_text |
|
bool |
$p_bugnote_private: |
p_bugnote_private |
|
string |
$p_time_tracking: |
p_time_tracking |
API Tags:
| Return: | (always true) |
| Access: | public |
bug_copy [line 642]
int bug_copy(
array $p_bug_id, [int $p_target_project_id = null], [bool $p_copy_custom_fields = false], [bool $p_copy_relationships = false], [ $p_copy_history = false], [ $p_copy_attachments = false], [ $p_copy_bugnotes = false], [ $p_copy_monitoring_users = false]
)
|
|
Copy a bug from one project to another. Also make copies of issue notes, attachments, history, email notifications etc.
Parameters:
|
array |
$p_bug_id: |
p_bug_id integer representing bug id |
|
int |
$p_target_project_id: |
p_target_project_id |
|
bool |
$p_copy_custom_fields: |
p_copy_custom_fields |
|
bool |
$p_copy_relationships: |
p_copy_relationships |
|
|
$p_copy_history: |
|
|
|
$p_copy_attachments: |
|
|
|
$p_copy_bugnotes: |
|
|
|
$p_copy_monitoring_users: |
|
API Tags:
| Return: | representing the new bugid |
| Access: | public |
Information Tags:
| Todo: | Not managed FTP file upload |
bug_create [line 475]
int bug_create(
object $p_bug_data
)
|
|
Insert a new bug into the database
Parameters:
|
object |
$p_bug_data: |
BugData Object to create |
API Tags:
bug_delete [line 843]
bool bug_delete(
array $p_bug_id
)
|
|
allows bug deletion :
delete the bug, bugtext, bugnote, and bugtexts selected
Parameters:
|
array |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
| Return: | (always true) |
| Access: | public |
bug_delete_all [line 913]
bool bug_delete_all(
array $p_project_id
)
|
|
Delete all bugs associated with a project
Parameters:
|
array |
$p_project_id: |
p_project_id integer representing a projectid |
API Tags:
bug_ensure_exists [line 343]
null bug_ensure_exists(
int $p_bug_id
)
|
|
Check if a bug exists. If it doesn't then trigger an error
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_exists [line 329]
bool bug_exists(
int $p_bug_id
)
|
|
Check if a bug exists
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
| Return: | true if bug exists, false otherwise |
| Access: | public |
bug_format_id [line 1783]
string bug_format_id(
int $p_bug_id
)
|
|
Pads the bug id with the appropriate number of zeros.
Parameters:
API Tags:
bug_format_summary [line 1258]
string bug_format_summary(
int $p_bug_id, int $p_context
)
|
|
return the bug summary
this is a wrapper for the custom function
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
int |
$p_context: |
p_context representing SUMMARY_CAPTION, SUMMARY_FIELD |
API Tags:
bug_get [line 1184]
object BugData bug_get(
int $p_bug_id, [bool $p_get_extended = false]
)
|
|
Returns an object representing the specified bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
bool |
$p_get_extended: |
p_get_extended included extended information (including bug_text) |
API Tags:
| Return: | Object |
| Access: | public |
bug_get_attachments [line 1367]
array bug_get_attachments(
int $p_bug_id
)
|
|
Get array of attachments associated with the specified bug id. The array will be sorted in terms of date added (ASC). The array will include the following fields: id, title, diskfile, filename, filesize, file_type, date_added.
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_get_bugnote_count [line 1269]
int bug_get_bugnote_count(
int $p_bug_id
)
|
|
Returns the number of bugnotes for the given bug_id
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_get_bugnote_stats [line 1324]
object consisting bug_get_bugnote_stats(
int $p_bug_id
)
|
|
return the timestamp for the most recent time at which a bugnote
associated with the bug was modified and the total bugnote count in one db query
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_get_extended_row [line 1159]
array bug_get_extended_row(
int $p_bug_id
)
|
|
Returns the extended record of the specified bug, this includes
the bug text fields
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
Information Tags:
| Todo: | include reporter name and handler name, the problem is that handler can be 0, in this case no corresponding name will be found. Use equivalent of (+) in Oracle. |
bug_get_field [line 1217]
string bug_get_field(
int $p_bug_id, string $p_field_name
)
|
|
return the specified field of the given bug
if the field does not exist, display a warning and return ''
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
string |
$p_field_name: |
p_fieldname field name |
API Tags:
bug_get_newest_bugnote_timestamp [line 1297]
bool|int bug_get_newest_bugnote_timestamp(
int $p_bug_id
)
|
|
return the timestamp for the most recent time at which a bugnote
associated with the bug was modified
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
| Return: | false or timestamp in integer format representing newest bugnote timestamp |
| Access: | public |
| Uses: | database_api.php |
bug_get_row [line 1173]
array bug_get_row(
int $p_bug_id
)
|
|
Returns the record of the specified bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_get_text_field [line 1237]
string bug_get_text_field(
int $p_bug_id, string $p_field_name
)
|
|
return the specified text field of the given bug
if the field does not exist, display a warning and return ''
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
string |
$p_field_name: |
p_fieldname field name |
API Tags:
bug_is_overdue [line 422]
bool bug_is_overdue(
int $p_bug_id
)
|
|
Check if a given bug is overdue
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
| Return: | true if bug is overdue, false otherwise |
| Access: | public |
| Uses: | database_api.php |
bug_is_readonly [line 390]
bool bug_is_readonly(
int $p_bug_id
)
|
|
Check if the bug is readonly and shouldn't be modified For a bug to be readonly the status has to be >= bug_readonly_status_threshold and current user access level < update_readonly_bug_threshold.
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
bug_is_resolved [line 410]
bool bug_is_resolved(
int $p_bug_id
)
|
|
Check if a given bug is resolved
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
API Tags:
| Return: | true if bug is resolved, false otherwise |
| Access: | public |
| Uses: | config_api.php |
bug_is_user_handler [line 372]
bool bug_is_user_handler(
int $p_bug_id, int $p_user_id
)
|
|
check if the given user is the handler of the bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
int |
$p_user_id: |
p_user_id integer reprenting a user id |
API Tags:
| Return: | return true if the user is the handler, false otherwise |
| Access: | public |
bug_is_user_reporter [line 357]
bool bug_is_user_reporter(
int $p_bug_id, int $p_user_id
)
|
|
check if the given user is the reporter of the bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
int |
$p_user_id: |
p_user_id integer reprenting a user id |
API Tags:
| Return: | return true if the user is the reporter, false otherwise |
| Access: | public |
bug_monitor [line 1711]
bool bug_monitor(
int $p_bug_id, int $p_user_id
)
|
|
enable monitoring of this bug for the user
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug ids |
|
int |
$p_user_id: |
p_user_id integer representing user ids |
API Tags:
bug_prepare_display [line 1829]
object BugData bug_prepare_display(
object p_bug_data $p_bug_data
)
|
|
Return a copy of the bug structure with all the instvars prepared for editing
in an HTML form
Parameters:
|
object p_bug_data |
$p_bug_data: |
BugData Object |
API Tags:
bug_prepare_edit [line 1798]
object BugData bug_prepare_edit(
object p_bug_data $p_bug_data
)
|
|
Return a copy of the bug structure with all the instvars prepared for editing
in an HTML form
Parameters:
|
object p_bug_data |
$p_bug_data: |
BugData Object |
API Tags:
bug_reopen [line 1663]
bool bug_reopen(
int $p_bug_id, [string $p_bugnote_text = ''], [string $p_time_tracking = '0:00'], [bool $p_bugnote_private = false]
)
|
|
reopen the given bug
Parameters:
|
int |
$p_bug_id: |
p_bug_id |
|
string |
$p_bugnote_text: |
p_bugnote_text |
|
string |
$p_time_tracking: |
p_time_tracking |
|
bool |
$p_bugnote_private: |
p_bugnote_private |
API Tags:
bug_resolve [line 1579]
bool bug_resolve(
$p_bug_id, $p_resolution, [ $p_fixed_in_version = ''], [ $p_bugnote_text = ''], [ $p_duplicate_id = null], [ $p_handler_id = null], [ $p_bugnote_private = false], [ $p_time_tracking = '0:00']
)
|
|
resolve the given bug
Parameters:
|
|
$p_bug_id: |
|
|
|
$p_resolution: |
|
|
|
$p_fixed_in_version: |
|
|
|
$p_bugnote_text: |
|
|
|
$p_duplicate_id: |
|
|
|
$p_handler_id: |
|
|
|
$p_bugnote_private: |
|
|
|
$p_time_tracking: |
|
API Tags:
| Return: | (alawys true) |
| Access: | public |
bug_set_field [line 1405]
bool bug_set_field(
int $p_bug_id, string $p_field_name, any $p_value
)
|
|
Set the value of a bug field
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
string |
$p_field_name: |
p_field_name pre-defined field name |
|
any |
$p_value: |
p_value value to set |
API Tags:
bug_text_cache_row [line 267]
bool|array bug_text_cache_row(
int $p_bug_id, [bool $p_trigger_errors = true]
)
|
|
Cache a bug text row if necessary and return the cached copy
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer bug id to retrieve text for |
|
bool |
$p_trigger_errors: |
p_trigger_errors If the second parameter is true (default), trigger an error if bug text not found. |
API Tags:
| Return: | returns false if not bug text found or array of bug text |
| Access: | public |
| Uses: | database_api.php |
bug_text_clear_cache [line 308]
null bug_text_clear_cache(
[int $p_bug_id = null]
)
|
|
Clear a bug's bug text from the cache or all bug text if no bug id specified.
Parameters:
|
int |
$p_bug_id: |
bug id to clear (optional) |
API Tags:
bug_unmonitor [line 1747]
bool bug_unmonitor(
int $p_bug_id, int $p_user_id
)
|
|
disable monitoring of this bug for the user if $p_user_id = null, then bug is unmonitored for all users.
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug ids |
|
int |
$p_user_id: |
p_user_id integer representing user ids |
API Tags:
bug_update [line 948]
bool bug_update(
int $p_bug_id, object p_bug_data $p_bug_data, [bool $p_update_extended = false], [bool $p_bypass_mail = false]
)
|
|
Update a bug from the given data structure
If the third parameter is true, also update the longer strings table
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug id |
|
object p_bug_data |
$p_bug_data: |
BugData Object |
|
bool |
$p_update_extended: |
p_update_extended |
|
bool |
$p_bypass_mail: |
p_bypass_email Default false, set to true to avoid generating emails (if sending elsewhere) |
API Tags:
| Return: | (always true) |
| Access: | public |
bug_update_date [line 1686]
bool bug_update_date(
int $p_bug_id
)
|
|
updates the last_updated field
Parameters:
|
int |
$p_bug_id: |
p_bug_id integer representing bug ids |
API Tags:
|
|