From a0e5302dba29c267ed147b84d7eed58072c57ea9 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 10 Jul 2014 11:00:19 +0100
Subject: [PATCH] Issue #2287777 by andypost: Optimize
 _dblog_get_message_types().

---
 core/modules/dblog/dblog.module | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module
index 25a4b0e58541..d6e20ff36c57 100644
--- a/core/modules/dblog/dblog.module
+++ b/core/modules/dblog/dblog.module
@@ -87,14 +87,8 @@ function dblog_cron() {
  *   List of uniquely defined database log message types.
  */
 function _dblog_get_message_types() {
-  $types = array();
-
-  $result = db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type');
-  foreach ($result as $object) {
-    $types[] = $object->type;
-  }
-
-  return array_combine($types, $types);
+  return db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type')
+    ->fetchAllKeyed(0, 0);
 }
 
 /**
-- 
GitLab