Skip to content

Commit

Permalink
install_stored_filter_migrate should ignore missing filter fields
Browse files Browse the repository at this point in the history
Commit c42ac12 standardised field names
between the database and filters subsystem of MantisBT. However the
migration function (install_stored_filter_migrate) expected old filter
strings to contain a value for every filterable field. When this
condition was not met (a filter string didn't contain any reference to
the show_category field for example), the migration function failed with
an error.
  • Loading branch information
davidhicks committed May 17, 2010
1 parent 208d302 commit 339e583
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/install_helper_functions_api.php
Expand Up @@ -340,10 +340,12 @@ function install_stored_filter_migrate() {
while( $t_row = db_fetch_array( $t_result ) ) {
$t_filter_arr = filter_deserialize( $t_row['filter_string'] );
foreach( $t_filter_fields AS $t_old=>$t_new ) {
$t_value = $t_filter_arr[$t_old];
unset( $t_filter_arr[$t_old] );
if( !is_null( $t_new ) ) {
$t_filter_arr[$t_new] = $t_value;
if ( isset( $t_filter_arr[$t_old] ) ) {
$t_value = $t_filter_arr[$t_old];
unset( $t_filter_arr[$t_old] );
if( !is_null( $t_new ) ) {
$t_filter_arr[$t_new] = $t_value;
}
}
}

Expand Down

0 comments on commit 339e583

Please sign in to comment.