]> git.joonet.de Git - adminer.git/commitdiff
Elasticsearch: check for valid mappings
authorGargaj <gargaj@conspiracy.hu>
Fri, 5 Sep 2014 23:20:20 +0000 (01:20 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 11 Sep 2014 15:30:23 +0000 (08:30 -0700)
adminer/drivers/elastic.inc.php

index 397ca6b9fd8ed4968f3dda650c144cd00bfcc37b..3aac8331160a8cb704f958f30e5507253cb5732f 100644 (file)
@@ -280,13 +280,15 @@ if (isset($_GET["elastic"])) {
                        if (!$mappings) {
                                $mappings = $result[$connection->_db]['mappings'][$table]['properties'];
                        }
-                       foreach ($mappings as $name => $field) {
-                               $return[$name] = array(
-                                       "field" => $name,
-                                       "full_type" => $field["type"],
-                                       "type" => $field["type"],
-                                       "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
-                               );
+                       if ($mappings) {
+                               foreach ($mappings as $name => $field) {
+                                       $return[$name] = array(
+                                               "field" => $name,
+                                               "full_type" => $field["type"],
+                                               "type" => $field["type"],
+                                               "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
+                                       );
+                               }
                        }
                }
                return $return;