Skip to content

Commit

Permalink
[tools] CouchDB_Import_Instruments.php Error (aces#7689)
Browse files Browse the repository at this point in the history
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 aces#7680
  • Loading branch information
kongtiaowang authored Oct 14, 2021
1 parent a3724f1 commit 735e817
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/CouchDB_Import_Instruments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
'',
''
Expand Down

0 comments on commit 735e817

Please # to comment.