Open ejoh1101 opened 4 years ago
thanks for reporting this, @ejoh1101
@samirdas @driusan @ridz1208 is this DQT delete-cascade feature something @maltheism might integrate into the next DQT updates / Roadmap ?
@driusan this might even be critical?
@zaliqarosli can you look into it? (from Dave and Rida ;))
hi ! i believe this was targeted by https://github.com/aces/Loris/pull/8148 @cmadjar @ridz1208 @driusan
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". 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:
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 theelse
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).