Преглед на файлове

Addressed warnings when reading from new files

There were warnings when reading extensions (trying to use e.g. README
and .gitignore as directories), and when reading update file.
https://github.com/FreshRSS/FreshRSS/issues/733
Alexandre Alapetite преди 11 години
родител
ревизия
d30b3becfa
променени са 2 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 4 1
      app/Controllers/updateController.php
  2. 3 0
      lib/Minz/ExtensionManager.php

+ 4 - 1
app/Controllers/updateController.php

@@ -28,7 +28,10 @@ class FreshRSS_update_Controller extends Minz_ActionController {
 			);
 		} elseif (file_exists(UPDATE_FILENAME)) {
 			// There is an update file to apply!
-			$version = file_get_contents(join_path(DATA_PATH, 'last_update.txt'));
+			$version = @file_get_contents(join_path(DATA_PATH, 'last_update.txt'));
+			if (empty($version)) {
+				$version = 'unknown';
+			}
 			$this->view->update_to_apply = true;
 			$this->view->message = array(
 				'status' => 'good',

+ 3 - 0
lib/Minz/ExtensionManager.php

@@ -56,6 +56,9 @@ class Minz_ExtensionManager {
 
 		foreach ($list_potential_extensions as $ext_dir) {
 			$ext_pathname = EXTENSIONS_PATH . '/' . $ext_dir;
+			if (!is_dir($ext_pathname)) {
+				continue;
+			}
 			$metadata_filename = $ext_pathname . '/' . self::$ext_metaname;
 
 			// Try to load metadata file.