use logger in task to check checksum

This commit is contained in:
Uwe Steinmann 2023-09-11 09:26:05 +02:00
parent 5bb70b82aa
commit fc8bef612e

View File

@ -365,7 +365,10 @@ class SeedDMS_IndexingDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ *
* iterating over all folders recursively. * iterating over all folders recursively.
*/ */
class SeedDMS_Task_CheckSum_Process_Folder { /* {{{ */ class SeedDMS_Task_CheckSum_Process_Folder { /* {{{ */
public function __construct() { /* {{{ */ protected $logger;
public function __construct($logger) { /* {{{ */
$this->logger = $logger;
} /* }}} */ } /* }}} */
public function process($folder) { /* {{{ */ public function process($folder) { /* {{{ */
@ -378,10 +381,10 @@ class SeedDMS_Task_CheckSum_Process_Folder { /* {{{ */
if(file_exists($dms->contentDir.$version->getPath())) { if(file_exists($dms->contentDir.$version->getPath())) {
$checksum = SeedDMS_Core_File::checksum($dms->contentDir.$version->getPath()); $checksum = SeedDMS_Core_File::checksum($dms->contentDir.$version->getPath());
if($checksum != $version->getChecksum()) { if($checksum != $version->getChecksum()) {
echo $document->getId().':'.$version->getVersion().' wrong checksum'.PHP_EOL; $this->logger->log($document->getId().':'.$version->getVersion().' wrong checksum', PEAR_LOG_WARNING);
} }
} else { } else {
echo $document->getId().':'.$version->getVersion().' missing content'.PHP_EOL; $this->logger->log($document->getId().':'.$version->getVersion().' missing content', PEAR_LOG_WARNING);
} }
} }
} }