From b616534d5bbc2f569015567951a56d0eb9e58efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 6 Dec 2018 21:10:24 +0100 Subject: [PATCH] repo.php: if a repo has no index.json, create one in output with all categories --- repo.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repo.php b/repo.php index 9dc044d4..5fb2245f 100644 --- a/repo.php +++ b/repo.php @@ -69,6 +69,16 @@ if (isset($config['cache'])) { $data = $repo->data(); +if (!array_key_exists('index', $data['categories'])) { + $data['categories']['index'] = array( + 'type' => 'index', + 'subCategories' => array_map( + function ($k) { + return array('id' => $k); + }, array_keys($data['categories'])) + ); +} + if (isset($repoData['repositoryUrl'])) { $data['repositoryUrl'] = $repoData['repositoryUrl']; }