-
Notifications
You must be signed in to change notification settings - Fork 172
/
update_annotation_files.php
35 lines (29 loc) · 937 Bytes
/
update_annotation_files.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env php
<?php declare(strict_types=1);
set_include_path(
get_include_path().":".
__DIR__."/../project/tools:".
__DIR__."/../php/tools:"
);
use LORIS\electrophysiology_browser\Models\ElectrophysioAnnotations;
require_once __DIR__ . "/../vendor/autoload.php";
require_once "generic_includes.php";
require_once __DIR__
. "/../modules/electrophysiology_browser/php/models/"
. "electrophysioannotations.class.inc";
/**
* Update any derivative files that are not up to date
* with the data in the database
*/
$db = \NDB_Factory::singleton()->database();
//Get all file IDs that must be updated
$physioFileIDs = $db->pselect(
"SELECT DISTINCT paf.PhysiologicalFileID
FROM physiological_annotation_file AS paf
WHERE paf.LastWritten <= paf.LastUpdate",
[]
);
foreach ($physioFileIDs as $id) {
(new ElectrophysioAnnotations(intval($id['PhysiologicalFileID'])))
->updateFiles();
}