Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First phase of bug #8435: Implement Global and Inheriting Categories …
…Structure. Implemented category ID behaviors to replicate all existing functionality. git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4770 f5dc347c-c33d-0410-90a0-b07cc1902cb9
- Loading branch information
Showing
30 changed files
with
417 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org | ||
# Copyright (C) 2002 - 2007 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 | ||
|
||
# -------------------------------------------------------- | ||
# $Id: $ | ||
# -------------------------------------------------------- | ||
|
||
/** | ||
* Update functions for the installation schema's 'UpdateFunction' option. | ||
* All functions must be name install_<function_name> and referenced as just <function_name>. | ||
*/ | ||
|
||
/** | ||
* Migrate the legacy category data to the new category_id-based schema. | ||
*/ | ||
function install_category_migrate() { | ||
$t_bug_table = db_get_table( 'mantis_bug_table' ); | ||
$t_category_table = db_get_table( 'mantis_category_table' ); | ||
$t_project_category_table = db_get_table( 'mantis_project_category_table' ); | ||
|
||
$query = "SELECT project_id, category FROM $t_project_category_table ORDER BY project_id, category"; | ||
$t_category_result = db_query( $query ); | ||
|
||
$query = "SELECT project_id, category FROM $t_bug_table ORDER BY project_id, category"; | ||
$t_bug_result = db_query( $query ); | ||
|
||
$t_data = Array(); | ||
|
||
# Find categories specified by project | ||
while ( $row = db_fetch_array( $t_category_result ) ) { | ||
$t_project_id = $row['project_id']; | ||
$t_name = $row['category']; | ||
$t_data[$t_project_id][$t_name] = true; | ||
} | ||
|
||
# Find orphaned categories from bugs | ||
while ( $row = db_fetch_array( $t_bug_result ) ) { | ||
$t_project_id = $row['project_id']; | ||
$t_name = $row['category']; | ||
|
||
$t_data[$t_project_id][$t_name] = true; | ||
} | ||
|
||
# In every project, go through all the categories found, and create them and update the bug | ||
foreach ( $t_data as $t_project_id => $t_categories ) { | ||
foreach ( $t_categories as $t_name => $t_true ) { | ||
$query = "INSERT INTO $t_category_table ( name, project_id ) VALUES ( " . db_param(0) . ', ' . db_param(1) . ' )'; | ||
db_query_bound( $query, array( $t_name, $t_project_id ) ); | ||
$t_category_id = db_insert_id( $t_category_table ); | ||
|
||
$query = "UPDATE $t_bug_table SET category_id=" . db_param(0) . ' | ||
WHERE project_id=' . db_param(1) . ' AND category=' . db_param(2); | ||
db_query_bound( $query, array( $t_category_id, $t_project_id, $t_name ) ); | ||
} | ||
} | ||
|
||
# return 2 because that's what ADOdb/DataDict does when things happen properly | ||
return 2; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.