Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f087535
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ce6d92d
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on May 18, 2012

  1. Record reporter+submitted date in extended info first revision history

    When updating any of the "extended info" fields (Description, Steps To
    Reproduce, Additional Information), the history of modifications is
    saved in the mantis_bug_revision_table. When the first change is made
    since issue creation, an additional, "initial" revision record is
    created to keep track of the original value.
    
    Prior to this, the record was saved with incorrect author and timestamp
    information: current user and date of modification, instead of the bug's
    reporter and date of submission.
    
    Fixes #14272
    dregad committed May 18, 2012

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    stepankuzmin Stepan Kuzmin
    Copy the full SHA
    d12e5e9 View commit details
  2. Remove unnecessary use of array_reverse() to display bug revisions

    Prior to this commit, in bug_revision_view_page.php the array returned
    by functions bug_revision_list() and bug_revision_like() was
    sytematically reversed by calling array_reverse().
    
    Since these 2 functions are not used anywhere else, it is more efficient
    to modify the SQL so that the functions sort the list as it should be
    right from the start, thus avoiding the calls to array_reverse().
    
    Note that the ORDER BY clause has been changed from 'timestamp' to 'id',
    this guarantees correct display order in case the timestamps are equal
    since by definition the id is a sequential number increased with each
    revision as it is recorded.
    
    Fixes #14273
    dregad committed May 18, 2012

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    stepankuzmin Stepan Kuzmin
    Copy the full SHA
    ce6d92d View commit details
Showing with 10 additions and 10 deletions.
  1. +2 −3 bug_revision_view_page.php
  2. +3 −3 core/bug_api.php
  3. +5 −4 core/bug_revision_api.php
5 changes: 2 additions & 3 deletions bug_revision_view_page.php
Original file line number Diff line number Diff line change
@@ -73,12 +73,12 @@
$t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' );
$t_bug_data = bug_get( $t_bug_id, true );

$t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id, REV_ANY, $f_bugnote_id ), true );
$t_bug_revisions = bug_revision_list( $t_bug_id, REV_ANY, $f_bugnote_id );

$t_title = lang_get( 'bugnote' ) . ' ' . $f_bugnote_id;

} else if ( $f_rev_id ) {
$t_bug_revisions = array_reverse( bug_revision_like( $f_rev_id ), true );
$t_bug_revisions = bug_revision_like( $f_rev_id );

if ( count( $t_bug_revisions ) < 1 ) {
trigger_error( ERROR_GENERIC, ERROR );
@@ -97,7 +97,6 @@ function show_revision( $t_revision ) {
static $s_can_drop = null;
static $s_drop_token = null;
static $s_user_access = null;

if ( is_null( $s_can_drop ) ) {
$s_can_drop = access_has_bug_level( config_get( 'bug_revision_drop_threshold' ), $t_revision['bug_id'] );
$s_drop_token = form_security_param( 'bug_revision_drop' );
6 changes: 3 additions & 3 deletions core/bug_api.php
Original file line number Diff line number Diff line change
@@ -516,23 +516,23 @@ function update( $p_update_extended = false, $p_bypass_mail = false ) {

if( $t_old_data->description != $this->description ) {
if ( bug_revision_count( $c_bug_id, REV_DESCRIPTION ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->last_updated );
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description );
history_log_event_special( $c_bug_id, DESCRIPTION_UPDATED, $t_revision_id );
}

if( $t_old_data->steps_to_reproduce != $this->steps_to_reproduce ) {
if ( bug_revision_count( $c_bug_id, REV_STEPS_TO_REPRODUCE ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->last_updated );
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $this->steps_to_reproduce );
history_log_event_special( $c_bug_id, STEP_TO_REPRODUCE_UPDATED, $t_revision_id );
}

if( $t_old_data->additional_information != $this->additional_information ) {
if ( bug_revision_count( $c_bug_id, REV_ADDITIONAL_INFO ) < 1 ) {
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->last_updated );
$t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted );
}
$t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $this->additional_information );
history_log_event_special( $c_bug_id, ADDITIONAL_INFO_UPDATED, $t_revision_id );
9 changes: 5 additions & 4 deletions core/bug_revision_api.php
Original file line number Diff line number Diff line change
@@ -274,7 +274,8 @@ function bug_revision_last( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) {
}

/**
* Retrieve a full list of changes to the bug's information.
* Retrieve a full list of changes to the bug's information, sorted in
* reverse chronological order.
* @param int $p_bug_id Bug ID
* @param int $p_type Revision Type
* @param int $p_bugnote_id Bugnote ID
@@ -299,7 +300,7 @@ function bug_revision_list( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) {
$t_query .= ' AND bugnote_id=0';
}

$t_query .= ' ORDER BY timestamp ASC';
$t_query .= ' ORDER BY id DESC';
$t_result = db_query_bound( $t_query, $t_params );

$t_revisions = array();
@@ -312,7 +313,7 @@ function bug_revision_list( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) {

/**
* Retrieve a list of changes to a bug of the same type as the
* given revision ID.
* given revision ID, sorted in reverse chronological order.
* @param int $p_rev_id Revision ID
* @return array|null Array of Revision rows
*/
@@ -347,7 +348,7 @@ function bug_revision_like( $p_rev_id ) {
$t_query .= ' AND bugnote_id=0';
}

$t_query .= ' ORDER BY timestamp ASC';
$t_query .= ' ORDER BY id DESC';
$t_result = db_query_bound( $t_query, $t_params );

$t_revisions = array();