From af24ded763fbd21d02b1cfe1cac32c25c749b2e2 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 3 Jul 2014 12:12:25 -0400
Subject: [PATCH] More graceful handling of missing YAML files.

---
 module/VuFind/src/VuFind/Config/SearchSpecsReader.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/src/VuFind/Config/SearchSpecsReader.php b/module/VuFind/src/VuFind/Config/SearchSpecsReader.php
index dcac9ac5a60..f65a280a402 100644
--- a/module/VuFind/src/VuFind/Config/SearchSpecsReader.php
+++ b/module/VuFind/src/VuFind/Config/SearchSpecsReader.php
@@ -83,7 +83,8 @@ class SearchSpecsReader
             $local = Locator::getLocalConfigPath($filename);
 
             // Generate cache key:
-            $cacheKey = $filename . '-' . filemtime($fullpath);
+            $cacheKey = $filename . '-'
+                . (file_exists($fullpath) ? filemtime($fullpath) : 0);
             if (!empty($local)) {
                 $cacheKey .= '-local-' . filemtime($local);
             }
@@ -91,7 +92,7 @@ class SearchSpecsReader
 
             // Generate data if not found in cache:
             if ($cache === false || !($results = $cache->getItem($cacheKey))) {
-                $results = Yaml::parse($fullpath);
+                $results = file_exists($fullpath) ? Yaml::parse($fullpath) : array();
                 if (!empty($local)) {
                     $localResults = Yaml::parse($local);
                     foreach ($localResults as $key => $value) {
-- 
GitLab