. # This upgrade moves attachments from the database to the disk /** * @package MantisBT * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org */ /** * MantisBT Core API's */ require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); $f_source_field_id = gpc_get_int( 'source_id' ); $f_dest_field = gpc_get( 'dest_id' ); # checks on validity $t_valid_fields = array( 'fixed_in_version', ); if( !in_array( $f_dest_field, $t_valid_fields ) ) { echo ''; echo '

Invalid destination field (' . string_attribute($f_dest_field) . ') specified.

'; echo ''; exit; } ?> MantisBT Administration - Copy Custom Fields to Built-in
MantisBT Administration - Copy Custom Fields to Built-in


' . db_param(); $result = @db_query_bound( $query, Array( $f_source_field_id, '' ) ); if( FALSE == $result ) { echo '

No fields need to be updated.

'; } else { $count = db_num_rows( $result ); echo '

Found ' . $count . ' fields to be updated.

'; $t_failures = 0; if( $count > 0 ) { echo ''; # Headings echo ''; } for( $i = 0;$i < $count;$i++ ) { $row = db_fetch_array( $result ); extract( $row, EXTR_PREFIX_ALL, 'v' ); # trace bug id back to project $t_project_id = bug_get_field( $v_bug_id, 'project_id' ); $t_cust_value = $v_value; printf("\n'; } echo '
Bug IdField ValueStatus
%07d%s", helper_alternate_class(), $v_bug_id, $v_bug_id, $v_value); # validate field contents switch( $f_dest_field ) { case 'fixed_in_version': $t_valid = ( version_get_id( $t_cust_value, $t_project_id ) == FALSE ) ? FALSE : TRUE; break; default: $t_valid = FALSE; } if( $t_valid ) { # value was valid, update value if( !bug_set_field( $v_bug_id, $f_dest_field, $t_cust_value ) ) { echo 'database update failed'; $t_failures++; } else { echo 'applied'; } } else { echo 'field value was not valid or previously defined'; $t_failures++; } echo '

' . $count . ' fields processed, ' . $t_failures . ' failures'; } echo '

Completed...

'; ?>