View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004122 | mantisbt | relationships | public | 2004-07-18 11:25 | 2004-08-29 02:35 |
Reporter | vboctor | Assigned To | masc | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.19.0a2 | ||||
Fixed in Version | 0.19.0rc1 | ||||
Summary | 0004122: Upgrade script seems to swap the duplicate relationship | ||||
Description | When upgrading the bugtracker database, it seems that the upgrade scripts marked A as duplicate of B rather than B as duplicate of A. Assuming that B was resolved as duplicate with duplicate id set to A. If the problem is reproduced, you may need a script to swap the duplicate relationships in the bugtracker database! | ||||
Tags | No tags attached. | ||||
Attached Files | swap_duplicate_id.phps (1,611 bytes)
<?php # Mantis - a php based bugtracking system # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net # This program is distributed under the terms and conditions of the GPL # See the README and LICENSE files for details # Changes applied to 0.18 database # -------------------------------------------------------- # $Id: 0_18_inc.php,v 1.12 2004/07/15 21:51:16 vboctor Exp $ # -------------------------------------------------------- ?> <?php require_once( 'db_table_names_inc.php' ); $upgrades = array(); $query = "SELECT id, duplicate_id FROM $t_bug_table WHERE duplicate_id != '';"; $result = db_query( $query ); $t_count = db_num_rows( $result ); for ( $i = 0 ; $i < $t_count ; $i++ ) { $t_bug = db_fetch_array( $result ); $t_bug_id = $t_bug['id']; $t_duplicate_bug_id = $t_bug['duplicate_id']; $query = "SELECT id FROM $t_bug_relationship_table WHERE relationship_type = '" . BUG_DUPLICATE . "' and source_bug_id = '$t_duplicate_bug_id' and destination_bug_id = '$t_bug_id';"; $result2 = db_query( $query ); $t_count2 = db_num_rows( $result2 ); if( $t_count2 != 1 ) { continue; } $t_relationship = db_fetch_array( $result2 ); $t_relationship_id = $t_relationship['id']; $query = "UPDATE $t_bug_relationship_table SET source_bug_id = '$t_bug_id', destination_bug_id = '$t_duplicate_bug_id' WHERE id='$t_relationship_id'"; db_query( $query ); } echo 'done.'; ?> | ||||
Reproduced. There was a double error: I swapped the meaning in the italian lang files of the relationship and then I swapped the meaning in the upgrade script. $s_duplicate_of = "duplicate of"; Marcello |
|
I applied your patch. Can you please also attach a script that would go through all existing duplicate relationships in the database and swap them? We need this to run on this installation and users may need it to fix their relationships after they upgrade to 0.19.0a2. Following are the strings I used in 0.19.0a2 release: |
|
Updated the file 0_18_inc.php with the script to swap the values (id relationship-4). |
|
I uploaded a standalone version of your script. For it to run successfully, it must be placed in the admin/ folder. I am not sure whether we should add this as a step in the upgrade script or not. My worries are:
|
|
Victor, |
|
ok, I committed your patch to the upgrade script. |
|
MantisBT: master 35cf1f8e 2004-07-18 18:20 Details Diff |
Fix 0004122: Upgrade script seems to swap the duplicate relationship (masc) git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2727 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0004122 |
|
mod - doc/ChangeLog | Diff File | ||
mod - admin/upgrades/0_18_inc.php | Diff File |