From 5d2662a6a3b20783ee515fe136b93ceb343a31ce Mon Sep 17 00:00:00 2001 From: Fil Date: Fri, 20 Jun 2014 12:24:09 +0200 Subject: [PATCH] Check which .mbtiles files are readable In my setup some .mbtiles are links to an external hard drive - don't fail when the external drive is not connected. (Also this would allow to manage "publishing a map" via unix permission.) --- tileserver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tileserver.php b/tileserver.php index 35d455c..db3aa4f 100644 --- a/tileserver.php +++ b/tileserver.php @@ -71,13 +71,13 @@ class Server { $mjs = glob('*/metadata.json'); $mbts = glob('*.mbtiles'); if ($mjs) { - foreach ($mjs as $mj) { + foreach (array_filter($mjs, 'is_readable') as $mj) { $layer = $this->metadataFromMetadataJson($mj); array_push($this->fileLayer, $layer); } } if ($mbts) { - foreach ($mbts as $mbt) { + foreach (array_filter($mbts, 'is_readable') as $mbt) { $this->dbLayer[] = $this->metadataFromMbtiles($mbt); } }