Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0008380 | mantisbt | administration | public | 2007-09-21 04:31 | 2007-10-04 01:37 |
| Reporter | dreadnaught | Assigned To | vboctor | ||
| Priority | normal | Severity | block | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| OS | SuSE SLES | OS Version | 10.0 | ||
| Product Version | 1.1.0a4 | ||||
| Fixed in Version | 1.1.0rc1 | ||||
| Summary | 0008380: Deleting old user Account results in Database inconsistency | ||||
| Description | Deleting old user Account results in Database inconsistency. When deleting an old mantis user account, all references to this deleted user result in application errors like "APPLICATION ERROR 0000801 - Benutzer nicht gefunden"!!! The administration panel does NOT warn before deleting a user nor it does describe the consequences! You are not able to delete the issue any more (=> application error)! In other words: deleting a user heavily damages the data! | ||||
| Steps To Reproduce | 1) create a temporary user account | ||||
| Additional Information | How can we repair this damage? please tell us a solution as soon as possible! | ||||
| Tags | No tags attached. | ||||
| Attached Files | 8380.patch (3,378 bytes)
Index: bugnote_view_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bugnote_view_inc.php,v
retrieving revision 1.45
diff -u -r1.45 bugnote_view_inc.php
--- bugnote_view_inc.php 12 Aug 2007 22:43:48 -0000 1.45
+++ bugnote_view_inc.php 26 Sep 2007 02:36:28 -0000
@@ -115,10 +115,12 @@
<?php
echo print_user( $v3_reporter_id );
?>
- <span class="small">(<?php
- $t_access_level = access_get_project_level( null, $v3_reporter_id );
- echo get_enum_element( 'access_levels', $t_access_level );
- ?>)</span>
+ <span class="small"><?php
+ if ( user_exists( $v3_reporter_id ) ) {
+ $t_access_level = access_get_project_level( null, $v3_reporter_id );
+ echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
+ }
+ ?></span>
<?php if ( VS_PRIVATE == $v3_view_state ) { ?>
<span class="small">[ <?php echo lang_get( 'private' ) ?> ]</span>
<?php } ?>
Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.138
diff -u -r1.138 email_api.php
--- core/email_api.php 28 Jul 2007 21:36:50 -0000 1.138
+++ core/email_api.php 26 Sep 2007 02:34:27 -0000
@@ -1027,10 +1027,16 @@
$t_time_tracking = '';
}
- $t_access_level = access_get_project_level( null, $t_bugnote->reporter_id );
+ if ( user_exists( $t_bugnote->reporter_id ) ) {
+ $t_access_level = access_get_project_level( null, $t_bugnote->reporter_id );
+ $t_access_level_string = ' (' . get_enum_element( 'access_levels', $t_access_level ) . ') - ';
+ } else {
+ $t_access_level_string = '';
+ }
+
$t_string = ' (' . $t_formatted_bugnote_id . ') ' .
user_get_name( $t_bugnote->reporter_id ) .
- ' (' . get_enum_element( 'access_levels', $t_access_level ) . ') - ' .
+ $t_access_level_string .
$t_last_modified . "\n" .
$t_time_tracking . ' ' . $t_bugnote_link;
Index: core/print_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v
retrieving revision 1.180
diff -u -r1.180 print_api.php
--- core/print_api.php 24 Aug 2007 19:04:42 -0000 1.180
+++ core/print_api.php 26 Sep 2007 02:29:06 -0000
@@ -108,6 +108,10 @@
# Print avatar image for the given user ID
function print_avatar( $p_user_id ) {
+ if ( !user_exists( $p_user_id ) ) {
+ return;
+ }
+
if ( access_has_project_level( config_get( 'show_avatar_threshold' ), null, $p_user_id ) ) {
$t_avatar = user_get_avatar( $p_user_id );
$t_avatar_url = $t_avatar[0];
Index: core/user_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/user_api.php,v
retrieving revision 1.112
diff -u -r1.112 user_api.php
--- core/user_api.php 10 Sep 2007 00:29:04 -0000 1.112
+++ core/user_api.php 26 Sep 2007 02:47:10 -0000
@@ -48,11 +48,13 @@
$result = db_query( $query );
if ( 0 == db_num_rows( $result ) ) {
+ $g_cache_user[$c_user_id] = false;
+
if ( $p_trigger_errors ) {
trigger_error( ERROR_USER_NOT_FOUND, ERROR );
- } else {
- return false;
}
+
+ return false;
}
$row = db_fetch_array( $result );
| ||||
| has duplicate | 0008434 | closed | ryandesign | Issues no longer accessible after deleting the reporting user from the system |
|
As a workaround you could find the ID of the missing user (I assume that is where the problem is and it's trying to sql join against that ID) and manually add it back into the database using a sql client. This would be to just get you back up and running. I suspect the long term fix is how to handle references to missing keys in queries. |
|
|
Thaks DGtlRift for your advice! We have practiced another Workaround: Cloning such a "damaged" ticket will result in a new ticket that is clean, but is lacks its attached notices etc (a fact we can live with, for a while). The "damaged" ticket could be closed (this still works). |
|
|
Fixed 0008380: Deleting old user Account results in Database inconsistency.
Attached is the patch that fixes the problem. |
|
related to
child of
duplicate of