Skip to content

Commit

Permalink
FileChecker: check for utf8 locale and fix the droid output reading
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Jun 24, 2024
1 parent 65db70a commit a1600dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/acdhOeaw/arche/fileChecker/FileChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public function check(string $dir, int $maxDepth = PHP_INT_MAX,
echo "\nERROR: Directory '$dir' does not exist\n";
return false;
}
if (!str_ends_with(strtolower($_SERVER['LC_ALL'] ?? ''), 'utf8')) {
echo "\nERROR: non-UTF8 locale\n";
return false;
}

$droidOutput = $this->runDroid($sortDroidOutput);
echo "\n### Running DROID...\n\n";
Expand Down Expand Up @@ -226,7 +230,7 @@ public function generateReports(bool $csv, bool $html): void {
$of[] = [FileInfo::OUTPUT_FILELIST, new OutputFormatter("$this->reportDir/fileList.csv", OutputFormatter::FORMAT_CSV, FileInfo::getCsvHeader(FileInfo::OUTPUT_FILELIST))];
$of[] = [FileInfo::OUTPUT_DIRLIST, new OutputFormatter("$this->reportDir/directoryList.csv", OutputFormatter::FORMAT_CSV, FileInfo::getCsvHeader(FileInfo::OUTPUT_DIRLIST))];
}
while ($l = fgets($infh)) {
while ($l = trim(fgets($infh))) {
$fi = FileInfo::fromJson($l);
foreach ($of as $x => $i) {
$fi->save($i[1], $i[0]);
Expand Down

0 comments on commit a1600dc

Please sign in to comment.