]> git.mxchange.org Git - friendica.git/commitdiff
Apply suggestions from code review
authorPhilipp <admin+Github@philipp.info>
Fri, 6 Jan 2023 11:46:06 +0000 (12:46 +0100)
committerGitHub <noreply@github.com>
Fri, 6 Jan 2023 11:46:06 +0000 (12:46 +0100)
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
src/Core/Config/Util/ConfigFileManager.php
src/Core/Config/Util/ConfigFileTransformer.php

index c7e63a63b036f4fd63d0acdd8790da1b544edf82..3a4ebb89319d5d48309f4707dd7597d90c70b908 100644 (file)
@@ -257,13 +257,14 @@ class ConfigFileManager
                                        // When reading the config file too fast, we get a wrong filesize, "clearstatcache" prevents that
                                        clearstatcache(true, $filename);
                                        $content = fread($configStream, filesize($filename));
-                                       // Event truncating the whole content wouldn't automatically rewind the stream,
-                                       // so we need to do it manually
-                                       rewind($configStream);
                                        if (!$content) {
                                                throw new ConfigFileException(sprintf('Cannot read file %s', $filename));
                                        }
 
+                                       // Event truncating the whole content wouldn't automatically rewind the stream,
+                                       // so we need to do it manually
+                                       rewind($configStream);
+
                                        $dataArray = eval('?>' . $content);
 
                                        // Merge the new content into the existing file based config cache and use it
@@ -279,7 +280,6 @@ class ConfigFileManager
                                $data = $configCache->getDataBySource(Cache::SOURCE_DATA);
 
                                $encodedData = ConfigFileTransformer::encode($data);
-
                                if (!$encodedData) {
                                        throw new ConfigFileException('config source cannot get encoded');
                                }
index 4eaafe0610d3218843f9fe607128cc1f3baa37a0..ac4990df1306155ed9873f57887049b82267d5ee 100644 (file)
@@ -34,7 +34,6 @@ class ConfigFileTransformer
                $categories = array_keys($data);
 
                foreach ($categories as $category) {
-
                        if (is_null($data[$category])) {
                                $dataString .= "\t'$category' => null," . PHP_EOL;
                                continue;