X-Git-Url: https://git.cweiske.de/phinde.git/blobdiff_plain/59f931647a2b4a13be20ba8f2baa4ec93e334ee5..4fa1d0022a87079f77eddb6a55ad67c82e9c1be3:/bin/setup.php diff --git a/bin/setup.php b/bin/setup.php index ca71aed..ba97493 100755 --- a/bin/setup.php +++ b/bin/setup.php @@ -7,6 +7,14 @@ namespace phinde; */ require_once __DIR__ . '/../src/init.php'; +$json = file_get_contents(__DIR__ . '/../data/elasticsearch-mapping.json'); +if (json_decode($json) === null) { + Log::error("Error: Schema JSON is broken"); + chdir(__DIR__ . '/../'); + passthru('json_pp -t null < data/elasticsearch-mapping.json'); + exit(1); +} + //delete old index $r = new Elasticsearch_Request( $GLOBALS['phinde']['elasticsearch'], @@ -20,8 +28,6 @@ $r = new Elasticsearch_Request( $GLOBALS['phinde']['elasticsearch'], \HTTP_Request2::METHOD_PUT ); -$r->setBody( - file_get_contents(__DIR__ . '/../data/elasticsearch-mapping.json') -); +$r->setBody($json); $r->send(); ?>