Loris icon indicating copy to clipboard operation
Loris copied to clipboard

[DQT] CouchDB_Confirm_Integrity.php not deleting CouchDB docs pertaining to deleted LORIS candidates

Open ejoh1101 opened this issue 4 years ago • 4 comments

Describe the bug CouchDB_Confirm_Integrity.php does not delete docs related to candidates deleted from LORIS DB.

To Reproduce Delete a candidate using delete_candidate.php (or manually delete from candidate table in MySQL DB). Run CouchDB_Confirm_Integrity.php. Note that CouchDB docs related to deleted candidate will appear in log with text "Nothing wrong with <doc_id>". Using DQT this deleted candidate is still queryable.

What did you expect to happen? Expected CouchDB_Confirm_Integrity.php to remove documents from CouchDB that no longer match a participant in LORIS database.

Server Environment:

  • LORIS Version: 22
  • Linux distribution and Version: RHEL 7
  • MySQL/MariaDB Version: MariaDB 10.3
  • PHP 73

Additional context It appears that there is no condition in CouchDB_Confirm_Integrity.php function run() that would apply if $sqlDB returns empty. All if conditions only apply if !empty($sqlDB) so when $sqlDB is returned empty it defaults to the else statement ("Nothing wrong"). I'd suggest adding a condition for when $sqlDB returns empty, something along the lines of

} else if (empty($sqlDB)) {   print "PSCID $pscid no longer exists for $row[id].\n";   $this->CouchDB->deleteDoc($row['id']);

I realize that deleting candidates is not a suggested method for removing data from LORIS but there are cases where it is appropriate. In these cases, it would make sense that CouchDB_Confirm_Integrity.php would remove these docs (thus confirming the integrity of the CouchDB data).

ejoh1101 avatar May 21 '20 18:05 ejoh1101

thanks for reporting this, @ejoh1101

@samirdas @driusan @ridz1208 is this DQT delete-cascade feature something @maltheism might integrate into the next DQT updates / Roadmap ?

christinerogers avatar May 27 '20 23:05 christinerogers

@driusan this might even be critical?

ridz1208 avatar Jan 04 '22 15:01 ridz1208

@zaliqarosli can you look into it? (from Dave and Rida ;))

cmadjar avatar Jan 10 '23 14:01 cmadjar

hi ! i believe this was targeted by https://github.com/aces/Loris/pull/8148 @cmadjar @ridz1208 @driusan

zaliqarosli avatar Jan 10 '23 20:01 zaliqarosli