From 5e11ec3cddceef025bf32750d92cb213392de1ac Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Mon, 1 Sep 2025 10:40:59 +0300 Subject: [PATCH] Fix Filesource --- .../src/Model/Table/FileSourcesTable.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/availableplugins/FileConnector/src/Model/Table/FileSourcesTable.php b/app/availableplugins/FileConnector/src/Model/Table/FileSourcesTable.php index 9918554fb..b1a46780e 100644 --- a/app/availableplugins/FileConnector/src/Model/Table/FileSourcesTable.php +++ b/app/availableplugins/FileConnector/src/Model/Table/FileSourcesTable.php @@ -29,6 +29,7 @@ namespace FileConnector\Model\Table; +use App\Model\Entity\ExternalIdentitySource; use Cake\ORM\RulesChecker; use Cake\ORM\Table; use Cake\ORM\TableRegistry; @@ -389,16 +390,16 @@ protected function processChangeList( ]; } - /** - * Perform tasks following a Sync Job. - * - * @since COmanage Registry v5.2.0 - * @param ExternalIdentitySource $source External Identity Source - */ + /** + * Perform tasks following a Sync Job. + * + * @param ExternalIdentitySource $source External Identity Source + * @since COmanage Registry v5.2.0 + */ public function postRunTasks( \App\Model\Entity\ExternalIdentitySource $source - ) { + ): void { // Update the archive file. updateCache() is called after processing is complete, // and only if at least one record changed. It's possible an irregular exit will // prevent the cache from being updated, in that case we'll just end up reprocessing @@ -410,7 +411,7 @@ public function postRunTasks( return; } - if(is_readable($this->archive1)) { + if($this->archive1 !== null && is_readable($this->archive1)) { $this->llog('trace', 'Copying ' . $this->archive1 . ' to ' . $this->archive2); if(!copy($this->archive1, $this->archive2)) { @@ -420,7 +421,11 @@ public function postRunTasks( } } - if(is_readable($source->file_source->filename)) { + if( + $source->file_source->filename !== null + && $this->archive1 !== null + && is_readable($source->file_source->filename) + ) { $this->llog('trace', 'Copying ' . $source->file_source->filename . ' to ' . $this->archive1); if(!copy($source->file_source->filename, $this->archive1)) {