From 735e8175b39da17f0b91f263311be84128a9b01a Mon Sep 17 00:00:00 2001 From: Shen Date: Thu, 14 Oct 2021 09:42:03 -0400 Subject: [PATCH] [tools] CouchDB_Import_Instruments.php Error (#7689) Fix error ``` PHP Fatal error: Uncaught TypeError: NDB_BVL_Instrument::factory(): Argument #1 ($loris) must be of type LORIS\LORISInstance, string given, called in /var/www/Loris/tools/CouchDB_Import_Instruments.php on line 196 and defined in /var/www/Loris/php/libraries/NDB_BVL_Instrument.class.inc:225 ``` In CouchDB_Import_Instruments.php Fixes #7680 --- tools/CouchDB_Import_Instruments.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/CouchDB_Import_Instruments.php b/tools/CouchDB_Import_Instruments.php index b129ac4a0fe..871a9a23d7e 100755 --- a/tools/CouchDB_Import_Instruments.php +++ b/tools/CouchDB_Import_Instruments.php @@ -180,17 +180,26 @@ function generateDocumentSQL(string $tablename) : string */ function updateCandidateDocs($Instruments) { - $results = [ + $results = [ 'new' => 0, 'modified' => 0, 'unchanged' => 0, ]; + $lorisinstance = new \LORIS\LorisInstance( + \NDB_Factory::singleton()->database(), + \NDB_Factory::singleton()->config(), + [ + __DIR__ . "/../project/modules", + __DIR__ . "/../modules/", + ] + ); foreach ($Instruments as $instrument => $name) { // Since the testname does not always match the table name in the // the database, we need to instantiate the object to get the // table name. // We need to check if it is a JSONData instrument or SQL data $instrumentObj = \NDB_BVL_Instrument::factory( + $lorisinstance, $instrument, '', ''