From 572a550d9fd409ccf4d148cd7e01265ff5d30290 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Tue, 25 Jun 2024 14:06:11 -0400 Subject: [PATCH 1/5] Reducing PHP Warnings This bit of code is being told to process not-files on PHP 7.4 AppKernels. So adding a quick check to make sure that the fd actually points to a file before processing will make it so those error messages aren't generated. --- classes/ETL/DataEndpoint/aStructuredFile.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/ETL/DataEndpoint/aStructuredFile.php b/classes/ETL/DataEndpoint/aStructuredFile.php index f9a4bb3368..297e0d0220 100644 --- a/classes/ETL/DataEndpoint/aStructuredFile.php +++ b/classes/ETL/DataEndpoint/aStructuredFile.php @@ -294,10 +294,12 @@ protected function parseFile($path) if ( null === $this->recordSeparator ) { while ( ! feof($fd) ) { - $data = fread($fd, self::DEFAULT_READ_BYTES); - if ( false !== $data ) { - $buffer .= $data; - $totalBytesRead += strlen($data); + if (is_file($fd)) { + $data = fread($fd, self::DEFAULT_READ_BYTES); + if ( false !== $data ) { + $buffer .= $data; + $totalBytesRead += strlen($data); + } } } } else { From 755f256849fef9bfb88ca6229d25ea5e5e9b78a5 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Tue, 25 Jun 2024 14:25:58 -0400 Subject: [PATCH 2/5] This is what I get for working from memory --- classes/ETL/DataEndpoint/aStructuredFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/ETL/DataEndpoint/aStructuredFile.php b/classes/ETL/DataEndpoint/aStructuredFile.php index 297e0d0220..36fa3a47c0 100644 --- a/classes/ETL/DataEndpoint/aStructuredFile.php +++ b/classes/ETL/DataEndpoint/aStructuredFile.php @@ -294,7 +294,7 @@ protected function parseFile($path) if ( null === $this->recordSeparator ) { while ( ! feof($fd) ) { - if (is_file($fd)) { + if (is_file($this->path)) { $data = fread($fd, self::DEFAULT_READ_BYTES); if ( false !== $data ) { $buffer .= $data; From 5ece79107bfca83f3dc4abfe7f07aa4b6c5de22f Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Tue, 25 Jun 2024 16:08:38 -0400 Subject: [PATCH 3/5] fixing stuff --- classes/OpenXdmod/Migration/ConfigFilesMigration.php | 4 ++-- classes/OpenXdmod/Migration/Migration.php | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/classes/OpenXdmod/Migration/ConfigFilesMigration.php b/classes/OpenXdmod/Migration/ConfigFilesMigration.php index a7241ca451..16eabbe0ea 100644 --- a/classes/OpenXdmod/Migration/ConfigFilesMigration.php +++ b/classes/OpenXdmod/Migration/ConfigFilesMigration.php @@ -187,7 +187,7 @@ protected function writeJsonConfigFile($name, array $data) $file = implode( DIRECTORY_SEPARATOR, array( - $this->config->getBaseDir(), + $this->baseDir, "$name.json" ) ); @@ -249,7 +249,7 @@ protected function assertJsonConfigIsWritable($name) $file = implode( DIRECTORY_SEPARATOR, array( - $this->config->getBaseDir(), + $this->baseDir, "$name.json" ) ); diff --git a/classes/OpenXdmod/Migration/Migration.php b/classes/OpenXdmod/Migration/Migration.php index e0a97e7e35..34052fd0a0 100644 --- a/classes/OpenXdmod/Migration/Migration.php +++ b/classes/OpenXdmod/Migration/Migration.php @@ -35,6 +35,8 @@ abstract class Migration */ protected $config; + protected $baseDir; + /** * Logger object. * @@ -56,12 +58,7 @@ public function __construct($currentVersion, $newVersion) $this->logger = Log::singleton('null'); - $this->config = Configuration::factory( - ".", - CONFIG_DIR, - $this->logger - ); - + $this->baseDir = CONFIG_DIR; } /** From 3dfd09952c7f8bc678d3230e3b58b9a58dc59f24 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Tue, 25 Jun 2024 16:12:12 -0400 Subject: [PATCH 4/5] restoring original content --- classes/ETL/DataEndpoint/aStructuredFile.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/classes/ETL/DataEndpoint/aStructuredFile.php b/classes/ETL/DataEndpoint/aStructuredFile.php index 36fa3a47c0..f9a4bb3368 100644 --- a/classes/ETL/DataEndpoint/aStructuredFile.php +++ b/classes/ETL/DataEndpoint/aStructuredFile.php @@ -294,12 +294,10 @@ protected function parseFile($path) if ( null === $this->recordSeparator ) { while ( ! feof($fd) ) { - if (is_file($this->path)) { - $data = fread($fd, self::DEFAULT_READ_BYTES); - if ( false !== $data ) { - $buffer .= $data; - $totalBytesRead += strlen($data); - } + $data = fread($fd, self::DEFAULT_READ_BYTES); + if ( false !== $data ) { + $buffer .= $data; + $totalBytesRead += strlen($data); } } } else { From 7dd5fda2d727f25c00bddb3f6d1fe1c66a58c329 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Wed, 26 Jun 2024 10:21:39 -0400 Subject: [PATCH 5/5] restructuring fix --- classes/OpenXdmod/Migration/ConfigFilesMigration.php | 4 ++-- classes/OpenXdmod/Migration/Migration.php | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/classes/OpenXdmod/Migration/ConfigFilesMigration.php b/classes/OpenXdmod/Migration/ConfigFilesMigration.php index 16eabbe0ea..46d6b3f4c8 100644 --- a/classes/OpenXdmod/Migration/ConfigFilesMigration.php +++ b/classes/OpenXdmod/Migration/ConfigFilesMigration.php @@ -187,7 +187,7 @@ protected function writeJsonConfigFile($name, array $data) $file = implode( DIRECTORY_SEPARATOR, array( - $this->baseDir, + CONFIG_DIR, "$name.json" ) ); @@ -249,7 +249,7 @@ protected function assertJsonConfigIsWritable($name) $file = implode( DIRECTORY_SEPARATOR, array( - $this->baseDir, + CONFIG_DIR, "$name.json" ) ); diff --git a/classes/OpenXdmod/Migration/Migration.php b/classes/OpenXdmod/Migration/Migration.php index 34052fd0a0..464e16e574 100644 --- a/classes/OpenXdmod/Migration/Migration.php +++ b/classes/OpenXdmod/Migration/Migration.php @@ -28,15 +28,6 @@ abstract class Migration */ protected $newVersion; - /** - * An empty default Configuration object. - * - * @var Configuration - */ - protected $config; - - protected $baseDir; - /** * Logger object. * @@ -55,10 +46,7 @@ public function __construct($currentVersion, $newVersion) $this->currentVersion = $currentVersion; $this->newVersion = $newVersion; - $this->logger = Log::singleton('null'); - - $this->baseDir = CONFIG_DIR; } /**