Skip to content

Commit 8758b71

Browse files
committed
[Tools] delete_physiological_file.php
1 parent 1d3a4d0 commit 8758b71

File tree

4 files changed

+469
-28
lines changed

4 files changed

+469
-28
lines changed

tools/delete_candidate.php renamed to tools/data_integrity/data_deletion/delete_candidate.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@
1414
*
1515
* @category Main
1616
* @package Loris
17-
* @author Various <example@example.com>
17+
* @author Loris Team <loris-dev@bic.mni.mcgill.ca>
1818
* @license Loris license
1919
* @link https://www.github.com/aces/Loris/
2020
*/
2121

22-
set_include_path(
23-
get_include_path().":".
24-
__DIR__."/../project/tools:".
25-
__DIR__."/../php/tools:"
26-
);
27-
28-
require_once __DIR__ . "/../vendor/autoload.php";
29-
require_once "generic_includes.php";
22+
require_once __DIR__ . "/../../../vendor/autoload.php";
23+
require_once __DIR__ . "/../../generic_includes.php";
3024
use \LORIS\StudyEntities\Candidate\CandID;
3125

3226
/**
@@ -82,7 +76,7 @@
8276
break;
8377
}
8478

85-
$DB =& Database::singleton();
79+
$DB = \NDB_Factory::singleton()->database();
8680

8781
/*
8882
* Perform validations on arguments
@@ -135,7 +129,7 @@ function showHelp()
135129
echo <<<USAGE
136130
*** Delete Candidate Info ***
137131
138-
Usage: php delete_candidate.php delete_candidate CandID PSCID [confirm]
132+
Usage: php delete_candidate.php delete_candidate CandID PSCID [confirm] [tosql]
139133
Example: php delete_candidate.php delete_candidate 965327 dcc0007
140134
Example: php delete_candidate.php delete_candidate 965327 dcc0007 confirm
141135
Example: php delete_candidate.php delete_candidate 965327 dcc0007 tosql
@@ -315,25 +309,25 @@ function deleteCandidate($CandID, $PSCID, $confirm, $printToSQL, $DB, &$output)
315309
$DB->delete("parameter_candidate", ["CandID" => $CandID]);
316310

317311
//delete from SNP_candidate_rel
318-
$result = $DB->delete("SNP_candidate_rel", ["CandID" => $CandID]);
312+
$DB->delete("SNP_candidate_rel", ["CandID" => $CandID]);
319313

320314
//delete from CNV
321-
$result = $DB->delete("CNV", ["CandID" => $CandID]);
315+
$DB->delete("CNV", ["CandID" => $CandID]);
322316

323317
//delete from genomic_candidate_files_rel
324-
$result = $DB->delete(
318+
$DB->delete(
325319
"genomic_candidate_files_rel",
326320
["CandID" => $CandID]
327321
);
328322

329323
//delete from genomic_sample_candidate_rel
330-
$result = $DB->delete(
324+
$DB->delete(
331325
"genomic_sample_candidate_rel",
332326
["CandID" => $CandID]
333327
);
334328

335329
//delete from issues
336-
$result = $DB->delete("issues", ["candID" => $CandID]);
330+
$DB->delete("issues", ["candID" => $CandID]);
337331

338332
//delete from candidate
339333
$DB->delete("candidate", ["CandID" => $CandID]);

tools/delete_ignored_conflicts.php renamed to tools/data_integrity/data_deletion/delete_ignored_conflicts.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@
2828
* @package Loris
2929
* @author Loris Team <loris-dev@bic.mni.mcgill.ca>
3030
* @license Loris license
31-
* @link https://www.github.com/aces/Loris-Trunk/
31+
* @link https://www.github.com/aces/Loris/
3232
*/
3333

34-
set_include_path(get_include_path().":../project/libraries:../php/libraries:");
34+
set_include_path(
35+
get_include_path().":".
36+
__DIR__."../../../project/libraries:" .
37+
__DIR__."../../../php/libraries:"
38+
);
3539

36-
require_once __DIR__ . "/../vendor/autoload.php";
40+
require_once __DIR__ . "/../../../vendor/autoload.php";
3741
require_once "NDB_Client.class.inc";
3842
$client = new NDB_Client();
3943
$client->makeCommandLine();
@@ -131,18 +135,18 @@ function detectIgnoreColumns($instruments)
131135
*/
132136
function defaultIgnoreColumns()
133137
{
134-
$db =& Database::singleton();
138+
$db = \NDB_Factory::singleton()->database();
135139

136140
if ($this->confirm) {
137141
foreach ($this->defaultFields as $field) {
138-
$defaultQuery = "DELETE FROM conflicts_unresolved
142+
$defaultQuery = "DELETE FROM conflicts_unresolved
139143
WHERE FieldName = '$field'";
140144
$changes = $db->run($defaultQuery);
141145
echo $changes . "\n";
142146
}
143147
} else {
144148
foreach ($this->defaultFields as $field) {
145-
$defaultQuery = "SELECT TableName, FieldName, Value1, Value2
149+
$defaultQuery = "SELECT TableName, FieldName, Value1, Value2
146150
FROM conflicts_unresolved WHERE FieldName = '$field'";
147151
$defaultColumn = $db->pselectOne($defaultQuery, []);
148152
echo "TableName, FieldName, Value1, Value2: ";

0 commit comments

Comments
 (0)