Commit e1ce977e authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

fix(16693) : change the way to select archives between requested and skipped + updates log message

parent 8552f13b
Pipeline #13462 failed with stages
in 49 seconds
......@@ -856,22 +856,49 @@ trait archiveModificationTrait
$archiveIds = $this->sdoFactory->index(
'recordsManagement/archive',
'archiveId',
'fullTextIndexation=:requested OR fullTextIndexation=:skipped',
'fullTextIndexation=:requested',
[
'requested' => 'requested',
'skipped' => 'skipped'
'requested' => 'requested'
],
null,
0,
$maxResults
);
$selectedRequested = count($archiveIds);
$logMessage = ["message" => "%s archives requested selected", "variables"=> $selectedRequested];
\laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
if($selectedRequested < $maxResults) {
$archiveIds = array_merge(
$archiveIds,
$this->sdoFactory->index(
'recordsManagement/archive',
'archiveId',
'fullTextIndexation=:skipped',
[
'skipped' => 'skipped'
],
null,
0,
$maxResults - $selectedRequested
)
);
}
$logMessage = ["message" => "%s archives previously skipped selected", "variables"=> count($archiveIds) - $selectedRequested];
\laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
$fullTextServices = \laabs::configuration('dependency.fileSystem')['fullTextServices'];
$archiveExtractedCount = 0;
$errors = [];
$endTimeScript = microtime(true) + $timeLimit;
$skipped = 0;
$indexed = 0;
foreach ($archiveIds as $archiveId) {
if (!is_null($timeLimit) && ($endTimeScript - microtime(true)) <= 0) {
$logMessage = ["message" => "Time Limit reached"];
......@@ -920,22 +947,30 @@ trait archiveModificationTrait
$descriptionController->update($archive, $fullText);
if (!empty($status)) {
$archive->fullTextIndexation = $status;
$skipped++;
} else {
$archive->fullTextIndexation = "indexed";
$indexed++;
}
$this->sdoFactory->update($archive, 'recordsManagement/archiveIndexationStatus');
} catch (\Exception $e) {
throw new Exception("Error Processing Request", 1);
}
$logMessage = ["message" => "Archive %s extracted", "variables"=> $archive->archiveName];
\laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
// $logMessage = ["message" => "Archive %s extracted", "variables"=> $archive->archiveName];
// \laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
$this->logMetadataModification($archive, true);
$archiveExtractedCount++;
}
$logMessage = ["message" => "%s archive(s) extracted", "variables"=> $archiveExtractedCount];
// $logMessage = ["message" => "%s archive(s) processed", "variables"=> $archiveExtractedCount];
// \laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
$logMessage = ["message" => "%s archive(s) indexed", "variables"=> $indexed];
\laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
$logMessage = ["message" => "%s archive(s) skipped", "variables"=> $skipped];
\laabs::notify(\bundle\audit\AUDIT_ENTRY_OUTPUT, $logMessage);
return true;
......
......@@ -1951,5 +1951,17 @@ msgstr "résultat(s) sur"
msgid "Archive %s extracted"
msgstr "Archive %s extraite"
msgid "%s archive(s) indexed"
msgstr "%s archive(s) indexée(s)"
msgid "%s archive(s) skipped"
msgstr "%s archive(s) passée(s)"
msgid "%s archives requested selected"
msgstr "%s archive(s) en attente selectionnée(s)"
msgid "%s archives previously skipped selected"
msgstr "%s archive(s) précedemment passée(s) selectionnée(s)"
msgid "%s archive(s) extracted"
msgstr "%s archive(s) extraite(s)"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment